working on the never-ask test

This commit is contained in:
Kendall Werts 2020-02-26 10:56:41 -06:00
parent 088b12fadd
commit ec2cabe613
2 changed files with 12 additions and 5 deletions

View file

@ -72,9 +72,12 @@ const buildPopupDom = popup => {
const buildConfirmPage = async (url) => {
console.log(url)
const webExtension = await webExtensionsJSDOM.fromFile(url);
const webExtension = await webExtensionsJSDOM
.fromFile(path.join(__dirname, "../src/confirm-page.html"), {
apiFake: true,
jsdom: {url}
});
webExtension.browser.runtime.onMessage = window.browser.runtime.sendMessage;
return webExtension;
};

View file

@ -89,9 +89,13 @@ describe("Assignment Comfirm Page Feature", function () {
describe("Set assignment to 'never ask' ", function () {
beforeEach(async function () {
// click confirm page to always open in container
const confirmPage = await buildConfirmPage("src/confirm-page.html?" +
`url=${encodeURIComponent(url)}` +
`&cookieStoreId=${this.webExt.tab.cookieStoreId}`);
const confirmPage = await buildConfirmPage("moz-extension://fake/confirm-page.html?" +
`url=${encodeURIComponent(url)}` +
`&cookieStoreId=${this.webExt.tab.cookieStoreId}`);
confirmPage.browser.runtime.sendMessage.callsFake((...args) => {
this.webExt.browser.runtime.onMessage.addListener.yield(...args);
});
await confirmPage.document.getElementById("never-ask").click();
await confirmPage.document.getElementById("confirm").click();
});