DEV Community

Cover image for Webship-js: When I wait
webship.co
webship.co

Posted on

2

Webship-js: When I wait

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
Enter fullscreen mode Exit fullscreen mode

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

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

API Trace View

Struggling with slow API calls? 👀

Dan Mindru walks through how he used Sentry's new Trace View feature to shave off 22.3 seconds from an API call.

Get a practical walkthrough of how to identify bottlenecks, split tasks into multiple parallel tasks, identify slow AI model calls, and more.

Read more →

Top comments (0)

nextjs tutorial video

Youtube Tutorial Series 📺

So you built a Next.js app, but you need a clear view of the entire operation flow to be able to identify performance bottlenecks before you launch. But how do you get started? Get the essentials on tracing for Next.js from @nikolovlazar in this video series 👀

Watch the Youtube series