Reload existing active session
See original GitHub issueWhat would you like?
After using function cy.session([value, value]), Cypress will fail to load an existing active session.
For my current setup I am running this in an after()
block, but the same will happen even if added inside a test.
If I print cy.state(‘activeSessions’) the required session will be printed and is hydrated: true
.
This will work if there is only 1 test being ran, but if there are multiple tests, it will error out with the below message.
No session is defined with the name
["value","value"]
In order to use cy.session(), provide a setup as the second argument:
cy.session(id, setup)
Why is this needed?
I need to access an existing session without being required to reproduce the entire login session again (session id, setup and validation), in order to avoid the possibility of creating a new session for the same details.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:7 (5 by maintainers)
Top Results From Across the Web
Reload previously active sessions - UltraEdit
To enable the "Reload session previously open on startup", go to Options : Configuration : Sesssions. Click to enable the "Reload session previously...
Read more >How to Reload or Change your current Shell? - Linux
Learn the basic steps to reload your Linux shell to apply your recent configurations changes. This post cover the POSIX exec builtin command...
Read more >How do I reload a module in an active Julia session after an ...
If I close the current Julia session, start a new one, and type in using ctbTestModule , I now get the desired behaviour,...
Read more >Reload a Linux user's group assignments without logging out
You can use the following command to send the command to all an existing Screen sessions: screen -S <session_name> -X at \# stuff...
Read more >What effects does restarting sshd have on existing ssh ...
Existing sessions will remain active, using the pre-restart config. All new sessions will use the new config.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I will say, if you are trying to determine if an ID has already been used to save a session, you can leverage
Cypress.session.getActiveSession('ID')
, but I still suggest moving this logic into your login logic.@alexniculae Session is closely tied to the concept of Test Isolation. There will be two modes of test isolation,
on
andoff
, withon
being the new default mode. When test isolation ison
, before each test, Cypress will:about:blank
When the browser context is cleared, it should behave as a “logout” on the client side. We do perform this before each test to enable easier debugging if an error goes wrong.
Is your setup & validate logic saving the session data before it’s ready to be saved and that is why you are trying to collect the remaining session data at the end of the test?