diff --git a/tests/behat/behat_app.php b/tests/behat/behat_app.php index d056fc1be..f9e1b05a1 100644 --- a/tests/behat/behat_app.php +++ b/tests/behat/behat_app.php @@ -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.