MDL-72827 quiz: Expand completion behat tests

- Update the behat tests to more precisely check the state in the completion report.
- Check combination of completion conditions with passing grade
This commit is contained in:
Peter Dias
2021-10-28 11:38:10 +08:00
parent cb2afc668d
commit 44d06f8218
2 changed files with 24 additions and 8 deletions
@@ -34,7 +34,7 @@ Feature: Set a quiz to be marked complete when the student uses all attempts all
| slot | response |
| 1 | False |
Scenario: student1 uses up both attempts without passing
Scenario Outline: Student attempts the quiz - pass and fails
When I log in as "student1"
And I am on "Course 1" course homepage
And the "Receive a grade" completion condition of "Test quiz name" is displayed as "done"
@@ -42,16 +42,16 @@ Feature: Set a quiz to be marked complete when the student uses all attempts all
And the "Receive a pass grade or complete all available attempts" completion condition of "Test quiz name" is displayed as "todo"
And I follow "Test quiz name"
And I press "Re-attempt quiz"
And I set the field "False" to "1"
And I set the field "<answer>" to "1"
And I press "Finish attempt ..."
And I press "Submit all and finish"
And I am on "Course 1" course homepage
Then the "Receive a grade" completion condition of "Test quiz name" is displayed as "done"
And the "Receive a passing grade" completion condition of "Test quiz name" is displayed as "failed"
And the "Receive a passing grade" completion condition of "Test quiz name" is displayed as "<passcompletionexpected>"
And the "Receive a pass grade or complete all available attempts" completion condition of "Test quiz name" is displayed as "done"
And I follow "Test quiz name"
And the "Receive a grade" completion condition of "Test quiz name" is displayed as "done"
And the "Receive a passing grade" completion condition of "Test quiz name" is displayed as "failed"
And the "Receive a passing grade" completion condition of "Test quiz name" is displayed as "<passcompletionexpected>"
And the "Receive a pass grade or complete all available attempts" completion condition of "Test quiz name" is displayed as "done"
And I log out
And I log in as "teacher1"
@@ -60,4 +60,9 @@ Feature: Set a quiz to be marked complete when the student uses all attempts all
And "Test quiz name" should have the "Receive a pass grade or complete all available attempts" completion condition
And I am on "Course 1" course homepage
And I navigate to "Reports > Activity completion" in current page administration
And "Completed" "icon" should exist in the "Student 1" "table_row"
And "<expectedactivitycompletion>" "icon" should exist in the "Student 1" "table_row"
Examples:
| answer | passcompletionexpected | expectedactivitycompletion |
| False | failed | Completed (did not achieve pass grade) |
| True | done | Completed (achieved pass grade) |
@@ -43,7 +43,7 @@ Feature: View activity completion in the quiz activity
| question | page |
| First question | 1 |
Scenario: View automatic completion items as a student
Scenario Outline: View automatic completion items as a student
When I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test quiz name"
@@ -63,12 +63,23 @@ Feature: View activity completion in the quiz activity
And the "Receive a passing grade" completion condition of "Test quiz name" is displayed as "failed"
And the "Receive a pass grade or complete all available attempts" completion condition of "Test quiz name" is displayed as "todo"
And I press "Re-attempt quiz"
And I set the field "True" to "1"
And I set the field "<answer>" to "1"
And I press "Finish attempt ..."
And I press "Submit all and finish"
And I follow "Finish review"
And the "View" completion condition of "Test quiz name" is displayed as "done"
And the "Make attempts: 1" completion condition of "Test quiz name" is displayed as "done"
And the "Receive a grade" completion condition of "Test quiz name" is displayed as "done"
And the "Receive a passing grade" completion condition of "Test quiz name" is displayed as "done"
And the "Receive a passing grade" completion condition of "Test quiz name" is displayed as "<passcompletionexpected>"
And the "Receive a pass grade or complete all available attempts" completion condition of "Test quiz name" is displayed as "done"
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Reports > Activity completion" in current page administration
And I pause
And "<expectedactivitycompletion>" "icon" should exist in the "Student 1" "table_row"
Examples:
| answer | passcompletionexpected | expectedactivitycompletion |
| False | failed | Completed (did not achieve pass grade) |
| True | done | Completed (achieved pass grade) |