Skip to content

Add missing selenium function #13493

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions selenium/bin/suite_template
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,12 @@ runWith() {
run_local_with $@
fi
}
initOnly() {
if [[ "$COMMAND" == "initOnly" ]]
then
init_only $@
fi
}

run_local_with() {
export PROFILES="local ${PROFILES}"
Expand Down Expand Up @@ -536,6 +542,15 @@ determine_required_components_excluding_rabbitmq() {
fi
}
}
initOnly() {
for (( i=1; i<=$#; i++)) {
eval val='$'$i
if [[ $val != "rabbitmq" ]]; then
init="init_$val"
$init
fi
}
}
run_on_docker_with() {
determine_required_components_including_rabbitmq $@
export PROFILES=`profiles_with_local_or_docker`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ TEST_CONFIG_PATH=/multi-oauth
PROFILES="devkeycloak prodkeycloak enable-basic-auth with-resource-label with-resource-scopes tls"

source $SCRIPT/../../bin/suite_template $@
initOnly devkeycloak prodkeycloak
run
2 changes: 1 addition & 1 deletion selenium/test/oauth/with-idp-down/landing.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand Down
21 changes: 21 additions & 0 deletions selenium/test/pageobjects/BasePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 3 additions & 0 deletions selenium/test/pageobjects/SSOHomePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading