-
Bug
-
Resolution: Unresolved
-
Minor
-
None
-
3.11.5, 4.0
-
MOODLE_311_STABLE, MOODLE_400_STABLE
While working on MDL-73824 and checking that localised floats are working ok, I'm getting some random failures with the "Change grading options in an H5P activity" scenario.
They are not caused because of the localised floats issue, so I've decided to create a separated issue to have them better tracked.
This is an example (scenarios can vary) of execution. Please ignore the commas in the floats output, they are originally dots.
008 Scenario: Default grading is max attempt grade # /Users/stronk7/git_moodle/moodle/mod/h5pactivity/tests/behat/grading_attempts.feature:50
|
Then the following should exist in the "user-grade" table: # /Users/stronk7/git_moodle/moodle/mod/h5pactivity/tests/behat/grading_attempts.feature:54
|
(//html/.//table[(./@id = 'user-grade' or contains(.//caption, 'user-grade') or contains(.//th, 'user-grade') or contains(concat(' ', normalize-space(@class), ' '), 'user-grade' ))])[1]/tbody/tr[descendant::th[normalize-space(.)='Awesome H5P package'] | descendant::td[normalize-space(.)='Awesome H5P package']]/child::*[position() = count((//html/.//table[(./@id = 'user-grade' or contains(.//caption, 'user-grade') or contains(.//th, 'user-grade') or contains(concat(' ', normalize-space(@class), ' '), 'user-grade' ))])[1]/thead/tr[1]/th[(normalize-space(.)='Grade' or a[normalize-space(text())='Grade'] or div[normalize-space(text())='Grade'])]/preceding-sibling::*) + 1][contains(normalize-space(.),'100,00')]
|
|
Column value matching locator "100,00" in "Awesome H5P package" row with column "Grade" not found. (Behat\Mink\Exception\ElementNotFoundException)
|
|
009 Scenario: Change setting to average attempt # /Users/stronk7/git_moodle/moodle/mod/h5pactivity/tests/behat/grading_attempts.feature:83
|
Then the following should exist in the "user-grade" table: # /Users/stronk7/git_moodle/moodle/mod/h5pactivity/tests/behat/grading_attempts.feature:90
|
(//html/.//table[(./@id = 'user-grade' or contains(.//caption, 'user-grade') or contains(.//th, 'user-grade') or contains(concat(' ', normalize-space(@class), ' '), 'user-grade' ))])[1]/tbody/tr[descendant::th[normalize-space(.)='Awesome H5P package'] | descendant::td[normalize-space(.)='Awesome H5P package']]/child::*[position() = count((//html/.//table[(./@id = 'user-grade' or contains(.//caption, 'user-grade') or contains(.//th, 'user-grade') or contains(concat(' ', normalize-space(@class), ' '), 'user-grade' ))])[1]/thead/tr[1]/th[(normalize-space(.)='Grade' or a[normalize-space(text())='Grade'] or div[normalize-space(text())='Grade'])]/preceding-sibling::*) + 1][contains(normalize-space(.),'33,33')]
|
|
Column value matching locator "33,33" in "Awesome H5P package" row with column "Grade" not found. (Behat\Mink\Exception\ElementNotFoundException)
|
|
010 Scenario: Reescale existing grades changing the maximum grade # /Users/stronk7/git_moodle/moodle/mod/h5pactivity/tests/behat/grading_attempts.feature:119
|
Then the following should exist in the "user-grade" table: # /Users/stronk7/git_moodle/moodle/mod/h5pactivity/tests/behat/grading_attempts.feature:127
|
(//html/.//table[(./@id = 'user-grade' or contains(.//caption, 'user-grade') or contains(.//th, 'user-grade') or contains(concat(' ', normalize-space(@class), ' '), 'user-grade' ))])[1]/tbody/tr[descendant::th[normalize-space(.)='Awesome H5P package'] | descendant::td[normalize-space(.)='Awesome H5P package']]/child::*[position() = count((//html/.//table[(./@id = 'user-grade' or contains(.//caption, 'user-grade') or contains(.//th, 'user-grade') or contains(concat(' ', normalize-space(@class), ' '), 'user-grade' ))])[1]/thead/tr[1]/th[(normalize-space(.)='Grade' or a[normalize-space(text())='Grade'] or div[normalize-space(text())='Grade'])]/preceding-sibling::*) + 1][contains(normalize-space(.),'33,33')]
|
|
Column value matching locator "33,33" in "Awesome H5P package" row with column "Grade" not found. (Behat\Mink\Exception\ElementNotFoundException)
|
|
011 Scenario: Change maximum grade without rescaling grade # /Users/stronk7/git_moodle/moodle/mod/h5pactivity/tests/behat/grading_attempts.feature:144
|
Then the following should exist in the "user-grade" table: # /Users/stronk7/git_moodle/moodle/mod/h5pactivity/tests/behat/grading_attempts.feature:152
|
(//html/.//table[(./@id = 'user-grade' or contains(.//caption, 'user-grade') or contains(.//th, 'user-grade') or contains(concat(' ', normalize-space(@class), ' '), 'user-grade' ))])[1]/tbody/tr[descendant::th[normalize-space(.)='Awesome H5P package'] | descendant::td[normalize-space(.)='Awesome H5P package']]/child::*[position() = count((//html/.//table[(./@id = 'user-grade' or contains(.//caption, 'user-grade') or contains(.//th, 'user-grade') or contains(concat(' ', normalize-space(@class), ' '), 'user-grade' ))])[1]/thead/tr[1]/th[(normalize-space(.)='Grade' or a[normalize-space(text())='Grade'] or div[normalize-space(text())='Grade'])]/preceding-sibling::*) + 1][contains(normalize-space(.),'33,33')]
|
|
Column value matching locator "33,33" in "Awesome H5P package" row with column "Grade" not found. (Behat\Mink\Exception\ElementNotFoundException)
|
Basically what happens (I've been able to "fix" it adding some "And I wait X seconds" steps... is that the "Correct one" attempt in the Background isn't processed properly.
So, at all effects the three attempts are incorrect ones, hence all the Scenarios looking for maximum or average grades don't work (all the attempts have grade = 0).
By adding a wait before clicking the correct option:
diff --git a/mod/h5pactivity/tests/behat/grading_attempts.feature b/mod/h5pactivity/tests/behat/grading_attempts.feature
|
index 8a15df362f2..206f3856e1d 100644
|
--- a/mod/h5pactivity/tests/behat/grading_attempts.feature
|
+++ b/mod/h5pactivity/tests/behat/grading_attempts.feature
|
@@ -34,6 +34,7 @@ Feature: Change grading options in an H5P activity
|
And I click on "Wrong one" "text" in the ".h5p-question-content" "css_element"
|
And I click on "Check" "button" in the ".h5p-question-buttons" "css_element"
|
And I click on "Retry" "button" in the ".h5p-question-buttons" "css_element"
|
+ And I wait "1" seconds
|
And I click on "Correct one" "text" in the ".h5p-question-content" "css_element"
|
And I click on "Check" "button" in the ".h5p-question-buttons" "css_element"
|
And I switch to the main frame
|
I get all the correct attempts properly recorded and all the scenarios in the feature passing consistently:
$ br --profile chrome --suite default --name 'Change grading options in an H5P activity'
|
|
Command: vendor/bin/behat --config /Users/stronk7/Sites/moodle_data_git/master/postgres_behat/behatrun/behat/behat.yml --profile chrome --suite default --name 'Change grading options in an H5P activity'
|
|
Moodle 4.0dev+ (Build: 20220218), fc541ea65954411461642cd0aec39f8d206c46eb
|
Php: 8.0.15, pgsql: 13.5, OS: Darwin 20.6.0 x86_64
|
Run optional tests:
|
- Accessibility: No
|
Server OS "Darwin", Browser: "chrome"
|
Started at 20-02-2022, 17:48
|
...................................................................... 70
|
...................................................................... 140
|
...................................................................... 210
|
...................................................................... 280
|
..
|
|
8 escenarios (8 pasaron)
|
282 pasos (282 pasaron)
|
3m35.81s (56.37Mb)
|
So, it's like something happens before the H5P is really available to accept a new click or so. I'm not saying that the solution is the "wait" (it's ugly), but it shows that something is happening too quick for all the attempts to be played as expected.
Reproduced with headed Chrome.
- Discovered while testing
-
MDL-73824 Decimal comma & PHP8.0
- Closed