Skip to content

Commit

Permalink
fix: test delete test isolation
Browse files Browse the repository at this point in the history
  • Loading branch information
maximeperrault committed Sep 18, 2024
1 parent 9f91022 commit 2b66533
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
3 changes: 2 additions & 1 deletion frontend/config/cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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': {
Expand Down
17 changes: 4 additions & 13 deletions frontend/cypress/support/e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')
})
})

0 comments on commit 2b66533

Please sign in to comment.