Skip to content

Commit b801b2a

Browse files
MarcialRosalesmergify[bot]
authored andcommitted
Add more coverage
(cherry picked from commit 6324d98)
1 parent a0a4c3d commit b801b2a

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

selenium/test/multi-oauth/with-basic-auth/landing-with-login-preferences.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,24 @@ describe('Given two oauth resources and basic auth enabled, an unauthenticated u
6060
assert.ok((await basicSection.getAttribute("class")).includes("section-visible"))
6161
})
6262

63+
it('can force only to authenticate only with rabbit_dev oauth2 resource', async function () {
64+
const homePage = await login("strict_auth_mechanism", "oauth2:rabbit_dev");
65+
const value = await homePage.getLoginButtonOnClick();
66+
assert.ok(value.includes("rabbit_dev"));
67+
})
68+
it('can force only to authenticate only with rabbit_prod oauth2 resource', async function () {
69+
const homePage = await login("strict_auth_mechanism", "oauth2:rabbit_prod");
70+
const value = await homePage.getLoginButtonOnClick();
71+
assert.ok(value.includes("rabbit_prod"));
72+
})
73+
it('can force only to authenticate only with basic auth', async function () {
74+
const homePage = await login("strict_auth_mechanism", "basic");
75+
await homePage.isOAuth2SectionNotVisible();
76+
const basicSection = await homePage.isBasicAuthSectionVisible();
77+
assert.ok((await basicSection.getAttribute("class")).includes("section-visible"))
78+
79+
})
80+
6381
after(async function () {
6482
await teardown(this.driver, this, this.captureScreen);
6583
})

selenium/test/pageobjects/SSOHomePage.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ module.exports = class SSOHomePage extends BasePage {
3737
async getLoginButton () {
3838
return this.getText(OAUTH2_LOGIN_BUTTON)
3939
}
40+
async getLoginButtonOnClick () {
41+
const element = await this.waitForDisplayed(OAUTH2_LOGIN_BUTTON);
42+
return element.getAttribute('onClick');
43+
}
4044
async getLogoutButton () {
4145
return this.getText(LOGOUT_BUTTON)
4246
}
@@ -74,6 +78,9 @@ module.exports = class SSOHomePage extends BasePage {
7478
async isOAuth2SectionVisible() {
7579
return this.isDisplayed(SECTION_LOGIN_WITH_OAUTH)
7680
}
81+
async isOAuth2SectionNotVisible() {
82+
return this.isElementNotVisible(SECTION_LOGIN_WITH_OAUTH)
83+
}
7784

7885
async getOAuth2Section() {
7986
return this.waitForDisplayed(SECTION_LOGIN_WITH_OAUTH)

0 commit comments

Comments
 (0)