The "when I wait" step in Webship-JS is crucial for ensuring that your automated tests simulate realistic user behavior. It allows you to introduce pauses or delays in the test execution, ensuring that elements load fully or actions complete before the next steps are executed. This step is particularly important when dealing with dynamic content or AJAX requests, as it guarantees that the page is ready for the next interaction, preventing errors due to incomplete loading or unresponsive elements. By using this step, you enhance the reliability and accuracy of your tests.

This step definition specifies that the user will pause or wait for a defined duration—either a set number of seconds/minutes, a maximum number of seconds/minutes, or until the page fully loads—before proceeding to the next step.

This step is typically used where a delay or time-based action is expected.

  • When I wait until the page loaded
  • When I wait {number} seconds
  • When I wait max {number} seconds
  • When I wait {number} minutes
  • When I wait max {number} minutes

When I wait until the page loaded

This step definition acts as a command to wait until the page's body fully loads before performing any actions on the page

The page body loading time is set to 10 seconds. If the body isn't loaded within this time frame, an error will be triggered for this step definition.

Example:

When I wait until the page is loaded
When we wait until the page loaded

See the full article:https://webship.co/blog/webship-js-when-i-wait

You can see more step definitions: https://webship.co/docs

Author Of article : webship.co Read full article