Skip to content

Wait Steps

Beginners: start with Running Tests if you are still learning when waits are necessary. This page is the exact synchronization-step reference.

Source: src/tests/steps/actions/wait.step.ts.

See shared placeholder rules in Step Parameter Conventions.

Prefer installing published steps with npx appraisejs@latest add step ... instead of adding the package to your project with npm install.

Use wait steps when the scenario needs route or element synchronization and fixed-duration waiting is not enough or not appropriate.

the user waits for the current page to be loaded

Terminal window
npx appraisejs@latest add step wait/wait-for-page-load
  • Waits for current page to reach domcontentloaded.
  • None.
When the user waits for the current page to be loaded

the user waits for the route {string} to be loaded

Terminal window
npx appraisejs@latest add step wait/wait-for-url-route
  • Reads selected environment base URL.
  • Combines base URL with provided route.
  • Waits for full URL match.
ParameterRepresentsExpected data
{string}Route pathRelative route (for example /dashboard or dashboard).
When the user waits for the route "/dashboard" to be loaded

the user waits for the element {string} to become visible

Terminal window
npx appraisejs@latest add step wait/wait-for-element
  • Resolves locator by name.
  • Waits until selector state is visible.
ParameterRepresentsExpected data
{string}Locator nameExisting locator key (for example successBanner).
When the user waits for the element "successBanner" to become visible

the user waits for the {string} element to disappear

Terminal window
npx appraisejs@latest add step wait/wait-for-element-to-disappear
  • Resolves locator by name.
  • Waits until selector state is hidden.
ParameterRepresentsExpected data
{string}Locator nameExisting locator key (for example loadingSpinner).
When the user waits for the "loadingSpinner" element to disappear

the user waits for {int} seconds

Terminal window
npx appraisejs@latest add step wait/wait-for-specific-amount-of-seconds
  • Pauses execution for provided seconds.
ParameterRepresentsExpected data
{int}Duration in secondsPositive integer (for example 2).
When the user waits for 2 seconds
  • Prefer route/element waits over fixed-duration waits where possible.
  • Fixed waits are best as last-resort stabilization steps.