wrap().invoke().should() ignores timeout options in should assertion
See original GitHub issueWhen a function wrapped inside a wrap
gets invoked by a invoke
, the should
seems to ignore the timeout passed along in the wrap object.
Test code:
const slow = () => new Cypress.Promise(resolve => {
setTimeout(() => resolve('done'), 2000);
});
cy
.wrap({ slow }, { timeout: 100 })
.invoke('slow')
.should('eq', 'done');
This test is a silly example, in reality I’m querying the Mandrill API, which I want to give a very big timeout as Mandrill can take quite a while to show an email, but I do not want to update the defaultCommandTimeout
to minutes as other assertions will never take this long.
Additional Info (images, stack traces, etc)
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:7 (3 by maintainers)
Top Results From Across the Web
should | Cypress Documentation
Create an assertion. Assertions are automatically retried until they pass or time out. An alias of .and() Note: .should() assumes you are already....
Read more >Assertions | Cypress examples (v9.7.0) - Gleb Bahmutov
To make an assertion about the current subject, use the .should() command. ... expression // first need to invoke jQuery method text() //...
Read more >Timeout on a function call - python - Stack Overflow
Process(target=bar) p.start() # Wait for 10 seconds or until process finishes ... if process is stuck for good p.terminate() # OR Kill -...
Read more >gMock Cookbook | GoogleTest
Perhaps you want to do it as part of a stub action, or perhaps your test doesn't need to mock Concrete() at all...
Read more >Mocha - the fun, simple, flexible JavaScript test framework
chai - expect() , assert() and should -style assertions; better-assert - C-style self-documenting assert(); unexpected - “the extensible BDD assertion toolkit” ...
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 Free
Top 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
@jennifer-shehane is there an update on this issue? It is still present in version 3.1.0.
@mitchkm you can do something like this, it’s horrible but it works:
Here is the solution and example:
And in-use example