nutritious-megabyte-64190
09/22/2022, 7:15 PMcy.getCookies({ log: true }).then(cookies => {
const cookieNames = cookies.map(c => c.name);
// 'cookie1','cookie2','cookie3','cookie4'
console.log(cookieNames.map(s => `'${s}'`).join(','));
//this doesnt work
cy.preserveCookieOnce(cookieNames.map(s => `'${s}'`).join(','));
the error i get is
Command: preserveCookieOnce
index.0fb50328.js:99244 Error:
Error: Expected the cookie name to preserve
at eval (webpack:///./node_modules/cypress-v10-preserve-cookie/src/index.js:10:0)
//this does work with no issues
cy.preserveCookieOnce(
'cookie1',
'cookie2',
'cookie3',
'cookie4'
);