Fix issue waiting for oauth2 section

This commit is contained in:
Marcial Rosales 2024-02-10 10:59:50 +01:00
parent ad9fc504fb
commit 22aa5172b9
5 changed files with 11 additions and 8 deletions

View File

@ -47,7 +47,7 @@ start_devkeycloak() {
wait_for_oidc_endpoint devkeycloak $DEVKEYCLOAK_URL $MOUNT_DEVKEYCLOAK_CONF_DIR/ca_certificate.pem wait_for_oidc_endpoint devkeycloak $DEVKEYCLOAK_URL $MOUNT_DEVKEYCLOAK_CONF_DIR/ca_certificate.pem
end "devkeycloak is ready" end "devkeycloak is ready"
print "If you modify devkeycloak configuration. Make sure to run the following command to export the configuration." print " Note: If you modify devkeycloak configuration. Make sure to run the following command to export the configuration."
print "docker exec -it devkeycloak /opt/keycloak/bin/kc.sh export --users realm_file --realm test --dir /opt/keycloak/data/import/" print " docker exec -it devkeycloak /opt/keycloak/bin/kc.sh export --users realm_file --realm test --dir /opt/keycloak/data/import/"
} }

View File

@ -47,6 +47,6 @@ start_keycloak() {
wait_for_oidc_endpoint keycloak $KEYCLOAK_URL $MOUNT_KEYCLOAK_CONF_DIR/ca_certificate.pem wait_for_oidc_endpoint keycloak $KEYCLOAK_URL $MOUNT_KEYCLOAK_CONF_DIR/ca_certificate.pem
end "Keycloak is ready" end "Keycloak is ready"
print "If you modify keycloak configuration. Make sure to run the following command to export the configuration." print " Note: If you modify keycloak configuration. Make sure to run the following command to export the configuration."
print "docker exec -it keycloak /opt/keycloak/bin/kc.sh export --users realm_file --realm test --dir /opt/keycloak/data/import/" print " docker exec -it keycloak /opt/keycloak/bin/kc.sh export --users realm_file --realm test --dir /opt/keycloak/data/import/"
} }

View File

@ -46,7 +46,7 @@ start_prodkeycloak() {
wait_for_oidc_endpoint prodkeycloak $PRODKEYCLOAK_URL $MOUNT_PRODKEYCLOAK_CONF_DIR/ca_certificate.pem wait_for_oidc_endpoint prodkeycloak $PRODKEYCLOAK_URL $MOUNT_PRODKEYCLOAK_CONF_DIR/ca_certificate.pem
end "prodkeycloak is ready" end "prodkeycloak is ready"
print "If you modify prodkeycloak configuration. Make sure to run the following command to export the configuration." print " Note: If you modify prodkeycloak configuration. Make sure to run the following command to export the configuration."
print "docker exec -it prodkeycloak /opt/keycloak/bin/kc.sh export --users realm_file --realm test --dir /opt/keycloak/data/import/" print " docker exec -it prodkeycloak /opt/keycloak/bin/kc.sh export --users realm_file --realm test --dir /opt/keycloak/data/import/"
} }

View File

@ -18,14 +18,14 @@ 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 () { it('should be presented with a login button to log in using OAuth 2.0', async function () {
assert.ok(await homePage.isOAuth2SectionVisible()) await homePage.getOAuth2Section()
assert.equal(await homePage.getLoginButton(), 'Click here to log in') assert.equal(await homePage.getLoginButton(), 'Click here to log in')
}) })
it('should be presented with a login button to log in using Basic Auth', async function () { it('should be presented with a login button to log in using Basic Auth', async function () {
await homePage.toggleBasicAuthSection() await homePage.toggleBasicAuthSection()
assert.ok(await homePage.isBasicAuthSectionVisible()) await homePage.getBasicAuthSection()
assert.equal(await homePage.getBasicAuthLoginButton(), 'Login') assert.equal(await homePage.getBasicAuthLoginButton(), 'Login')
}) })

View File

@ -150,10 +150,13 @@ module.exports = class BasePage {
async isDisplayed(locator) { async isDisplayed(locator) {
try { try {
element = await driver.findElement(locator)
console.log("element:"+element)
return this.driver.wait(until.elementIsVisible(element), this.timeout / 2, return this.driver.wait(until.elementIsVisible(element), this.timeout / 2,
'Timed out after [timeout=' + this.timeout + ';polling=' + this.polling + '] awaiting till visible ' + element, 'Timed out after [timeout=' + this.timeout + ';polling=' + this.polling + '] awaiting till visible ' + element,
this.polling / 2) this.polling / 2)
}catch(error) { }catch(error) {
console.log("isDisplayed(" + locator + "). Error:" + error)
return Promise.resolve(false) return Promise.resolve(false)
} }
} }