MDL-56614 behat: add missing wait for page is ready

This commit is contained in:
Marina Glancy 2016-12-08 10:34:04 +08:00
parent 383b2f9eb6
commit ef0d68e9b5

View File

@ -134,13 +134,10 @@ class behat_theme_boost_behat_navigation extends behat_navigation {
* If we are not on the course main page, click on the course link in the navbar
*/
protected function go_to_main_course_page() {
$starturl = rtrim($this->getMinkParameter('base_url'), '/') . '/';
$url = $this->getSession()->getCurrentUrl();
if (strpos($url, $starturl) === 0) {
$url = substr($url, strlen($starturl));
}
if (!preg_match('|^course/view.php?id=[\d]+|', $url)) {
if (!preg_match('|/course/view.php\?id=[\d]+$|', $url)) {
$this->find('xpath', '//header//div[@id=\'page-navbar\']//a[contains(@href,\'/course/view.php?id=\')]')->click();
$this->execute('behat_general::wait_until_the_page_is_ready');
}
}