MOBILE-3947 behat: Reimplement wait

The behaviour of wait for new versions has changed, so we need to implement it ourselves. See https://github.com/oleg-andreyev/MinkPhpWebDriver/pull/81
main
Noel De Martin 2023-12-05 14:02:37 +01:00
parent 1f7a00b1ce
commit 639b4d9cfa
2 changed files with 14 additions and 12 deletions

View File

@ -214,10 +214,7 @@ class behat_app extends behat_app_helper {
return true;
});
$this->wait_for_pending_js();
// Wait scroll animation to finish.
$this->getSession()->wait(300);
$this->wait_animations_done();
}
/**
@ -263,10 +260,7 @@ class behat_app extends behat_app_helper {
throw new DriverException('Error when swiping - ' . $result);
}
$this->wait_for_pending_js();
// Wait swipe animation to finish.
$this->getSession()->wait(300);
$this->wait_animations_done();
}
/**
@ -689,10 +683,7 @@ class behat_app extends behat_app_helper {
return true;
});
$this->wait_for_pending_js();
// Wait for UI to settle after refreshing.
$this->getSession()->wait(300);
$this->wait_animations_done();
if (is_null($locator)) {
return;

View File

@ -641,4 +641,15 @@ EOF;
return $text;
}
}
/**
* Wait until animations have finished.
*/
protected function wait_animations_done() {
$this->wait_for_pending_js();
// Ideally, we wouldn't wait a fixed amount of time. But it is not straightforward to wait for animations
// to finish, so for now we'll just wait 300ms.
usleep(300000);
}
}