Add missing function that
checks if element is not visible
This commit is contained in:
parent
09f1ab47b7
commit
8b0589bd5c
|
@ -26,7 +26,7 @@ describe('When UAA is down', function () {
|
|||
|
||||
it('should not be presented with a login button to log in', async function () {
|
||||
await homePage.isLoaded()
|
||||
assert.equal(false, await homePage.isLoginButtonVisible())
|
||||
assert.ok(await homePage.isLoginButtonNotVisible())
|
||||
})
|
||||
|
||||
after(async function () {
|
||||
|
|
|
@ -163,6 +163,27 @@ module.exports = class BasePage {
|
|||
})
|
||||
*/
|
||||
}
|
||||
|
||||
async isPopupWarningNotDisplayed() {
|
||||
return this.isElementNotVisible(FORM_POPUP)
|
||||
}
|
||||
|
||||
async isElementNotVisible(locator) {
|
||||
try {
|
||||
await this.driver.wait(async() => {
|
||||
try {
|
||||
const element = await this.driver.findElement(locator)
|
||||
const visible = await element.isDisplayed()
|
||||
return !visible
|
||||
} catch (error) {
|
||||
return true
|
||||
}
|
||||
}, this.timeout)
|
||||
return true
|
||||
} catch (error) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
async getPopupWarning() {
|
||||
let element = await driver.findElement(FORM_POPUP)
|
||||
return this.driver.wait(until.elementIsVisible(element), this.timeout,
|
||||
|
|
|
@ -51,6 +51,9 @@ module.exports = class SSOHomePage extends BasePage {
|
|||
async getOAuthResourceOptions () {
|
||||
return this.getSelectableOptions(SELECT_RESOURCES)
|
||||
}
|
||||
async isLoginButtonNotVisible() {
|
||||
return this.isElementNotVisible(OAUTH2_LOGIN_BUTTON)
|
||||
}
|
||||
async isLoginButtonVisible() {
|
||||
try {
|
||||
await this.waitForDisplayed(OAUTH2_LOGIN_BUTTON)
|
||||
|
|
Loading…
Reference in New Issue