Add missing function that

checks if element is not visible
This commit is contained in:
Marcial Rosales 2025-03-12 10:31:34 +01:00
parent 09f1ab47b7
commit 8b0589bd5c
3 changed files with 25 additions and 1 deletions

View File

@ -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 () {

View File

@ -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,

View File

@ -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)