2018-03-28 22:04:59 +00:00
|
|
|
import {Then} from "cucumber";
|
2017-10-14 13:04:43 +00:00
|
|
|
import seleniumWebdriver = require("selenium-webdriver");
|
|
|
|
import CustomWorld = require("../support/world");
|
|
|
|
import Util = require("util");
|
2018-08-19 11:07:00 +00:00
|
|
|
import Bluebird = require("bluebird");
|
|
|
|
import Request = require("request-promise");
|
2017-10-14 13:04:43 +00:00
|
|
|
|
2018-03-28 22:04:59 +00:00
|
|
|
Then("I see header {string} set to {string}",
|
|
|
|
{ timeout: 5000 },
|
|
|
|
function (expectedHeaderName: string, expectedValue: string) {
|
|
|
|
return this.driver.findElement(seleniumWebdriver.By.tagName("body")).getText()
|
|
|
|
.then(function (txt: string) {
|
|
|
|
const expectedLine = Util.format("\"%s\": \"%s\"", expectedHeaderName, expectedValue);
|
|
|
|
if (txt.indexOf(expectedLine) > 0)
|
2018-08-19 11:07:00 +00:00
|
|
|
return Bluebird.resolve();
|
2018-03-28 22:04:59 +00:00
|
|
|
else
|
2018-08-19 11:07:00 +00:00
|
|
|
return Bluebird.reject(new Error(Util.format("No such header or with unexpected value.")));
|
2018-03-28 22:04:59 +00:00
|
|
|
});
|
2018-08-19 11:07:00 +00:00
|
|
|
})
|