From 2b66533a30d801fdfe427d9a9f8fe73dbfbbe4d9 Mon Sep 17 00:00:00 2001 From: Maxime Perrault Date: Wed, 18 Sep 2024 17:39:17 +0200 Subject: [PATCH] fix: test delete test isolation --- frontend/config/cypress.config.ts | 3 ++- frontend/cypress/support/e2e.ts | 17 ++++------------- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/frontend/config/cypress.config.ts b/frontend/config/cypress.config.ts index d60c93173..9a4788c7a 100644 --- a/frontend/config/cypress.config.ts +++ b/frontend/config/cypress.config.ts @@ -17,7 +17,8 @@ export default defineConfig({ initCypressMousePositionPlugin(on) initPlugin(on, config) }, - specPattern: ['cypress/e2e/**/*.spec.ts'] + specPattern: ['cypress/e2e/**/*.spec.ts'], + testIsolation: false }, env: { 'cypress-plugin-snapshots': { diff --git a/frontend/cypress/support/e2e.ts b/frontend/cypress/support/e2e.ts index 93a0ce1b7..8c725db1b 100644 --- a/frontend/cypress/support/e2e.ts +++ b/frontend/cypress/support/e2e.ts @@ -41,21 +41,12 @@ Cypress.on('uncaught:exception', err => { return undefined }) -// Run before spec +// Run before each spec before(() => { // 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') - }, - // https://www.cypress.io/blog/mistake-when-using-cy-session-and-how-to-solve-it - { - validate() { - window.localStorage.getItem('IS_CYPRESS') === 'true' - } - } - ) + cy.session('cypress', () => { + window.localStorage.setItem('IS_CYPRESS', 'true') + }) })