Behat script to wait for n seconds

Profile picture for user devraj

If you want your program to wait for n seconds, use below code.

Paste Behat Script to your FeatureContext.php file and your Gherkin step to your feature file.

Example 1: Using Sleep Method

Gherkin

And I wait 5 seconds

Behat Script

/**
   * Waits a while, for debugging.
   *
   * @param int $seconds
   *   How long to wait.
   *
   * @When I wait :seconds second(s)
   */
  public function wait($seconds) {
    sleep($seconds);
  }