From ecaaba732a98f378d82c7bbfc9a6d0e0f373b8dc Mon Sep 17 00:00:00 2001 From: Noel De Martin Date: Thu, 10 Mar 2022 11:16:37 +0100 Subject: [PATCH] MOBILE-3833 behat: Improve runtime debugging Injecting the runtime instead of evaluating makes it possible to debug using dev tools --- tests/behat/behat_app.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) 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.