MOBILE-3833 behat: Improve runtime debugging

Injecting the runtime instead of evaluating makes it possible to debug using dev tools
main
Noel De Martin 2022-03-10 11:16:37 +01:00
parent 462e868582
commit ecaaba732a
1 changed files with 8 additions and 2 deletions

View File

@ -504,8 +504,14 @@ class behat_app extends behat_base {
throw new DriverException('Moodle app not found in browser');
}, false, 60);
// Run the scripts to install Moodle 'pending' checks.
$this->execute_script(file_get_contents(__DIR__ . '/app_behat_runtime.js'));
// Inject Behat JavaScript runtime.
global $CFG;
$this->execute_script("
var script = document.createElement('script');
script.src = '{$CFG->behat_wwwroot}/local/moodlemobileapp/tests/behat/app_behat_runtime.js';
document.body.append(script);
");
if ($restart) {
// Assert initial page.