Timeouts | Bondar Academy
Course: Cypress UI Testing with JavaScript
Module: Interaction with Web Elements
Instructor: Artem Bondar
Lesson Summary
In this lesson, we explored Cypress timeouts and how they manage waiting for web elements during testing. Here are the key points discussed: Understanding Cypress Timeouts Cypress has a default timeout of 4,000 milliseconds (4 seconds) for waiting for web elements. Timeouts can be configured globally or on a per-command basis. Demo Overview Using the Playground app, we demonstrated a test that interacts with a dialog box that opens with a delay. The steps included: Navigating to the Models and Overlays section. Clicking the Open with Delay 3 seconds button. Validating that the dialog box displays the text Friendly Reminder . Actionability Checks Cypress performs actionability checks to ensure elements are: Visible Not hidden or disabled In the DOM Configuring Timeouts Timeouts can be adjusted in two ways: Globally: Modify the configuration file to set a new default timeout. Individually: Use a second argument in commands to specify a timeout, e.g., cy.get('selector', { timeout: 11000 }) . Important Notes When using assertions, do not add timeouts directly to them; instead, apply them to action commands. This ensures proper functionality. In summary, Cypress timeouts are crucial for managing delays in web applications, and understanding how to configure them can enhance testing efficiency.