Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

waiting time
cypress

How to increase Cypress waiting time

Arslan Tariq

Wait time

Wait for a few milliseconds or wait for the alias resource to resolve before continuing with the following commands. The Wait goes through two separate “waiting” periods.

1. Request timeout

The first cycle is waiting to respond to the request to close the browser, and the request timeout by default duration is 5000 milliseconds. This means that Cypress will wait up to 5 seconds before issuing a matching request when you start waiting for an alias request.

Waiting periods in seconds

2. Response timeout

Once Cypress detects a match request has started, it switches to a second wait. By default, 30000 milliseconds duration set. This means Cypress will wait 30 seconds for the remote server to respond to this request.

How to increase

When passing a sequence of aliases by cy.contains(), Cypress will wait for all requests within the specified request timeout and response timeout to complete.

Example

The fastest (but not robust) solution is to increase the timeout on cy.contains by changing:

-cy.contains("No articles are here").should("be.visible");
+cy.contains("No articles are here", { timeout: 10000 })
             .should("be.visible");

Now, the test usually passes.

For more details, visit our course.

RELATED TAGS

waiting time
cypress

CONTRIBUTOR

Arslan Tariq
Copyright ©2022 Educative, Inc. All rights reserved
RELATED COURSES

View all Courses

Keep Exploring