Refactor tests to not rely on globals

This commit is contained in:
stoically
2020-01-24 08:16:15 +01:00
parent 53baee1d5c
commit 405e605ba3
10 changed files with 213 additions and 311 deletions
+16 -12
View File
@@ -1,16 +1,19 @@
describe("#1168", () => {
describe("when navigation happens too slow after opening new tab to a page which then redirects", () => {
let clock, tab;
const {expect, sinon, initializeWithTab} = require("../common");
beforeEach(async () => {
await helper.browser.initializeWithTab({
describe("#1168", function () {
describe("when navigation happens too slow after opening new tab to a page which then redirects", function () {
let clock, tab, background;
beforeEach(async function () {
this.webExt = await initializeWithTab({
cookieStoreId: "firefox-container-1",
url: "https://bugzilla.mozilla.org"
});
await helper.popup.clickElementById("container-page-assigned");
await this.webExt.popup.helper.clickElementById("container-page-assigned");
clock = sinon.useFakeTimers();
tab = await helper.browser.openNewTab({});
tab = await this.webExt.browser.tabs._create({});
clock.tick(2000);
@@ -20,15 +23,16 @@ describe("#1168", () => {
]);
});
afterEach(function () {
this.webExt.destroy();
clock.restore();
});
// Not solved yet
// See: https://github.com/mozilla/multi-account-containers/issues/1168#issuecomment-378394091
it.skip("should remove the old tab", async () => {
it.skip("should remove the old tab", async function () {
expect(background.browser.tabs.create).to.have.been.calledOnce;
expect(background.browser.tabs.remove).to.have.been.calledWith(tab.id);
});
afterEach(() => {
clock.restore();
});
});
});