mirror of
https://github.com/0rangebananaspy/authelia.git
synced 2024-09-14 22:47:21 +07:00
54c93fc945
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.
27 lines
1.1 KiB
TypeScript
27 lines
1.1 KiB
TypeScript
import Cucumber = require("cucumber");
|
|
import seleniumWebdriver = require("selenium-webdriver");
|
|
import Assert = require("assert");
|
|
import Fs = require("fs");
|
|
import CustomWorld = require("../support/world");
|
|
|
|
Cucumber.defineSupportCode(function ({ Given, When, Then }) {
|
|
Then("I get a notification of type {stringInDoubleQuotes} with message {stringInDoubleQuotes}",
|
|
{ timeout: 10 * 1000 },
|
|
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), 5000)
|
|
.then(function () {
|
|
return notificationEl.getText();
|
|
})
|
|
.then(function (txt: string) {
|
|
Assert.equal(notificationMessage, txt);
|
|
return notificationEl.getAttribute("class");
|
|
})
|
|
.then(function (classes: string) {
|
|
Assert(classes.indexOf(notificationType) > -1, "Class '" + notificationType + "' not found in notification element.");
|
|
return that.driver.sleep(500);
|
|
});
|
|
});
|
|
|
|
}); |