diff --git a/frontend/cypress/support/e2e.ts b/frontend/cypress/support/e2e.ts index d6c511b71..341f71dd0 100644 --- a/frontend/cypress/support/e2e.ts +++ b/frontend/cypress/support/e2e.ts @@ -46,7 +46,16 @@ beforeEach(() => { // We use a Cypress session to inject inject a Local Storage key // so that we can detect when the browser app is running in Cypress. // https://docs.cypress.io/faq/questions/using-cypress-faq#How-do-I-preserve-cookies--localStorage-in-between-my-tests - cy.session('cypress', () => { - window.localStorage.setItem('IS_CYPRESS', 'true') - }) + cy.session( + 'cypress', + () => { + window.localStorage.setItem('IS_CYPRESS', 'true') + }, + // https://www.cypress.io/blog/mistake-when-using-cy-session-and-how-to-solve-it + { + validate() { + window.localStorage.getItem('IS_CYPRESS') === 'true' + } + } + ) })