Refactor tests to not rely on globals
This commit is contained in:
@@ -1,27 +1,33 @@
|
||||
describe("Containers Management", () => {
|
||||
beforeEach(async () => {
|
||||
await helper.browser.initializeWithTab();
|
||||
const {initializeWithTab} = require("../common");
|
||||
|
||||
describe("Containers Management", function () {
|
||||
beforeEach(async function () {
|
||||
this.webExt = await initializeWithTab();
|
||||
});
|
||||
|
||||
describe("creating a new container", () => {
|
||||
beforeEach(async () => {
|
||||
await helper.popup.clickElementById("container-add-link");
|
||||
await helper.popup.clickElementById("edit-container-ok-link");
|
||||
afterEach(function () {
|
||||
this.webExt.destroy();
|
||||
});
|
||||
|
||||
describe("creating a new container", function () {
|
||||
beforeEach(async function () {
|
||||
await this.webExt.popup.helper.clickElementById("container-add-link");
|
||||
await this.webExt.popup.helper.clickElementById("edit-container-ok-link");
|
||||
});
|
||||
|
||||
it("should create it in the browser as well", () => {
|
||||
background.browser.contextualIdentities.create.should.have.been.calledOnce;
|
||||
it("should create it in the browser as well", function () {
|
||||
this.webExt.background.browser.contextualIdentities.create.should.have.been.calledOnce;
|
||||
});
|
||||
|
||||
describe("removing it afterwards", () => {
|
||||
beforeEach(async () => {
|
||||
await helper.popup.clickElementById("edit-containers-link");
|
||||
await helper.popup.clickLastMatchingElementByQuerySelector(".delete-container-icon");
|
||||
await helper.popup.clickElementById("delete-container-ok-link");
|
||||
describe("removing it afterwards", function () {
|
||||
beforeEach(async function () {
|
||||
await this.webExt.popup.helper.clickElementById("edit-containers-link");
|
||||
await this.webExt.popup.helper.clickElementByQuerySelectorAll(".delete-container-icon", "last");
|
||||
await this.webExt.popup.helper.clickElementById("delete-container-ok-link");
|
||||
});
|
||||
|
||||
it("should remove it in the browser as well", () => {
|
||||
background.browser.contextualIdentities.remove.should.have.been.calledOnce;
|
||||
it("should remove it in the browser as well", function () {
|
||||
this.webExt.background.browser.contextualIdentities.remove.should.have.been.calledOnce;
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user