cypress icon indicating copy to clipboard operation
cypress copied to clipboard

feat(sessions): add option to cache sessions across specs

Open emilyrohrbough opened this issue 2 years ago • 2 comments

  • Closes #17710

User facing changelog

  • A new command option, called cacheAcrossSpecs, was added to the cy.session() to allow users to re-use session data across specs. Addressed #17710.

PR Tasks

  • [x] Have tests been added/updated?
  • [x] Has the original issue (or this PR, if no issue exists) been tagged with a release in ZenHub? (user-facing changes only)
  • [x] Has a PR for user-facing changes been opened in cypress-documentation?
    • https://github.com/cypress-io/cypress-documentation/pull/4746
  • [x] Have API changes been updated in the type definitions?

emilyrohrbough avatar Sep 20 '22 20:09 emilyrohrbough

Thanks for taking the time to open a PR!

cypress-bot[bot] avatar Sep 20 '22 20:09 cypress-bot[bot]



Test summary

40214 0 3358 0Flakiness 1


Run details

Project cypress
Status Passed
Commit 1d472268a8
Started Sep 23, 2022 9:03 PM
Ended Sep 23, 2022 9:18 PM
Duration 15:22 💡
OS Linux Debian - 11.3
Browser Multiple

View run in Cypress Dashboard ➡️


Flakiness

cypress/e2e/next.cy.ts Flakiness
1 Working with next-12.1.6 > should show compilation errors on src changes

This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard

cypress[bot] avatar Sep 21 '22 13:09 cypress[bot]

@emilyrohrbough If I may ask, does this work with test parallelization? this.Cypress.backend('save:session', { ...data, setup: data.setup.toString(), validate: data.validate?.toString() }).catch(console.error) seems to be what is saving the sessions state between states, but I can't find a clear doc on how that interacts with parallelization?

henry-filosa avatar Sep 26 '22 17:09 henry-filosa

@henry-filosa This only persists sessions across specs on the same machine.

emilyrohrbough avatar Sep 26 '22 19:09 emilyrohrbough

@emilyrohrbough Does the option - cacheAcrossSpecs works in npm run mode? It is only working in open mode for me. I am using cypress version - 13.7.1.

@chrisbreiding , @AtofStryker

ishitabb avatar Mar 26 '24 14:03 ishitabb