MDL-67727 behat: Reset ionic app properly

This commit is contained in:
Pau Ferrer Ocaña 2020-01-17 15:30:23 +01:00
parent fd126006b0
commit d60b6af9b9
2 changed files with 10 additions and 3 deletions

View file

@ -85,6 +85,10 @@ class behat_app extends behat_base {
$this->getSession()->restart(); $this->getSession()->restart();
$this->resize_window('360x720', true); $this->resize_window('360x720', true);
if (empty($this->ionicurl)) {
$this->ionicurl = $this->start_or_reuse_ionic();
}
// Go to page and prepare browser for app. // Go to page and prepare browser for app.
$this->prepare_browser($this->ionicurl); $this->prepare_browser($this->ionicurl);
} }
@ -241,6 +245,7 @@ class behat_app extends behat_base {
// the process. // the process.
self::$ionicrunning = (object)['url' => $url, 'process' => $process, 'pipes' => $pipes, self::$ionicrunning = (object)['url' => $url, 'process' => $process, 'pipes' => $pipes,
'pid' => $pid]; 'pid' => $pid];
$url = self::$ionicrunning->url;
} }
return $url; return $url;
} }

View file

@ -385,16 +385,18 @@ class behat_hooks extends behat_base {
// Reset the scenariorunning variable to ensure that Step 0 occurs. // Reset the scenariorunning variable to ensure that Step 0 occurs.
$this->scenariorunning = false; $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. // Set up the tags for current scenario.
self::fetch_tags_for_scenario($scope); self::fetch_tags_for_scenario($scope);
// If scenario requires the Moodle app to be running, set this up. // If scenario requires the Moodle app to be running, set this up.
if ($this->has_tag('app')) { if ($this->has_tag('app')) {
$this->execute('behat_app::start_scenario'); $this->execute('behat_app::start_scenario');
return;
} }
// Run all test with medium (1024x768) screen size, to avoid responsive problems.
$this->resize_window('medium');
} }
/** /**