moodlehq / moodle-docker

A docker environment for moodle developers
GNU General Public License v3.0
406 stars 252 forks source link

Update version of the Firefox profile to make use of newer webdriver #154

Closed aspark21 closed 2 years ago

aspark21 commented 3 years ago

https://moodle.org/mod/forum/discuss.php?d=417286 states "We will be updating the Moodle-docker toolkit over the coming days too."

I assume the intent was to update the sample config.php to make use of https://github.com/andrewnicols/moodle-browser-config

andrewnicols commented 3 years ago

Hi @aspark21 ,

The change mentioned there is actually to switch to a different version of Firefox.

Older versions of Firefox are no longer supported with the newer webdriver so we need to modify the Firefox profile at https://github.com/moodlehq/moodle-docker/blob/master/base.yml#L26 to use a different image.

We do also need to consider moving this one to a different yml file so that anyone testing against legacy versions of Moodle can still use Firefox.

aspark21 commented 3 years ago

Hi @andrewnicols

Ah cool.

I see moodle-plugin-ci uses 3.141.59 https://github.com/moodlehq/moodle-plugin-ci/blob/master/src/Command/BehatCommand.php#L41

So I'm hoping this Fatal Error should be resolved if we switch firefox versions - https://gitlab.com/jezhops/moodle-theme_adaptable/-/issues/159#note_561876589 ?

I've forked this and increased the version quickly - https://github.com/aspark21/moodle-docker/commit/b5f4b0ad4935eb87376fea3225a2f777c692b011

And I've set off the job to run again with that. 🤞 that allows it to complete this evening

aspark21 commented 3 years ago

Updated the title of the story to better reflect the change needed.

Unfortunately the simple hotfix did not work.

