Skip to content

Commit

Permalink
added try catch to cookie
Browse files Browse the repository at this point in the history
moved engine scripts
  • Loading branch information
Conrad Magnus Kirschner committed Jul 25, 2021
1 parent b921b44 commit 4bcb9b1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
14 changes: 9 additions & 5 deletions backstop_data/engine_scripts/wdio/loadCookies.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,15 @@ module.exports = async (browser, scenario) => {

// SET COOKIES
const setCookies = async () => {
try {
await browser.setCookies(cookies);
} catch (e) {
console.log(e);
}
return Promise.all(
cookies.map(async (cookie) => {
try {
await browser.setCookies(cookie);
} catch (e) {
console.warn(e);
}
})
);
};
await setCookies();
console.log('Cookie state restored with:', JSON.stringify(cookies, null, 2));
Expand Down
1 change: 0 additions & 1 deletion backstop_data/engine_scripts/wdio/onBefore.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
module.exports = async (page, scenario, vp) => {
debugger;
await require('./loadCookies')(page, scenario);
};

0 comments on commit 4bcb9b1

Please sign in to comment.