Skip to content

Commit

Permalink
Add iWaitForTheBatchProcessToFinish detecting when the batch process …
Browse files Browse the repository at this point in the history
…is finished (#104)

* Add iWaitForTheBatchProcessToFinish

* Rewrite the function for reusability

Rewrite iWaitForTheBatchProcessToFinish for reusability
  • Loading branch information
vincent-gao authored Oct 17, 2023
1 parent d089e70 commit d15acbc
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/behat/bootstrap/TideCommonTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,4 +168,17 @@ public function findMenuItemMatchingText(string $text): void {
}
}

/**
* Wait for the Batch API to finish.
*
* Wait until the id="updateprogress" element is gone,
* or timeout after the given duration.
*
* @Given /^I wait for the batch process to finish for (\d+) seconds$/
*/
public function iWaitForTheBatchProcessToFinish(int $seconds): void {
$durationInMilliseconds = $seconds * 1000;
$this->getSession()->wait($durationInMilliseconds, 'jQuery("#updateprogress").length === 0');
}

}

0 comments on commit d15acbc

Please sign in to comment.