Fix unauthorized.js test
This commit is contained in:
parent
16bdeff55a
commit
d69fc0e8b9
|
@ -19,6 +19,8 @@ auth_oauth2.resource_servers.1.id = rabbit_prod
|
|||
auth_oauth2.resource_servers.1.oauth_provider_id = prodkeycloak
|
||||
auth_oauth2.resource_servers.2.id = rabbit_dev
|
||||
auth_oauth2.resource_servers.2.oauth_provider_id = devkeycloak
|
||||
auth_oauth2.resource_servers.3.id = rabbit_internal
|
||||
auth_oauth2.resource_servers.3.oauth_provider_id = devkeycloak
|
||||
|
||||
## Oauth providers
|
||||
auth_oauth2.oauth_providers.devkeycloak.issuer = ${DEVKEYCLOAK_URL}
|
||||
|
@ -45,3 +47,6 @@ management.oauth_resource_servers.2.id = rabbit_dev
|
|||
management.oauth_resource_servers.2.oauth_client_id = rabbit_dev_mgt_ui
|
||||
management.oauth_resource_servers.2.label = RabbitMQ Development
|
||||
management.oauth_resource_servers.2.oauth_scopes = openid profile rabbitmq.tag:management
|
||||
|
||||
management.oauth_resource_servers.3.id = rabbit_internal
|
||||
management.oauth_resource_servers.3.disabled = true
|
||||
|
|
|
@ -18,7 +18,8 @@ describe('A user which accesses any protected URL without a session where basic
|
|||
})
|
||||
|
||||
it('should be presented with a login button to log in using OAuth 2.0', async function () {
|
||||
assert.ok(await homePage.isOAuth2SectionVisible())
|
||||
assert.ok(await homePage.getOAuth2Section())
|
||||
console.log("had oauth section")
|
||||
assert.equal(await homePage.getLoginButton(), 'Click here to log in')
|
||||
})
|
||||
|
||||
|
|
|
@ -133,12 +133,13 @@ module.exports = class BasePage {
|
|||
}
|
||||
|
||||
async isDisplayed(locator) {
|
||||
try {
|
||||
element = await this.driver.findElement(locator)
|
||||
return Promise.resolve(element.isDisplayed())
|
||||
}catch(e) {
|
||||
return Promise.resolve(false)
|
||||
}
|
||||
try {
|
||||
return this.driver.wait(until.elementIsVisible(element), this.timeout / 2,
|
||||
'Timed out after [timeout=' + this.timeout + ';polling=' + this.polling + '] awaiting till visible ' + element,
|
||||
this.polling / 2)
|
||||
}catch(error) {
|
||||
return Promise.resolve(false)
|
||||
}
|
||||
}
|
||||
|
||||
async waitForLocated (locator) {
|
||||
|
@ -163,6 +164,7 @@ module.exports = class BasePage {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
async waitForDisplayed (locator) {
|
||||
return this.waitForVisible(await this.waitForLocated(locator))
|
||||
}
|
||||
|
|
|
@ -69,22 +69,14 @@ module.exports = class SSOHomePage extends BasePage {
|
|||
}
|
||||
|
||||
async isOAuth2SectionVisible() {
|
||||
//return this.isDisplayed(SECTION_LOGIN_WITH_OAUTH)
|
||||
try {
|
||||
await this.waitForDisplayed(SECTION_LOGIN_WITH_OAUTH)
|
||||
return Promise.resolve(true)
|
||||
} catch (e) {
|
||||
return Promise.resolve(false)
|
||||
}
|
||||
return this.isDisplayed(SECTION_LOGIN_WITH_OAUTH)
|
||||
}
|
||||
async getOAuth2Section() {
|
||||
await this.waitForDisplayed(SECTION_LOGIN_WITH_OAUTH)
|
||||
}
|
||||
async isBasicAuthSectionVisible() {
|
||||
//return this.isDisplayed(SECTION_LOGIN_WITH_BASIC_AUTH)
|
||||
try {
|
||||
await this.waitForDisplayed(SECTION_LOGIN_WITH_BASIC_AUTH)
|
||||
return Promise.resolve(true)
|
||||
} catch (e) {
|
||||
return Promise.resolve(false)
|
||||
}
|
||||
return this.isDisplayed(SECTION_LOGIN_WITH_BASIC_AUTH)
|
||||
|
||||
}
|
||||
async toggleBasicAuthSection() {
|
||||
await this.click(SECTION_LOGIN_WITH_BASIC_AUTH)
|
||||
|
|
Loading…
Reference in New Issue