2017-07-26 21:45:26 +00:00
|
|
|
import Cucumber = require("cucumber");
|
|
|
|
import seleniumWebdriver = require("selenium-webdriver");
|
|
|
|
import Assert = require("assert");
|
|
|
|
import Fs = require("fs");
|
|
|
|
|
|
|
|
Cucumber.defineSupportCode(function ({ Given, When, Then }) {
|
|
|
|
When("I click on the link {stringInDoubleQuotes}", function (text: string) {
|
|
|
|
return this.driver.findElement(seleniumWebdriver.By.linkText(text)).click();
|
|
|
|
});
|
|
|
|
|
|
|
|
When("I click on the link of the email", function () {
|
2017-09-02 23:25:43 +00:00
|
|
|
const notif = Fs.readFileSync("/tmp/notifications/notification.txt").toString();
|
2017-07-26 21:45:26 +00:00
|
|
|
const regexp = new RegExp(/Link: (.+)/);
|
|
|
|
const match = regexp.exec(notif);
|
|
|
|
const link = match[1];
|
|
|
|
const that = this;
|
|
|
|
|
|
|
|
return this.driver.get(link);
|
|
|
|
});
|
|
|
|
});
|