working with tests
This commit is contained in:
+36
-1
@@ -19,6 +19,7 @@ module.exports = {
|
||||
"achievements": []
|
||||
});
|
||||
window.browser.storage.local.set.resetHistory();
|
||||
window.browser.storage.sync.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -29,7 +30,41 @@ module.exports = {
|
||||
|
||||
async openNewTab(tab, options = {}) {
|
||||
return background.browser.tabs._create(tab, options);
|
||||
}
|
||||
},
|
||||
|
||||
async initSyncTest(details = {}) {
|
||||
if (!details.cookieStoreId) details.cookieStoreId = "firefox-default";
|
||||
if (!details.localStorage) {
|
||||
details.localStorage = {
|
||||
"browserActionBadgesClicked": [],
|
||||
"onboarding-stage": 5,
|
||||
"achievements": []
|
||||
};
|
||||
}
|
||||
if (!details.syncStorage) details.syncStorage = {};
|
||||
let tab;
|
||||
await buildDom({
|
||||
background: {
|
||||
async afterBuild(background) {
|
||||
tab = await background.browser.tabs._create({ cookieStoreId: details.cookieStoreId });
|
||||
}
|
||||
},
|
||||
popup: {
|
||||
jsdom: {
|
||||
beforeParse(window) {
|
||||
window.browser.storage.clear();
|
||||
window.browser.storage.local.set(details.localStorage);
|
||||
window.browser.storage.local.set.resetHistory();
|
||||
window.browser.storage.sync.clear();
|
||||
window.browser.storage.sync.set(details.syncStorage);
|
||||
window.browser.storage.sync.set.resetHistory();
|
||||
}
|
||||
},
|
||||
}
|
||||
});
|
||||
|
||||
return tab;
|
||||
},
|
||||
},
|
||||
|
||||
popup: {
|
||||
|
||||
Reference in New Issue
Block a user