With cypress.io get-Method we can define a timeout only valid for this specific get-method call:
cy.get('.mobile-nav', { timeout: 10000 })
Is there a way to define a timeout for a specific its-method call like:
cy.window().its('MyClass')
Or do I need to increase defaultCommandTimeout in cypress.json?
Else, we can provide a default timeout by adding "defaultCommandTimeout": 10000 in cypress. json which will by default add a 10-second timeout for all the commands.
Use the Cypress intercept and aliasing commands to require Cypress to wait on your asynchronous operations to complete before running the next command or assertion. Use the Cypress intercept command to control all the network traffic necessary to your tests to eliminate inconsistencies across test runs.
Use timeout per command Sometimes, you simply want to wait until a certain element appears, but everything else on the page is pretty fast. For these cases, you can use the options object and change timeout for a certain command. Notice how we are adding the timeout into our . get() command, not the .
For me, I just do this wherever I wanted to wait
cy.get('ELEMENT', {timeout:50000})
Place this in the its block before you want it used:
Cypress.config('defaultCommandTimeout', 10000);
Cypress.config() documentation
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With