Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
debug("nockHtmlPages");
var file = path.resolve(__dirname, "NockedPages", "NockedPages.json");
var nocks = JSON.parse(fs.readFileSync(file));
for (let site in nocks) {
for (let page in nocks[site]) {
nock(site)
.get(page)
.replyWithFile(200, path.resolve(__dirname, "NockedPages", nocks[site][page]));
}
}
};
exports.nockHtmlPagesClear = function nockHtmlPagesClear() {
nock.cleanAll();
};
Browser.prototype.keyUp = function(targetSelector, keyCode) {
let event = this.window.document.createEvent("HTMLEvents");
event.initEvent("keyup", true, true);
event.which = keyCode;
let target = this.window.document.querySelector(targetSelector);
if (target) target.dispatchEvent(event);
};
Browser.Assert.prototype.expectHtmlSync = function expectHtmlSync(errorList, givenPath, name) {
let stopOnError = false;
if (!Array.isArray(errorList)) {
stopOnError = true;
name = givenPath;
givenPath = errorList;
errorList = undefined;
}
let expected = "not read yet";