Skip to content

Commit

Permalink
Fixing stale tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kurahaupo committed Aug 30, 2021
1 parent 5cc5d91 commit 0505b95
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 9 deletions.
72 changes: 65 additions & 7 deletions test/features/containers.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,85 @@ describe("Containers Management", function () {
});

describe("creating a new container", function () {
const testContainerName = "This Is A Test Container";
beforeEach(async function () {
await this.webExt.popup.helper.clickElementById("manage-containers-link");
await this.webExt.popup.helper.clickElementById("new-container");
this.webExt.popup.window.document.getElementById("edit-container-panel-name-input").value = testContainerName;
await this.webExt.popup.helper.clickElementById("create-container-ok-link");
});

it("should create it in the browser as well", function () {
this.webExt.background.browser.contextualIdentities.create.should.have.been.calledOnce;
});

describe("removing it afterwards", function () {
describe("manually assign a valid URL to a container", function () {
const exampleUrl = "https://github.com/mozilla/multi-account-containers";
beforeEach(async function () {
await this.webExt.popup.helper.clickElementById("manage-containers-link");
await this.webExt.popup.helper.clickElementByQuerySelectorAll("#picker-identities-list > .menu-item", "last");
await this.webExt.popup.helper.clickElementById("delete-container-button");
await this.webExt.popup.helper.clickElementById("delete-container-ok-link");
await this.webExt.popup.helper.clickElementByQuerySelectorAll(".edit-container-icon", "last");
this.webExt.popup.window.document.getElementById("edit-container-panel-site-input").value = exampleUrl;
await this.webExt.popup.helper.clickElementById("edit-container-site-link");
});

it("should remove it in the browser as well", function () {
this.webExt.background.browser.contextualIdentities.remove.should.have.been.calledOnce;
it("should assign the URL to a container", function () {
this.webExt.background.browser.contextualIdentities.update.should.have.been.calledOnce;
});

describe("manually assign valid URL without protocol to a container", function () {
const exampleUrl = "github.com/mozilla/multi-account-containers";
beforeEach(async function () {
await this.webExt.popup.helper.clickElementById("manage-containers-link");
await this.webExt.popup.helper.clickElementByQuerySelectorAll(".edit-container-icon", "last");
this.webExt.popup.window.document.getElementById("edit-container-panel-site-input").value = exampleUrl;
await this.webExt.popup.helper.clickElementById("edit-container-site-link");
});

it("should assign the URL without protocol to a container", function () {
this.webExt.background.browser.contextualIdentities.update.should.have.been.calledOnce;
});

describe("manually assign an invalid URL to a container", function () {
const exampleUrl = "github";
beforeEach(async function () {
await this.webExt.popup.helper.clickElementById("manage-containers-link");
await this.webExt.popup.helper.clickElementByQuerySelectorAll(".edit-container-icon", "last");
this.webExt.popup.window.document.getElementById("edit-container-panel-site-input").value = exampleUrl;
await this.webExt.popup.helper.clickElementById("edit-container-site-link");
});

it("should not assign the URL to a container", function () {
this.webExt.background.browser.contextualIdentities.update.should.not.have.been.called;
});

describe("manually assign empty URL to a container", function () {
const exampleUrl = "";
beforeEach(async function () {
await this.webExt.popup.helper.clickElementById("manage-containers-link");
await this.webExt.popup.helper.clickElementByQuerySelectorAll(".edit-container-icon", "last");
this.webExt.popup.window.document.getElementById("edit-container-panel-site-input").value = exampleUrl;
await this.webExt.popup.helper.clickElementById("edit-container-site-link");
});

it("should not assign the URL to a container", function () {
this.webExt.background.browser.contextualIdentities.update.should.not.have.been.called;
});

describe("removing it afterwards", function () {
beforeEach(async function () {
await this.webExt.popup.helper.clickElementById("manage-containers-link");
await this.webExt.popup.helper.clickElementByQuerySelectorAll("#picker-identities-list > .menu-item", "last");
await this.webExt.popup.helper.clickElementById("delete-container-button");
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.calledOnce;
});
});
});
});
});
});
});
});
});
4 changes: 2 additions & 2 deletions test/issues/1670.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe("#1670", function () {

describe("creating a new container", function () {
beforeEach(async function () {
await this.webExt.popup.helper.clickElementById("container-add-link");
await this.webExt.popup.helper.clickElementById("manage-containers-link");
await this.webExt.popup.helper.clickElementById("edit-container-ok-link");
});

Expand Down Expand Up @@ -75,4 +75,4 @@ describe("#1670", function () {
});
});
});
});
});

0 comments on commit 0505b95

Please sign in to comment.