How to handle preserving cookies between tests when cookies are changed during test and old cookies are obsoleted on web app with jwt in-memore storing #25064
Unanswered
VolodymyrLykhachov
asked this question in
Questions and Help
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
web application under test uses in-memory stored JWT access token and cookies stored refresh token. So on page refresh or direct opening page URL, application go to backend and use refresh token from cookies to generate new access token and store it in memory and also generate new refresh token and store it in cookies. Old access and refresh token are obsoleted after this. In my tests I use cy.visit to directly open some pages from web app.
And I want to login only before spec and not before each test in this spec.
I use Cypress.Cookies.preserveOnce to do this before version 12.x. But now Cypress force users to use cy.session to store session.
I tried to use cy.session but I can't find a solution what I need to store in this session to not login before each test. On second test in spec this session is outdated and I can't use it anymore cause it contains cookies that are obsoleted and these cookies are changed during first test in spec. Also I can't modify session between tests in spec.
What I need to use to not login before each test to handle session that is modifying during test runs after Cypress version 12?
Beta Was this translation helpful? Give feedback.
All reactions