working on the never-ask test
This commit is contained in:
parent
088b12fadd
commit
ec2cabe613
2 changed files with 12 additions and 5 deletions
|
@ -72,9 +72,12 @@ const buildPopupDom = popup => {
|
||||||
|
|
||||||
const buildConfirmPage = async (url) => {
|
const buildConfirmPage = async (url) => {
|
||||||
console.log(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;
|
return webExtension;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -89,9 +89,13 @@ describe("Assignment Comfirm Page Feature", function () {
|
||||||
describe("Set assignment to 'never ask' ", function () {
|
describe("Set assignment to 'never ask' ", function () {
|
||||||
beforeEach(async function () {
|
beforeEach(async function () {
|
||||||
// click confirm page to always open in container
|
// click confirm page to always open in container
|
||||||
const confirmPage = await buildConfirmPage("src/confirm-page.html?" +
|
const confirmPage = await buildConfirmPage("moz-extension://fake/confirm-page.html?" +
|
||||||
`url=${encodeURIComponent(url)}` +
|
`url=${encodeURIComponent(url)}` +
|
||||||
`&cookieStoreId=${this.webExt.tab.cookieStoreId}`);
|
`&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("never-ask").click();
|
||||||
await confirmPage.document.getElementById("confirm").click();
|
await confirmPage.document.getElementById("confirm").click();
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Reference in a new issue