Behat tests are failing with "Call to a member function waitForLoad() on null"

Behat tests are failing with "Call to a member function waitForLoad() on null"

by Tim V. -
Number of replies: 2

Hi,

I'm using the chrome-mink-driver extension of dmore for behat testing in Moodle 3.9. I configured everything as stated on https://tracker.moodle.org/browse/MDL-58948

My problem is, when starting the behat testing using "vendor/bin/behat --config /var/bht_moodledata/behatrun/behat/behat.yml --format pretty" I'm getting a fatal error:

  ┌─ @BeforeScenario # behat_hooks::before_scenario_hook()
  │
  ╳  Fatal error: Call to a member function waitForLoad() on null (Behat\Testwork\Call\Exception\FatalThrowableError)

I debugged the problem and it seems that the start() function of the ChromeDriver class is never called. Instead of this, when running the behat testing, the i_visit() function in behat_general.php is called. Inside i_visit(), the session is fetched and the visit()-function is called (finally the visit()-function of the ChromDriver class). But inside the visit()-function of the ChromeDriver class there's no call to start() the browser. So the browser is never initialized. Anyone having trouble, too or any idea how to fix it?

I temporarely fixed it by modifying the ChromeDriver class to call the start() function when visit() is called. This works atm for me and all tests are passing. But I'm confused if other ppl facing the same "bug" or if anyone can confirm if it's a bug or if not...

Average of ratings: -
In reply to Tim V.

Re: Behat tests are failing with "Call to a member function waitForLoad() on null"

by Renaat Debleu -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers
This is will not work any more due to the changes made in MDL-69232.

You can try to fix it by commenting out some code.
In reply to Renaat Debleu

Re: Behat tests are failing with "Call to a member function waitForLoad() on null"

by Tim V. -
Ah, thank you very much! I don't like to change anything in the Moodle core so my solution is to adjust the DMore driver.