cy.getCookie() does not support timeouts
See original GitHub issueCurrent behavior:
Both of the following lines result in expected null to exist
although the cookie becomes available within a timeframe of about 200ms:
cy.getCookie('token').should('exist')
cy.getCookie('token', { timeout: 5000 }).should('exist')
Adding a cy.wait(1000)
above the lines will make them pass without error.
Desired behavior:
cy.getCookie
should use the default timeout when used together with ‘should’cy.getCookie
should support thetimeout
argument as documented here: https://on.cypress.io/getcookie#Arguments
Steps to reproduce:
Use cy.getCookie('someCookie').should('exist')
for a cookie which is saved with a little delay, e.g. session cookie after login.
Versions
cypress 3.4.0, electron 61, 5.2.1-arch1-1-ARCH
Issue Analytics
- State:
- Created 4 years ago
- Reactions:28
- Comments:17 (1 by maintainers)
Top Results From Across the Web
getCookie
Because cy.getCookie() is asynchronous it is technically possible for there to be a timeout while talking to the internal Cypress automation APIs.
Read more >How do I wait until a cookie is set?
Upon reception, the application sets the cookie. My problem is that I am not fond of the following call: cy.wait(1000). Without ...
Read more >cypress-io/cypress - Gitter
I've checked the docs but can't find anything to speed this up. ... getCookies().then((cookies) => { cy.log(JSON.stringify(cookies)) }) });.
Read more >Configurations in Cypress and How to Disable Default ...
Additionally, any DOM-based commands(such as cy.get(), etc.) will timeout. execTimeout, 60000, This configuration specifies the maximum time in ...
Read more >cypress-wait-until: Docs, Tutorials, Reviews
Add this line to your project's cypress/support/commands.js : import 'cypress-wait-until'; ... cy.getCookie('token') // will not be retried .
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Recording of this issue in action: https://user-images.githubusercontent.com/24389501/168602990-48e7f37f-f25d-487b-859c-ef3bf07d9ae9.mp4
According to the docs for
.should()
:However you can see from the video that this fails on the first assertion, and does not retry
Hi @jennifer-shehane,
I dont think 30 seconds timeout exists. Any particular version to look out for?
Also, passing a timeout param would be great!
Thanks!