mirror of
https://github.com/0rangebananaspy/authelia.git
synced 2024-09-14 22:47:21 +07:00
Fix randomness with integration tests
The notification message pops up and hide after few seconds. Sometimes, chrome drivers tries to click on a button that moves due to the notification message animation and thus miss it.
This commit is contained in:
parent
267cf2921d
commit
54c93fc945
|
@ -8,6 +8,7 @@ Feature: User is correctly redirected
|
|||
Scenario: User is redirected to home page after several authentication tries
|
||||
When I visit "https://public.test.local:8080/secret.html"
|
||||
And I login with user "john" and password "badpassword"
|
||||
And I wait for notification to disappear
|
||||
And I clear field "username"
|
||||
And I login with user "john" and password "password"
|
||||
And I use "REGISTERED" as TOTP token handle
|
||||
|
|
|
@ -11,6 +11,15 @@ Cucumber.defineSupportCode(function ({ Given, When, Then }) {
|
|||
return this.visit(link);
|
||||
});
|
||||
|
||||
When("I wait for notification to disappear", function() {
|
||||
const that = this;
|
||||
const notificationEl = this.driver.findElement(seleniumWebdriver.By.className("notification"));
|
||||
return this.driver.wait(seleniumWebdriver.until.elementIsVisible(notificationEl), 15000)
|
||||
.then(function() {
|
||||
return that.driver.wait(seleniumWebdriver.until.elementIsNotVisible(notificationEl), 15000);
|
||||
})
|
||||
})
|
||||
|
||||
When("I set field {stringInDoubleQuotes} to {stringInDoubleQuotes}", function (fieldName: string, content: string) {
|
||||
return this.setFieldTo(fieldName, content);
|
||||
});
|
||||
|
|
|
@ -10,7 +10,7 @@ Cucumber.defineSupportCode(function ({ Given, When, Then }) {
|
|||
function (notificationType: string, notificationMessage: string) {
|
||||
const that = this;
|
||||
const notificationEl = this.driver.findElement(seleniumWebdriver.By.className("notification"));
|
||||
return this.driver.wait(seleniumWebdriver.until.elementIsVisible(notificationEl), 2000)
|
||||
return this.driver.wait(seleniumWebdriver.until.elementIsVisible(notificationEl), 5000)
|
||||
.then(function () {
|
||||
return notificationEl.getText();
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue
Block a user