-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Cypress does not clear whitelisted cookies between runs during cypress open
#6414
Comments
@dialex I believe this is a bug with chrome 80. Can you try a previous version of chrome (chromium)? You can download it here https://chromium.cypress.io/ |
I cannot recreate this behavior with our
IMO, tracking down the change you made before/after this happened will probably be the clue though. Did you add some new tests or config? |
Thanks for taking the time @jennifer-shehane 🙏
More debug:
So I took this working repo as a baseline, and then starting adding my code:
At this point both folders are identical 🤷♂️
I can't get my mind around this... it doesn't seem deterministic, there must be something hidden controlling this behaviour. It doesn't make any sense the same come one time runs tests and then it doesn't. |
@dialex is this only a problem when you use the 'run all tests' button? |
@bkucera Here's the summary:
|
After you see the error happening, could try and follow these instructions to Clear App Data to see if it fixes the failures? Can you provide the code from your |
IT WORKS! The solution was to delete the App Data folder. OMG, thank you so much @jennifer-shehane 🙇 |
It's happening again 😭 So the delete App Data folder is just a hack that temporarily fixes the issue, but after a few test runs the issue returns and Cypress stops running tests. Current behaviour: |
Yeah, this is a pretty weird issue we haven't seen with anyone else, but I suppose it narrows down the issue to something that is being written to the App Data. Can you make sure to disabled all extensions in Chrome within Cypress? Sometimes extensions can do weird things. Are there any error in the DevTools console if you open that during the run? Other than that - it may be something related to the tests you're running. Can you narrow down the test suite to the smallest reproducible set of commands that reproduce the freezing after you clear the App Data? |
Right, I don't have any extensions installed or enabled in Cypress' Chrome.
Nothing.
I can try, I'll need time for that. When I have an update, I'll let you know. Thanks |
Ok, I was finally able to reproduce this issue! FYI @jennifer-shehane I'm using this In a nutshell: 1) My hypothesis is: for that mechanism to work, the cookie needs to be whitelisted, so that it persists between tests of the same test run. After we get one failure, the test suite is aborted. When we try to rerun it, the cookie is still there (whitelisted), the
Here's why I think this is a bug:
I hope this helps finding the faulty code, let me know if you need any extra data 😉 |
cypress open
I'm not able to recreate the behavior of whitelisted cookies persisting in between describe('tests', () => {
before(() => {
Cypress.Cookies.defaults({
whitelist: 'token',
})
})
it('test this', () => {
Cypress.Cookies.debug(true)
cy.visit('https://example.cypress.io/commands/cookies')
cy.getCookie('token').should('not.exist')
cy.get('#getCookie .set-a-cookie').click()
cy.getCookie('token').should('have.property', 'value', '123ABC')
});
it('test cookie is still here', () => {
Cypress.Cookies.debug(true)
cy.visit('https://example.cypress.io/commands/cookies')
cy.getCookie('token').should('have.property', 'value', '123ABC')
});
}) On every 'stop' / 'rerun', the whitelisted cookie does not exist. It definitively does not save whitelisted cookies throughout killing the Cypress process and reopning. There is some other mechanism going on in your test code / setup that must be setting the cookie in an unexpected way before you're expecting. If you can provide a way to show this is a bug regarding some setup, please provide an example using the example.cypress.io site like shown above so that we can recreate. |
Hi @jennifer-shehane I am struggling with the same issue and it's breaking our tests. We are running Cypress tests against 2 environments. Let's name them dev1.app.com and dev2.app.com. I have whitelisted 2 cookies by their names. At the beginning of my test I am calling cy.getCookies(); The workaround I found so far is to manually delete all cookies that do not come from the current domain. Something like this: cy.getCookies().then(function(cookies) {
const envDomain = Cypress.config('baseUrl').replace('https://', '');
if (cookie.domain !== envDomain) {
cy.clearCookie(cookie.name);
}
});
}); |
@jennifer-shehane were you able to check this problem but when cookies belong to different domains? |
This issue has not had any activity in 180 days. Cypress evolves quickly and the reported behavior should be tested on the latest version of Cypress to verify the behavior is still occurring. It will be closed in 14 days if no updates are provided. |
This issue has been closed due to inactivity. |
When I open Cypress and click to run all tests, nothing happens.
Current behavior:
If I run
cypress run
then yes, it runs all tests in the command line. But withcypress open
it shows the UI and when I click run (all) test(s), no test is executed... it just hangs thereDesired behavior:
Open Cypress, click run all tests and actually run all tests.
Test code to reproduce
I don't have steps to reproduce this issue but I've tried:
3.7.0
to4.0.1
❌12.*
to13.*
❌node_modules
❌/Users/Library/Caches/Cypress/
❌So the problem seems to be my machine somehow. It was working perfectly fine until yesterday, when I tried the retry plugin, I even reported it. Then I could no longer run tests visually. Some misconfiguration? Something corrupted?
How can I reset whatever is causing Cypress to misbehave?
Versions
Cypress 4.0.1 / macOS 10.14.6 / Chrome 80
The text was updated successfully, but these errors were encountered: