Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

experimentalSessionSupport breaks shareAcrossSpecs #36

Closed
IanVS opened this issue Dec 15, 2021 · 10 comments · Fixed by #38
Closed

experimentalSessionSupport breaks shareAcrossSpecs #36

IanVS opened this issue Dec 15, 2021 · 10 comments · Fixed by #38

Comments

@IanVS
Copy link

IanVS commented Dec 15, 2021

It took me a long time of scratching my head to realize that my specs were recomputing and failing because shareAcrossSpecs was not working correctly, due to having experimentalSessionSupport enabled, which clears the Cypress.env before each test, while cypress-data-session relies on that cache to store the results.

I think it would be good to throw a clear error if it's detected that experimentalSessionSupport is enabled and shareAcrossSpecs is set as well.

@IanVS
Copy link
Author

IanVS commented Dec 15, 2021

Maybe this is not quite true, I see in the code that Cypress.env() is not used for shareAcrossSpecs, but it is used to determine whether to recompute. I can't figure out why, but running the tests a second time is not finding anything in Cypress.env(), which causes them to recompute and fail...

@IanVS
Copy link
Author

IanVS commented Dec 15, 2021

OK, I think I see. I was trying out a hard reload, which I saw you do in one of your videos. This does seem to clear out Cypress.env(), which forces setup() to run again. Is that intentional, or maybe a bug? And yes, experimentalSessionSupport causes the same thing, setup is forced to run between specs.

@bahmutov
Copy link
Owner

bahmutov commented Dec 15, 2021 via email

@IanVS
Copy link
Author

IanVS commented Dec 15, 2021

I think it does load the saved value, but not the timestamp that is saved into Cypress.env(). So, since it cannot find a timestamp, it runs setup() again, which in my case causes an error if it has already run.

@bahmutov
Copy link
Owner

bahmutov commented Dec 15, 2021 via email

@bahmutov
Copy link
Owner

Hey @IanVS can you create a simple reproducible example showing the problem? I have checked the spec https://github.com/bahmutov/cypress-data-session/blob/main/cypress/integration/dependent-shared.js that has shared value with a dependent session, and that does have the timestamps correctly handled.

@IanVS
Copy link
Author

IanVS commented Dec 15, 2021

I don't have any dependent sessions. I'll try to make a test, though. 👍

@IanVS
Copy link
Author

IanVS commented Dec 15, 2021

I've opened #37 with an example of what I'm seeing.

@github-actions
Copy link

🎉 This issue has been resolved in version 1.13.4 🎉

The release is available on:

Your semantic-release bot 📦🚀

@IanVS
Copy link
Author

IanVS commented Dec 16, 2021

Great, my tests are passing now with the new version. Thanks for the fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants