diff --git a/test/issues/1624.test.js b/test/issues/1624.test.js index 155f75c..429c6f9 100644 --- a/test/issues/1624.test.js +++ b/test/issues/1624.test.js @@ -1,6 +1,6 @@ const {initializeWithTab} = require("../common"); -describe("Delete multiple Containers", function () { +describe("Remove multiple Containers", function () { beforeEach(async function () { this.webExt = await initializeWithTab(); }); @@ -9,7 +9,7 @@ describe("Delete multiple Containers", function () { this.webExt.destroy(); }); - describe("creating a new container", function () { + describe("creating three new containers", function () { beforeEach(async function () { for (let i = 0; i < 3; i++) { await this.webExt.popup.helper.clickElementById("container-add-link"); @@ -17,7 +17,7 @@ describe("Delete multiple Containers", function () { } }); - it("should create it in the browser as well", function () { + it("should create these in the browser as well", function () { this.webExt.background.browser.contextualIdentities.create.should.have.been.calledThrice; }); @@ -27,9 +27,25 @@ describe("Delete multiple Containers", function () { await this.webExt.popup.helper.clickElementByQuerySelectorAll(".select-container", "last"); await this.webExt.popup.helper.clickElementById("delete-link"); await this.webExt.popup.helper.clickElementById("delete-container-ok-link"); + }); + it("should remove it in the browser as well", function () { + this.webExt.background.browser.contextualIdentities.remove.should.have.been.calledWith("firefox-container-7"); + }); + }); + + describe("manually select one container and delete by backspace key", function () { + beforeEach(async function () { + await this.webExt.popup.helper.clickElementById("edit-containers-link"); await this.webExt.popup.helper.clickElementByQuerySelectorAll(".select-container", "last"); + const backspaceKey = 6; + const event = new this.webExt.popup.window.KeyboardEvent("keydown",{"keyCode": backspaceKey}); + this.webExt.popup.window.document.dispatchEvent(event); + + await this.webExt.popup.helper.clickElementById("delete-container-ok-link"); + + }); it("should remove it in the browser as well", function () { @@ -37,7 +53,26 @@ describe("Delete multiple Containers", function () { }); }); - describe("manually click select multiple contaienr and delete by delete button", function () { + describe("manually select one container and delete by delete key", function () { + beforeEach(async function () { + await this.webExt.popup.helper.clickElementById("edit-containers-link"); + await this.webExt.popup.helper.clickElementByQuerySelectorAll(".select-container", "last"); + + const deleteKey = 46; + const event = new this.webExt.popup.window.KeyboardEvent("keydown",{"keyCode": deleteKey}); + this.webExt.popup.window.document.dispatchEvent(event); + + await this.webExt.popup.helper.clickElementById("delete-container-ok-link"); + + + }); + + it("should remove it in the browser as well", function () { + this.webExt.background.browser.contextualIdentities.remove.should.have.been.calledWith("firefox-container-7"); + }); + }); + + describe("manually click select two containers and delete by delete button", function () { beforeEach(async function () { await this.webExt.popup.helper.clickElementById("edit-containers-link"); @@ -50,9 +85,52 @@ describe("Delete multiple Containers", function () { }); - it("should remove it in the browser as well", function () { + it("should remove it in the browser twice as well", function () { this.webExt.background.browser.contextualIdentities.remove.should.have.been.calledTwice; }); + + it("should remove the container # 7 as well", function () { + this.webExt.background.browser.contextualIdentities.remove.should.have.been.calledWith("firefox-container-7"); + }); + + it("should remove the container # 6 as well", function () { + this.webExt.background.browser.contextualIdentities.remove.should.have.been.calledWith("firefox-container-6"); + }); + }); + + describe("manually shift click select multiple containers and delete by delete button", function () { + beforeEach(async function () { + await this.webExt.popup.helper.clickElementById("edit-containers-link"); + + const nodeArray = Array.from(this.webExt.popup.window.document.querySelectorAll(".select-container")); + nodeArray[4].click(); + + const shiftKey = 16; + const event = new this.webExt.popup.window.KeyboardEvent("keydown",{"keyCode": shiftKey}); + this.webExt.popup.window.document.dispatchEvent(event); + + nodeArray[6].click(); + + await this.webExt.popup.helper.clickElementById("delete-link"); + await this.webExt.popup.helper.clickElementById("delete-container-ok-link"); + + }); + + it("should remove these three containers in the browser as well", function () { + this.webExt.background.browser.contextualIdentities.remove.should.have.been.calledThrice; + }); + + it("should remove the container # 5 as well", function () { + this.webExt.background.browser.contextualIdentities.remove.should.have.been.calledWith("firefox-container-5"); + }); + + it("should remove the container # 6 as well", function () { + this.webExt.background.browser.contextualIdentities.remove.should.have.been.calledWith("firefox-container-6"); + }); + + it("should remove the container # 7 as well", function () { + this.webExt.background.browser.contextualIdentities.remove.should.have.been.calledWith("firefox-container-7"); + }); }); }); }); \ No newline at end of file