Closed GrayedFox closed 6 years ago
Umm, just to expose a bit more info:
These tests are basically acceptance tests and will be using entirely stubbed responses - except the login. The login is a nice way to check the server is actually alive and besides this I need a valid, signed cookie during the session and I figure trusting the server to do that each time is something I want to test anyway.
So, really, we need to only login once (and not multiple times in the beforeEach block). Hence why I'd like to choose to do this in a before block and then persist the cookie. Login tests clear the cookie in a beforeEach block, so we're good there.
Not sure if this is related to #2390
Closing, jumped the gun here - the cookies being persisted and leaking into other tests caused me some confusion, this is just a duplicate of https://github.com/cypress-io/cypress/issues/781
I know this is quite a complex bug, I apologise for the length of this report. Have tried to be specific as possible!
Current behavior:
Persisting a cookie using the support index file whitelist (for authenticated state) exhibits different behaviour if the cookie is saved after logging in via the browser, compared to logging in directly via the API (using a custom command).
Desired behavior:
Persisting a cookie returned by a POST request should behave the same way, when running tests, when that same cookie is persisted via the a browser submitting a form.
Steps to reproduce:
Something like:
This won't work, but if you replace the before block with code that does something like this:
Then the test works as expected.
Basically:
it()
blocks all maintaining state)it()
blocks failing since the app is not logged in)Versions
Cypress: 3.1.0 Electron: 59 Ubuntu: 18.04 LTS