handsome-dress-30825
07/18/2022, 9:47 AMcy.session
command
I don't explicitly logout the user between tests from the same spec file (I am still using Cypress version 9.7.0) and the login credentials that are passed to the session command are different than the previous ones (I see it in the command logs as well). However the command proceeds to the validate
method to check if the session is valid, even though the user credentials were different. In the validate
method I use expect().to.be.false
type of validations to check if the token is still valid and since we do have a valid token it proceeds to use the previous user instead of logging in with the new one.
Has anyone encountered such an issue and how did you handle it?handsome-dress-30825
07/18/2022, 10:11 AMcy.session
caches the user (with the new username password combination) for the first time, it works, but in the second test when it restores the session data based on the existing cached ID it uses the session data of the previous userhandsome-dress-30825
07/18/2022, 10:36 AMcypress-localstorage-commands
plugin for restoring the local storage data in the validate
method of cy.session
so the session can be correctly validated in our application. I was not passing an argument for a snapshotName
when saving and restoring the local storage data which lead to incorrect data being restored. Adding the snapshotName
value in the restore and save commands resolved this issue