Ethereal.mail login - Error invalid csrf token

Created on 8 December 2023, 7 months ago

Problem

ATK-CY-1050 fails during login to Ethereal.mail login (https://ethereal.email/login)

Steps to reproduce

- Run ATK-CY-1050 on Chrome

πŸ› Bug report
Status

Active

Version

1.2

Component

Code

Created by

πŸ‡¦πŸ‡ΊAustralia thinkingcap

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @thinkingcap
  • πŸ‡¦πŸ‡ΊAustralia thinkingcap

    I notice that this was being discussed on GitHub: https://github.com/cypress-io/cypress/issues/26398 and added my solution over there: https://github.com/cypress-io/cypress/issues/26398#issuecomment-1847112026

    Copied here for convenience:

    I got this working by intercepting the Set-Cookies header and enforcing SameSite=None; Secure.

        cy.intercept('*', (req) => {
          req.on('response', (res) => {
            const setCookies = res.headers['set-cookie'];
    
            if (setCookies) {
              res.headers['set-cookie'] = (
                Array.isArray(setCookies) ? setCookies : [setCookies]
              )
                .map((cookie) => {
                  // Override or add SameSite=None
                  if (cookie.includes('SameSite')) {
                    cookie = cookie.replace(/SameSite=(Lax|Strict|None)/i, 'SameSite=None');
                  } else {
                    cookie = `${cookie}; SameSite=None`;
                  }
    
                  // Add Secure if not present
                  if (!cookie.includes('Secure')) {
                    cookie = `${cookie}; Secure`;
                  }
    
                  return cookie;
                });
            }
          });
        });
    
        cy.origin('https://ethereal.email', { args: sentArgs }, ({
          userEmail, userPassword, searchSubjectLine,
        }) => {
    .
    .
    .
    
  • πŸ‡ΊπŸ‡ΈUnited States aangel

    Thanks for this. I nudged the folks at Cypress about the issue a couple months back but that didn't help.

    I'll nudge them again and point out your workaround. I'll also point to it on the Known Issues page:

    https://performantlabs.com/automated-testing-kit/known-issues

Production build 0.69.0 2024