Skip to content

Commit

Permalink
MDL-72698 behat: Reduce random lesson behat failures on slow envs
Browse files Browse the repository at this point in the history
In very slow environments viewing the lesson page for a student takes
more than 1 second and, because of this, the "Spend at least 1 sec"
completion condition is considered done.

So, in order to alleviate this problem, that leads to random failures
in CIs with slow databases, we have changed the condition to be 3
seconds instead.

That seems to do the work in super-slow environments, with 100
executions passing ok (when previously the scenario was failing 33%
of times).

The only cost is that now the behat run will be 2 seconds slower (there
is a wait changed from 2 to 4 seconds), but that's an acceptable
price to pay to get the scenarios consistent passing.

See the issue for more details.
  • Loading branch information
stronk7 committed Mar 19, 2022
1 parent 7bd1ca5 commit c74979a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions mod/lesson/tests/behat/lesson_activity_completion.feature
Expand Up @@ -27,7 +27,7 @@ Feature: View activity completion in the lesson activity
| completionusegrade | 1 |
| completionendreached | 1 |
| completiontimespentenabled | 1 |
| completiontimespent | 1 |
| completiontimespent | 3 |
And I am on the "Music history" "lesson activity" page logged in as teacher1
And I follow "Add a content page"
And I set the following fields to these values:
Expand All @@ -49,28 +49,28 @@ Feature: View activity completion in the lesson activity
Scenario: View automatic completion items as a teacher
When I am on the "Music history" "lesson activity" page logged in as teacher1
Then "Music history" should have the "View" completion condition
And "Music history" should have the "Spend at least 1 sec on this activity" completion condition
And "Music history" should have the "Spend at least 3 secs on this activity" completion condition
And "Music history" should have the "Go through the activity to the end" completion condition
And "Music history" should have the "Receive a grade" completion condition

Scenario: View automatic completion items as a student
Given I am on the "Music history" "lesson activity" page logged in as student1
And the "View" completion condition of "Music history" is displayed as "done"
And the "Spend at least 1 sec on this activity" completion condition of "Music history" is displayed as "todo"
And the "Spend at least 3 secs on this activity" completion condition of "Music history" is displayed as "todo"
And the "Go through the activity to the end" completion condition of "Music history" is displayed as "todo"
And the "Receive a grade" completion condition of "Music history" is displayed as "todo"
When I am on the "Music history" "lesson activity" page
And I wait "2" seconds
And I wait "4" seconds
And I reload the page
And the "View" completion condition of "Music history" is displayed as "done"
And the "Spend at least 1 sec on this activity" completion condition of "Music history" is displayed as "done"
And the "Spend at least 3 secs on this activity" completion condition of "Music history" is displayed as "done"
And the "Go through the activity to the end" completion condition of "Music history" is displayed as "todo"
And the "Receive a grade" completion condition of "Music history" is displayed as "todo"
And I press "The history of music part 1"
And I set the field "Your answer" to "Some drummers play with their sticks flipped around"
And I press "Submit"
Then the "View" completion condition of "Music history" is displayed as "done"
And the "Spend at least 1 sec on this activity" completion condition of "Music history" is displayed as "done"
And the "Spend at least 3 secs on this activity" completion condition of "Music history" is displayed as "done"
And the "Go through the activity to the end" completion condition of "Music history" is displayed as "done"
And the "Receive a grade" completion condition of "Music history" is displayed as "done"

Expand Down

0 comments on commit c74979a

Please sign in to comment.