We get these errors under Boost all the time now, random how long the behat runs get to go on for but always end up hitting this.

 Running 2 parallel behat sites:
    [behatrun1] vendor/bin/behat --config /var/www/behatdata/behatrun1/behat/behat.yml --format="pretty" --out="report_behat_1.txt" --format="junit" --out="junit_behat_1"
    [behatrun2] vendor/bin/behat --config /var/www/behatdata/behatrun2/behat/behat.yml --format="pretty" --out="report_behat_2.txt" --format="junit" --out="junit_behat_2"
    Fatal error: Uncaught Facebook\WebDriver\Exception\WebDriverCurlException: Curl error thrown for http DELETE to /session/a172997a-95ea-4162-a3da-fbdaac17da65
    Operation timed out after 30001 milliseconds with 0 bytes received in /var/www/html/vendor/php-webdriver/webdriver/lib/Remote/HttpCommandExecutor.php:332
    Stack trace:
    #0 /var/www/html/vendor/php-webdriver/webdriver/lib/Remote/RemoteWebDriver.php(612): Facebook\WebDriver\Remote\HttpCommandExecutor->execute(Object(Facebook\WebDriver\Remote\WebDriverCommand))
    #1 /var/www/html/vendor/php-webdriver/webdriver/lib/Remote/RemoteWebDriver.php(337): Facebook\WebDriver\Remote\RemoteWebDriver->execute('quit')
    #2 /var/www/html/vendor/oleg-andreyev/mink-phpwebdriver/src/WebDriver.php(297): Facebook\WebDriver\Remote\RemoteWebDriver->quit()
    #3 /var/www/html/vendor/behat/mink/src/Session.php(78): OAndreyev\Mink\Driver\WebDriver->stop()
    #4 /var/www/html/vendor/behat/mink/src/Mink.php(179): Behat\Mink\Session->stop()
    #5 /var/www/html/vendor/behat/mink/src/Mink.php(46): Behat\Mink\Mink in /var/www/html/vendor/oleg-andreyev/mink-phpwebdriver/src/WebDriver.php on line 300

    Finished in 2h 43m 22s

    **************** [behatrun1] ****************

    Fatal error: Uncaught Facebook\WebDriver\Exception\WebDriverCurlException: Curl error thrown for http DELETE to /session/a172997a-95ea-4162-a3da-fbdaac17da65

    Operation timed out after 30001 milliseconds with 0 bytes received in /var/www/html/vendor/php-webdriver/webdriver/lib/Remote/HttpCommandExecutor.php:332
    Stack trace:
    #0 /var/www/html/vendor/php-webdriver/webdriver/lib/Remote/RemoteWebDriver.php(612): Facebook\WebDriver\Remote\HttpCommandExecutor->execute(Object(Facebook\WebDriver\Remote\WebDriverCommand))
    #1 /var/www/html/vendor/php-webdriver/webdriver/lib/Remote/RemoteWebDriver.php(337): Facebook\WebDriver\Remote\RemoteWebDriver->execute('quit')
    #2 /var/www/html/vendor/oleg-andreyev/mink-phpwebdriver/src/WebDriver.php(297): Facebook\WebDriver\Remote\RemoteWebDriver->quit()
    #3 /var/www/html/vendor/behat/mink/src/Session.php(78): OAndreyev\Mink\Driver\WebDriver->stop()
    #4 /var/www/html/vendor/behat/mink/src/Mink.php(179): Behat\Mink\Session->stop()
    #5 /var/www/html/vendor/behat/mink/src/Mink.php(46): Behat\Mink\Mink in /var/www/html/vendor/oleg-andreyev/mink-phpwebdriver/src/WebDriver.php on line 300

    Error while stopping WebDriver: Behat\Mink\Exception\DriverException (0) 'Could not close connection'
    Attempting to continue with test run. Stacktrace follows:

    * line 78 of /vendor/behat/mink/src/Session.php: call to OAndreyev\Mink\Driver\WebDriver->stop()
    * line 673 of /lib/tests/behat/behat_hooks.php: call to Behat\Mink\Session->stop()
    * line 110 of /vendor/behat/behat/src/Behat/Testwork/Call/Handler/RuntimeCallHandler.php: call to behat_hooks->reset_webdriver_between_scenarios()
    * line 64 of /vendor/behat/behat/src/Behat/Testwork/Call/Handler/RuntimeCallHandler.php: call to Behat\Testwork\Call\Handler\RuntimeCallHandler->executeCall()
    * line 138 of /vendor/behat/behat/src/Behat/Testwork/Call/CallCenter.php: call to Behat\Testwork\Call\Handler\RuntimeCallHandler->handleCall()
    * line 96 of /vendor/behat/behat/src/Behat/Testwork/Call/CallCenter.php: call to Behat\Testwork\Call\CallCenter->handleCall()
    * line 74 of /vendor/behat/behat/src/Behat/Testwork/Hook/HookDispatcher.php: call to Behat\Testwork\Call\CallCenter->makeCall()
    * line 58 of /vendor/behat/behat/src/Behat/Testwork/Hook/HookDispatcher.php: call to Behat\Testwork\Hook\HookDispatcher->dispatchHook()
    * line 89 of /vendor/behat/behat/src/Behat/Behat/Hook/Tester/HookableScenarioTester.php: call to Behat\Testwork\Hook\HookDispatcher->dispatchScopeHooks()
    * line 118 of /vendor/behat/behat/src/Behat/Behat/EventDispatcher/Tester/EventDispatchingScenarioTester.php: call to Behat\Behat\Hook\Tester\HookableScenarioTester->tearDown()
    * line 70 of /vendor/behat/behat/src/Behat/Behat/Tester/Runtime/IsolatingScenarioTester.php: call to Behat\Behat\EventDispatcher\Tester\EventDispatchingScenarioTester->tearDown()
    * line 84 of /vendor/behat/behat/src/Behat/Behat/Tester/Runtime/RuntimeFeatureTester.php: call to Behat\Behat\Tester\Runtime\IsolatingScenarioTester->test()
    * line 72 of /vendor/behat/behat/src/Behat/Behat/Hook/Tester/HookableFeatureTester.php: call to Behat\Behat\Tester\Runtime\RuntimeFeatureTester->test()
    * line 74 of /vendor/behat/behat/src/Behat/Behat/EventDispatcher/Tester/EventDispatchingFeatureTester.php: call to Behat\Behat\Hook\Tester\HookableFeatureTester->test()
    * line 63 of /vendor/behat/behat/src/Behat/Testwork/Tester/Runtime/RuntimeSuiteTester.php: call to Behat\Behat\EventDispatcher\Tester\EventDispatchingFeatureTester->test()
    * line 73 of /vendor/behat/behat/src/Behat/Testwork/Hook/Tester/HookableSuiteTester.php: call to Behat\Testwork\Tester\Runtime\RuntimeSuiteTester->test()
    * line 75 of /vendor/behat/behat/src/Behat/Testwork/EventDispatcher/Tester/EventDispatchingSuiteTester.php: call to Behat\Testwork\Hook\Tester\HookableSuiteTester->test()
    * line 71 of /vendor/behat/behat/src/Behat/Testwork/Tester/Runtime/RuntimeExercise.php: call to Behat\Testwork\EventDispatcher\Tester\EventDispatchingSuiteTester->test()
    * line 73 of /vendor/behat/behat/src/Behat/Testwork/EventDispatcher/Tester/EventDispatchingExercise.php: call to Behat\Testwork\Tester\Runtime\RuntimeExercise->test()
    * line 80 of /vendor/behat/behat/src/Behat/Testwork/Ordering/OrderedExercise.php: call to Behat\Testwork\EventDispatcher\Tester\EventDispatchingExercise->test()
    * line 149 of /vendor/behat/behat/src/Behat/Testwork/Tester/Cli/ExerciseController.php: call to Behat\Testwork\Ordering\OrderedExercise->test()
    * line 108 of /vendor/behat/behat/src/Behat/Testwork/Tester/Cli/ExerciseController.php: call to Behat\Testwork\Tester\Cli\ExerciseController->testSpecifications()
    * line 63 of /vendor/behat/behat/src/Behat/Testwork/Cli/Command.php: call to Behat\Testwork\Tester\Cli\ExerciseController->execute()
    * line 256 of /vendor/symfony/console/Command/Command.php: call to Behat\Testwork\Cli\Command->execute()
    * line 971 of /vendor/symfony/console/Application.php: call to Symfony\Component\Console\Command\Command->run()
    * line 290 of /vendor/symfony/console/Application.php: call to Symfony\Component\Console\Application->doRunCommand()
    * line 124 of /vendor/behat/behat/src/Behat/Testwork/Cli/Application.php: call to Symfony\Component\Console\Application->doRun()
    * line 166 of /vendor/symfony/console/Application.php: call to Behat\Testwork\Cli\Application->doRun()
    * line 34 of /vendor/behat/behat/bin/behat: call to Symfony\Component\Console\Application->run()

    In HttpCommandExecutor.php line 332:

      Curl error thrown for http DELETE to /session/a172997a-95ea-4162-a3da-fbdaac17da65/cookie

      Operation timed out after 30001 milliseconds with 0 bytes received

    behat [-s|--suite SUITE] [-f|--format FORMAT] [-o|--out OUT] [--format-settings FORMAT-SETTINGS] [--init] [--lang LANG] [--name NAME] [--tags TAGS] [--role ROLE] [--story-syntax] [-d|--definitions DEFINITIONS] [--snippets-for [SNIPPETS-FOR]] [--snippets-type SNIPPETS-TYPE] [--append-snippets] [--no-snippets] [--strict] [--order ORDER] [--skip-passed] [--rerun] [--stop-on-failure] [--dry-run] [--] [<paths>]

    **************** [behatrun2] ****************

    Fatal error: Uncaught Facebook\WebDriver\Exception\WebDriverCurlException: Curl error thrown for http DELETE to /session/8211fb5c-c8e9-4a3d-bdfa-a7a8bbf52d73

    Operation timed out after 30001 milliseconds with 0 bytes received in /var/www/html/vendor/php-webdriver/webdriver/lib/Remote/HttpCommandExecutor.php:332
    Stack trace:
    #0 /var/www/html/vendor/php-webdriver/webdriver/lib/Remote/RemoteWebDriver.php(612): Facebook\WebDriver\Remote\HttpCommandExecutor->execute(Object(Facebook\WebDriver\Remote\WebDriverCommand))
    #1 /var/www/html/vendor/php-webdriver/webdriver/lib/Remote/RemoteWebDriver.php(337): Facebook\WebDriver\Remote\RemoteWebDriver->execute('quit')
    #2 /var/www/html/vendor/oleg-andreyev/mink-phpwebdriver/src/WebDriver.php(297): Facebook\WebDriver\Remote\RemoteWebDriver->quit()
    #3 /var/www/html/vendor/behat/mink/src/Session.php(78): OAndreyev\Mink\Driver\WebDriver->stop()
    #4 /var/www/html/vendor/behat/mink/src/Mink.php(179): Behat\Mink\Session->stop()
    #5 /var/www/html/vendor/behat/mink/src/Mink.php(46): Behat\Mink\Mink in /var/www/html/vendor/oleg-andreyev/mink-phpwebdriver/src/WebDriver.php on line 300

    Error while stopping WebDriver: Behat\Mink\Exception\DriverException (0) 'Could not close connection'
    Attempting to continue with test run. Stacktrace follows:

    * line 78 of /vendor/behat/mink/src/Session.php: call to OAndreyev\Mink\Driver\WebDriver->stop()
    * line 673 of /lib/tests/behat/behat_hooks.php: call to Behat\Mink\Session->stop()
    * line 110 of /vendor/behat/behat/src/Behat/Testwork/Call/Handler/RuntimeCallHandler.php: call to behat_hooks->reset_webdriver_between_scenarios()
    * line 64 of /vendor/behat/behat/src/Behat/Testwork/Call/Handler/RuntimeCallHandler.php: call to Behat\Testwork\Call\Handler\RuntimeCallHandler->executeCall()
    * line 138 of /vendor/behat/behat/src/Behat/Testwork/Call/CallCenter.php: call to Behat\Testwork\Call\Handler\RuntimeCallHandler->handleCall()
    * line 96 of /vendor/behat/behat/src/Behat/Testwork/Call/CallCenter.php: call to Behat\Testwork\Call\CallCenter->handleCall()
    * line 74 of /vendor/behat/behat/src/Behat/Testwork/Hook/HookDispatcher.php: call to Behat\Testwork\Call\CallCenter->makeCall()
    * line 58 of /vendor/behat/behat/src/Behat/Testwork/Hook/HookDispatcher.php: call to Behat\Testwork\Hook\HookDispatcher->dispatchHook()
    * line 89 of /vendor/behat/behat/src/Behat/Behat/Hook/Tester/HookableScenarioTester.php: call to Behat\Testwork\Hook\HookDispatcher->dispatchScopeHooks()
    * line 118 of /vendor/behat/behat/src/Behat/Behat/EventDispatcher/Tester/EventDispatchingScenarioTester.php: call to Behat\Behat\Hook\Tester\HookableScenarioTester->tearDown()
    * line 70 of /vendor/behat/behat/src/Behat/Behat/Tester/Runtime/IsolatingScenarioTester.php: call to Behat\Behat\EventDispatcher\Tester\EventDispatchingScenarioTester->tearDown()
    * line 84 of /vendor/behat/behat/src/Behat/Behat/Tester/Runtime/RuntimeFeatureTester.php: call to Behat\Behat\Tester\Runtime\IsolatingScenarioTester->test()
    * line 72 of /vendor/behat/behat/src/Behat/Behat/Hook/Tester/HookableFeatureTester.php: call to Behat\Behat\Tester\Runtime\RuntimeFeatureTester->test()
    * line 74 of /vendor/behat/behat/src/Behat/Behat/EventDispatcher/Tester/EventDispatchingFeatureTester.php: call to Behat\Behat\Hook\Tester\HookableFeatureTester->test()
    * line 63 of /vendor/behat/behat/src/Behat/Testwork/Tester/Runtime/RuntimeSuiteTester.php: call to Behat\Behat\EventDispatcher\Tester\EventDispatchingFeatureTester->test()
    * line 73 of /vendor/behat/behat/src/Behat/Testwork/Hook/Tester/HookableSuiteTester.php: call to Behat\Testwork\Tester\Runtime\RuntimeSuiteTester->test()
    * line 75 of /vendor/behat/behat/src/Behat/Testwork/EventDispatcher/Tester/EventDispatchingSuiteTester.php: call to Behat\Testwork\Hook\Tester\HookableSuiteTester->test()
    * line 71 of /vendor/behat/behat/src/Behat/Testwork/Tester/Runtime/RuntimeExercise.php: call to Behat\Testwork\EventDispatcher\Tester\EventDispatchingSuiteTester->test()
    * line 73 of /vendor/behat/behat/src/Behat/Testwork/EventDispatcher/Tester/EventDispatchingExercise.php: call to Behat\Testwork\Tester\Runtime\RuntimeExercise->test()
    * line 80 of /vendor/behat/behat/src/Behat/Testwork/Ordering/OrderedExercise.php: call to Behat\Testwork\EventDispatcher\Tester\EventDispatchingExercise->test()
    * line 149 of /vendor/behat/behat/src/Behat/Testwork/Tester/Cli/ExerciseController.php: call to Behat\Testwork\Ordering\OrderedExercise->test()
    * line 108 of /vendor/behat/behat/src/Behat/Testwork/Tester/Cli/ExerciseController.php: call to Behat\Testwork\Tester\Cli\ExerciseController->testSpecifications()
    * line 63 of /vendor/behat/behat/src/Behat/Testwork/Cli/Command.php: call to Behat\Testwork\Tester\Cli\ExerciseController->execute()
    * line 256 of /vendor/symfony/console/Command/Command.php: call to Behat\Testwork\Cli\Command->execute()
    * line 971 of /vendor/symfony/console/Application.php: call to Symfony\Component\Console\Command\Command->run()
    * line 290 of /vendor/symfony/console/Application.php: call to Symfony\Component\Console\Application->doRunCommand()
    * line 124 of /vendor/behat/behat/src/Behat/Testwork/Cli/Application.php: call to Symfony\Component\Console\Application->doRun()
    * line 166 of /vendor/symfony/console/Application.php: call to Behat\Testwork\Cli\Application->doRun()
    * line 34 of /vendor/behat/behat/bin/behat: call to Symfony\Component\Console\Application->run()

    In HttpCommandExecutor.php line 332:

      Curl error thrown for http DELETE to /session/8211fb5c-c8e9-4a3d-bdfa-a7a8bbf52d73/cookie

      Operation timed out after 30001 milliseconds with 0 bytes received

    behat [-s|--suite SUITE] [-f|--format FORMAT] [-o|--out OUT] [--format-settings FORMAT-SETTINGS] [--init] [--lang LANG] [--name NAME] [--tags TAGS] [--role ROLE] [--story-syntax] [-d|--definitions DEFINITIONS] [--snippets-for [SNIPPETS-FOR]] [--snippets-type SNIPPETS-TYPE] [--append-snippets] [--no-snippets] [--strict] [--order ORDER] [--skip-passed] [--rerun] [--stop-on-failure] [--dry-run] [--] [<paths>]

    Exit codes for each behat run:
    behatrun1: 1
    behatrun2: 1
    To re-run failed processes, you can use following command:
    php admin/tool/behat/cli/run.php --format="pretty" --out="report_behat_PROCNUM.txt" --format="junit" --out="junit_behat_PROCNUM" --replace="PROCNUM" --rerun
  stdout_lines: <omitted>
...ignoring

We will need to look at this more closely next month.

aspark21 commented 2 years ago

Turns out there was a separate issue in our pipeline separate from this causing the above. Now that it's fixed, I've re-tested the version bump https://github.com/aspark21/moodle-docker/commit/d4db6f5590aa67b450b0a9395115101d7cf81b7c and it worked :)

I would suggest making this another optional environment variable called MOODLE_DOCKER_SELENIUM_VERSION with the higher version the default. But if legacy or newer versions want a different one can simply define the desired one.

If the approach is sensible, I'll put together a PR for this next week.

stronk7 commented 2 years ago

For the records, this reminded me about #60 that would enable to quick switch to any version easily.

NeillM commented 2 years ago

It looks as though this may be needed to allow Moodle versions released after 15th October to run with FireFox, see #191

aspark21 commented 2 years ago

I have to admit I find the approach Dan took in #60 a bit more practical by only having one parameter to control both the browser & it's version.

If one is switching between Chrome & Firefox it seems likely the version would be changed at the same time. It is slightly more complex code wise but simpler to configure.

I'll look at rebasing, fixing up and testing that implementation.

stronk7 commented 2 years ago

Closed by #195, just merged.