anthology-ally / moodle-report_allylti

1 stars 11 forks source link

Behat tests in view_report.feature fail with Firefox #11

Open leonstr opened 1 month ago

leonstr commented 1 month ago

For example with Moodle 4.3.5+ (Build: 20240705), report_allylti 2024060300 and firefox-115.12.0-1 on CentOS 9:

# vendor/bin/behat --config /var/www/beh_moodledata/behatrun/behat/behat.yml `pwd`/report/allylti/tests/behat/view_report.feature --profile=headlessfirefox
⋮
--- Failed steps:

001 Example: | classic |                                                            # /var/www/moodle/report/allylti/tests/behat/view_report.feature:76
    And I click on "Accessibility report" "link" in the "#settingsnav" "css_element" # /var/www/moodle/report/allylti/tests/behat/view_report.feature:65
        Css matching locator "#settingsnav" not found. (Behat\Mink\Exception\ElementNotFoundException)

This test does pass with Chrome (tested with google-chrome-stable-126.0.6478.126-1).

leonstr commented 1 month ago

I think this happens because line 64 of view_report.feature is:

    And I navigate to the course accessibility report

causes Accessibility report to be clicked which causes the report to open. But then the next line:

    And I click on "Accessibility report" "link" in the "#settingsnav" "css_element"

clicks Accessibility report a second time. Maybe in Chrome the report opens in a background tab so Accessibility report is in the active tab to click again, whereas in Firefox the focus moves to the new tab on the first click and so the Accessibility report isn't present to be clicked on again?

Two identical sequential requests when running this test with Chrome can be seen in the web server access log:

127.0.0.1 - - [09/Jul/2024:12:11:19 +0100] "GET /report/allylti/launch.php?reporttype=course&report=admin&course=194000 HTTP/1.1" 200 2340 "http://beh43.vm.ideapad/report/view.php?courseid=194000" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/126.0.0.0 Safari/537.36"
127.0.0.1 - - [09/Jul/2024:12:11:19 +0100] "POST /report/allylti/tests/fixtures/report.php HTTP/1.1" 200 117 "http://beh43.vm.ideapad/report/allylti/launch.php?reporttype=course&report=admin&course=194000" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/126.0.0.0 Safari/537.36"
127.0.0.1 - - [09/Jul/2024:12:11:19 +0100] "GET /report/allylti/launch.php?reporttype=course&report=admin&course=194000 HTTP/1.1" 200 2340 "http://beh43.vm.ideapad/report/view.php?courseid=194000" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/126.0.0.0 Safari/537.36"
127.0.0.1 - - [09/Jul/2024:12:11:19 +0100] "POST /report/allylti/tests/fixtures/report.php HTTP/1.1" 200 117 "http://beh43.vm.ideapad/report/allylti/launch.php?reporttype=course&report=admin&course=194000" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/126.0.0.0 Safari/537.36"