From d60b6af9b98a36e442a19333dee55e2898023e4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pau=20Ferrer=20Oca=C3=B1a?= Date: Fri, 17 Jan 2020 15:30:23 +0100 Subject: [PATCH] MDL-67727 behat: Reset ionic app properly --- lib/tests/behat/behat_app.php | 5 +++++ lib/tests/behat/behat_hooks.php | 8 +++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/tests/behat/behat_app.php b/lib/tests/behat/behat_app.php index aebbed10915..4996b27972b 100644 --- a/lib/tests/behat/behat_app.php +++ b/lib/tests/behat/behat_app.php @@ -85,6 +85,10 @@ class behat_app extends behat_base { $this->getSession()->restart(); $this->resize_window('360x720', true); + if (empty($this->ionicurl)) { + $this->ionicurl = $this->start_or_reuse_ionic(); + } + // Go to page and prepare browser for app. $this->prepare_browser($this->ionicurl); } @@ -241,6 +245,7 @@ class behat_app extends behat_base { // the process. self::$ionicrunning = (object)['url' => $url, 'process' => $process, 'pipes' => $pipes, 'pid' => $pid]; + $url = self::$ionicrunning->url; } return $url; } diff --git a/lib/tests/behat/behat_hooks.php b/lib/tests/behat/behat_hooks.php index 41f6f3d7cf1..79f00c2fd36 100644 --- a/lib/tests/behat/behat_hooks.php +++ b/lib/tests/behat/behat_hooks.php @@ -385,16 +385,18 @@ class behat_hooks extends behat_base { // Reset the scenariorunning variable to ensure that Step 0 occurs. $this->scenariorunning = false; - // Run all test with medium (1024x768) screen size, to avoid responsive problems. - $this->resize_window('medium'); - // Set up the tags for current scenario. self::fetch_tags_for_scenario($scope); // If scenario requires the Moodle app to be running, set this up. if ($this->has_tag('app')) { $this->execute('behat_app::start_scenario'); + + return; } + + // Run all test with medium (1024x768) screen size, to avoid responsive problems. + $this->resize_window('medium'); } /**