working with tests

This commit is contained in:
Kendall Werts
2020-01-07 14:14:19 -06:00
parent d033292784
commit f7b20f97b8
5 changed files with 107 additions and 44 deletions
+36 -1
View File
@@ -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: {