Skip to content

Commit d252513

Browse files
Do not log NoSuchSessionError
1 parent 86c4726 commit d252513

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

selenium/test/basic-auth/unauthorized.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,8 @@ describe('An user without management tag', function () {
1919
overview = new OverviewPage(driver)
2020
captureScreen = captureScreensFor(driver, __filename)
2121

22-
assert.ok(!await login.isPopupWarningDisplayed())
23-
await login.login('rabbit_no_management', 'rabbit_no_management')
24-
await !overview.isLoaded()
22+
//assert.ok(!await login.isPopupWarningDisplayed())
23+
await login.login('rabbit_no_management', 'guest')
2524
})
2625

2726
it('cannot log in into the management ui', async function () {
@@ -35,7 +34,7 @@ describe('An user without management tag', function () {
3534

3635
it('should get popup warning dialog', async function(){
3736
assert.ok(login.isPopupWarningDisplayed())
38-
assert.equal('Not_Authorized', await login.getPopupWarning())
37+
assert.equal('Not management user', await login.getPopupWarning())
3938
})
4039

4140
describe("After clicking on popup warning dialog button", function() {

selenium/test/pageobjects/BasePage.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const { By, Key, until, Builder, Select } = require('selenium-webdriver')
1+
const { By, Key, until, Builder, Select, WebDriverError, NoSuchSessionError } = require('selenium-webdriver')
22

33
const MENU_TABS = By.css('div#menu ul#tabs')
44
const USER = By.css('li#logout')
@@ -185,7 +185,9 @@ module.exports = class BasePage {
185185
'Timed out after [timeout=' + this.timeout + ';polling=' + this.polling + '] seconds locating ' + locator,
186186
this.polling)
187187
}catch(error) {
188-
console.error("Failed to locate element " + locator)
188+
if (!error.name.includes("NoSuchSessionError")) {
189+
console.error("Failed waitForLocated " + locator + " due to " + error)
190+
}
189191
throw error
190192
}
191193
}
@@ -195,8 +197,10 @@ module.exports = class BasePage {
195197
return this.driver.wait(until.elementIsVisible(element), this.timeout,
196198
'Timed out after [timeout=' + this.timeout + ';polling=' + this.polling + '] awaiting till visible ' + element,
197199
this.polling)
198-
}catch(error) {
199-
console.error("Failed to find visible element " + element)
200+
}catch(error) {
201+
if (!error.name.includes("NoSuchSessionError")) {
202+
console.error("Failed to find visible element " + element + " due to " + error)
203+
}
200204
throw error
201205
}
202206
}
@@ -207,7 +211,9 @@ module.exports = class BasePage {
207211
try {
208212
return this.waitForVisible(await this.waitForLocated(locator))
209213
}catch(error) {
210-
console.error("Failed to waitForDisplayed for locator " + locator)
214+
if (!error.name.includes("NoSuchSessionError")) {
215+
console.error("Failed to waitForDisplayed " + locator + " due to " + error)
216+
}
211217
throw error
212218
}
213219
}

0 commit comments

Comments
 (0)