Search code examples
google-chromesession-cookiescypress

Cypress.io on Chrome with "SameSite by default cookies" issue


We're running Cypress.io locally via http:// using Chrome, and when "SameSite by default cookies" is on (which they are starting to roll out to all users), our login tests fail because the session cookie cannot be set (is blocked because the connection is not secure). Any suggestions on a workaround? I looked into setting a Chrome flag as per:

https://docs.cypress.io/api/plugins/browser-launch-api.html#Examples

with flag:

https://peter.sh/experiments/chromium-command-line-switches/#unsafely-treat-insecure-origin-as-secure

but couldn't find an appropriate flag. Thanks.


Solution

  • I ended up fixing this by simply changing the session cookie's samesite attribute for my local/test environment from none, which requires secure, to lax. Hope this helps someone else!