You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#1590 added the behavior to TestCafe to automatically clear LocalStorage and SessionStorage in between test runs.
What is the desired behavior?
Provide a configuration point to disable this behavior.
Use Case
The application under test that I'm supporting stores its authentication token and related user data in SessionStorage. Clearing the session storage between each test run is causing us to have to re-run the login scenario in the beforeEach function for all of our fixtures.
We've wrapped the login behavior in a PageObject so it's not too invasive, but it makes the test runs longer than they need to be. Is there a recommended way to handle this scenario? I tried to implement the same concept using the documented Role function but ran into the same issue - with cleared SessionStorage forcing the application to redirect to the login screen.
The text was updated successfully, but these errors were encountered:
Yesterday I had hacked together a couple of ClientFunctions to persist the state between tests and tenuously got things working.
Oddly enough, after reading through #2142 it looks like the preserveUrl option is the secret sauce that ended up working for my use case. It looks like in addition to preserving the URL that was redirected to after login, it also preserves sessionStorage, which is exactly the behavior I was expecting!
This thread has been automatically locked since it is closed and there has not been any recent activity. Please open a new issue for related bugs or feature requests. We recommend you ask TestCafe API, usage and configuration inquiries on StackOverflow.
Are you requesting a feature or reporting a bug?
A feature.
What is the current behavior?
#1590 added the behavior to TestCafe to automatically clear LocalStorage and SessionStorage in between test runs.
What is the desired behavior?
Provide a configuration point to disable this behavior.
Use Case
The application under test that I'm supporting stores its authentication token and related user data in SessionStorage. Clearing the session storage between each test run is causing us to have to re-run the login scenario in the
beforeEach
function for all of our fixtures.We've wrapped the login behavior in a PageObject so it's not too invasive, but it makes the test runs longer than they need to be. Is there a recommended way to handle this scenario? I tried to implement the same concept using the documented Role function but ran into the same issue - with cleared SessionStorage forcing the application to redirect to the login screen.
The text was updated successfully, but these errors were encountered: