Skip to content

Commit 082609b

Browse files
Code clean up
1 parent 8a661c9 commit 082609b

File tree

12 files changed

+18
-30
lines changed

12 files changed

+18
-30
lines changed

selenium/test/oauth/with-basic-auth-idp-down/landing.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,13 @@ describe('When basic authentication is enabled but UAA is down', function () {
2020
it('should display warning message that UAA is down', async function () {
2121
await homePage.isLoaded()
2222
const message = await homePage.getWarning()
23-
assert.equal(true, message.startsWith('OAuth resource [rabbitmq] not available'))
24-
assert.equal(true, message.endsWith(' not reachable'))
23+
assert.ok(message.startsWith('OAuth resource [rabbitmq] not available'))
24+
assert.ok(message.endsWith(' not reachable'))
2525
})
2626

2727
it('should not be presented oauth2 section', async function () {
2828
await homePage.isLoaded()
29-
if (await homePage.isOAuth2SectionVisible()) {
30-
throw new Error('OAuth2 section should not be present')
31-
}
29+
assert.ok(await homePage.isOAuth2SectionNotVisible())
3230
})
3331

3432
after(async function () {

selenium/test/oauth/with-basic-auth/unauthorized.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ describe('An user without management tag', function () {
2828
})
2929

3030
it('cannot log in into the management ui', async function () {
31-
const visible = await homePage.isWarningVisible()
32-
assert.ok(visible)
31+
assert.ok(await homePage.isWarningVisible())
3332
})
3433

3534
it('should get "Not authorized" warning message', async function(){

selenium/test/oauth/with-idp-down/landing.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ describe('When UAA is down', function () {
2020
it('should display warning message that UAA is down', async function () {
2121
await homePage.isLoaded()
2222
const message = await homePage.getWarning()
23-
assert.equal(true, message.startsWith('OAuth resource [rabbitmq] not available'))
24-
assert.equal(true, message.endsWith(' not reachable'))
23+
assert.ok(message.startsWith('OAuth resource [rabbitmq] not available'))
24+
assert.ok(message.endsWith(' not reachable'))
2525
})
2626

2727
it('should not be presented with a login button to log in', async function () {
2828
await homePage.isLoaded()
29-
assert.equal(false, await homePage.isLoginButtonVisible())
29+
assert.ok(await homePage.isLoginButtonNotVisible())
3030
})
3131

3232
after(async function () {

selenium/test/oauth/with-idp-initiated-via-proxy/happy-login.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@ const OverviewPage = require('../../pageobjects/OverviewPage')
88
describe('A user with a JWT token', function () {
99
let overview
1010
let captureScreen
11-
let token
12-
let fakePortal
13-
11+
1412
before(async function () {
1513
driver = buildDriver()
1614
overview = new OverviewPage(driver)

selenium/test/oauth/with-idp-initiated/landing.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ describe('A user which accesses any protected URL without a session', function (
2121

2222
it('should be presented with a login button to log in', async function () {
2323
await homePage.isLoaded()
24-
const value = await homePage.getLoginButton()
25-
assert.equal(value, 'Click here to log in')
24+
assert.equal(await homePage.getLoginButton(), 'Click here to log in')
2625
})
2726

2827
it('should not have a warning message', async function () {

selenium/test/oauth/with-idp-initiated/token-expires.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ describe('Once user logs in with its own token', function () {
3636

3737
it('user should be presented with a login button to log in', async function () {
3838
await homePage.isLoaded()
39-
const value = await homePage.getLoginButton()
40-
assert.equal(value, 'Click here to log in')
39+
assert.equal(await homePage.getLoginButton(), 'Click here to log in')
4140
})
4241

4342
after(async function () {

selenium/test/oauth/with-idp-initiated/unauthorized.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,10 @@ describe('A user who accesses the /login URL with a token without scopes for the
2424
})
2525

2626
it('should get a warning message', async function () {
27-
const message = await homePage.getWarning()
28-
assert.equal('Not_Authorized', message)
27+
assert.equal(await homePage.getWarning(), 'Not_Authorized')
2928
})
3029
it('should be presented with a login button to log in', async function () {
31-
const value = await homePage.getLoginButton()
32-
assert.equal(value, 'Click here to log in')
30+
assert.equal(await homePage.getLoginButton(), 'Click here to log in')
3331
})
3432

3533
after(async function () {

selenium/test/oauth/with-multi-resources/landing.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ describe('A user which accesses any protected URL without a session', function (
2929
assert.equal("rabbit_x", resources[2].value)
3030
assert.equal("RabbitMQ X_Idp", resources[2].text)
3131

32-
const value = await homePage.getLoginButton()
33-
assert.equal(value, 'Click here to log in')
32+
assert.equal(await homePage.getLoginButton(), 'Click here to log in')
3433
})
3534

3635
it('should not have a warning message', async function () {

selenium/test/oauth/with-sp-initiated/landing.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ describe('A user which accesses any protected URL without a session', function (
1818

1919
it('should be presented with a login button to log in', async function () {
2020
await homePage.isLoaded()
21-
const value = await homePage.getLoginButton()
22-
assert.equal(value, 'Click here to log in')
21+
assert.equal(await homePage.getLoginButton(), 'Click here to log in')
2322
})
2423

2524
it('should not have a warning message', async function () {

selenium/test/oauth/with-sp-initiated/redirection-after-login.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,10 @@ describe('A user which accesses a protected URL without a session', function ()
2626

2727
it('redirect to previous accessed page after login ', async function () {
2828
await homePage.clickToLogin()
29-
3029
await idpLogin.login('rabbit_admin', 'rabbit_admin')
31-
3230
if (!await exchanges.isLoaded()) {
3331
throw new Error('Failed to login')
3432
}
35-
3633
assert.equal("All exchanges (15)", await exchanges.getPagingSectionHeaderText())
3734
})
3835

0 commit comments

Comments
 (0)