Skip to content

Commit 185e952

Browse files
michaelklishinmergify[bot]
authored andcommitted
Selenium suites: cosmetics, wording, ws
(cherry picked from commit e65dbfd)
1 parent fb97bb2 commit 185e952

3 files changed

Lines changed: 14 additions & 17 deletions

File tree

selenium/test/basic-auth/session-expired-with-no-refresh.js

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,31 +6,30 @@ const { buildDriver, goToHome, captureScreensFor, teardown, delay } = require('.
66
const LoginPage = require('../pageobjects/LoginPage')
77
const OverviewPage = require('../pageobjects/OverviewPage')
88

9-
describe('Once user is logged in and not refresh is configured', function () {
9+
describe('Once user is logged in and no refresh is configured', function () {
1010
let driver
11+
let login
1112
let overview
1213
let captureScreen
13-
this.timeout(65000) // hard-coded to 25secs because this test requires 35sec to run
14+
this.timeout(65000)
1415

1516
before(async function () {
1617
driver = buildDriver()
1718
await goToHome(driver)
1819
login = new LoginPage(driver)
1920
overview = new OverviewPage(driver)
20-
captureScreen = captureScreensFor(driver, __filename)
21+
captureScreen = captureScreensFor(driver, __filename)
2122
await login.login('guest', 'guest')
22-
await overview.isLoaded()
23+
await overview.isLoaded()
2324
await overview.selectRefreshOption("Do not refresh")
24-
await overview.ensureTotalsSectionIsInvisible() // trigger a preference stored in cookie
25-
// which should honor login timeout
25+
// Trigger a preference stored in cookie, which should honor login timeout.
26+
await overview.ensureTotalsSectionIsInvisible()
2627
})
2728

2829
it('any authorized request after the session has expired should log the user out', async function () {
29-
3030
await delay(60000)
3131
await overview.clickOnConnectionsTab()
32-
await login.isLoaded()
33-
32+
await login.isLoaded()
3433
})
3534

3635
after(async function () {

selenium/test/basic-auth/session-expired.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,14 @@ describe('Once user is logged in', function () {
1919
overview = new OverviewPage(driver)
2020
captureScreen = captureScreensFor(driver, __filename)
2121
await login.login('guest', 'guest')
22-
await overview.isLoaded()
23-
await overview.ensureTotalsSectionIsInvisible() // trigger a preference stored in cookie
24-
// which should honor login timeout
25-
22+
await overview.isLoaded()
23+
// Trigger a preference stored in cookie, which should honor login timeout.
24+
await overview.ensureTotalsSectionIsInvisible()
2625
})
2726

2827
it('it has to login after the session expires', async function () {
29-
3028
await delay(60000)
31-
await login.isLoaded()
29+
await login.isLoaded()
3230
await login.login('guest', 'guest')
3331
await overview.isLoaded()
3432
await overview.clickOnConnectionsTab() // and we can still interact with the ui

selenium/test/pageobjects/BasePage.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ module.exports = class BasePage {
3333
this.polling = parseInt(process.env.SELENIUM_POLLING) || 500 // how frequent selenium searches for an element
3434
this.interactionDelay = parseInt(process.env.SELENIUM_INTERACTION_DELAY) || 0 // slow down interactions (when rabbit is behind a http proxy)
3535
}
36-
36+
3737
async ensureSectionIsVisible(section) {
3838
let classes = await this.driver.findElement(section).getAttribute("class")
3939
if (classes.search('section-visible') < 0) {
@@ -42,12 +42,12 @@ module.exports = class BasePage {
4242
return Promise.resolve(true)
4343
}
4444
}
45+
4546
async ensureSectionIsInvisible(section) {
4647
let classes = await this.driver.findElement(section).getAttribute("class")
4748
if (classes.search('section-invisible') < 0) {
4849
return this.click(By.css(section.value + ' h2'))
4950
} else {
50-
5151
return Promise.resolve(true)
5252
}
5353
}

0 commit comments

Comments
 (0)