MDL-63185 mod_quiz: replace existing tests to use new step
[moodle.git] / mod / quiz / report / overview / tests / behat / basic.feature
blobb879867746c37c0a2bf1704c5b3bd894fd1e3270
1 @mod @mod_quiz @quiz @quiz_overview
2 Feature: Basic use of the Grades report
3   In order to easily get an overview of quiz attempts
4   As a teacher
5   I need to use the Grades report
7   @javascript
8   Scenario: Using the Grades report
9     Given the following "users" exist:
10       | username | firstname | lastname | email                | idnumber |
11       | teacher1 | T1        | Teacher1 | teacher1@example.com | T1000    |
12       | student1 | S1        | Student1 | student1@example.com | S1000    |
13       | student2 | S2        | Student2 | student2@example.com | S2000    |
14       | student3 | S3        | Student3 | student3@example.com | S3000    |
15     And the following "courses" exist:
16       | fullname | shortname | category |
17       | Course 1 | C1        | 0        |
18     And the following "course enrolments" exist:
19       | user     | course | role           |
20       | teacher1 | C1     | editingteacher |
21       | student1 | C1     | student        |
22       | student2 | C1     | student        |
23       | student3 | C1     | student        |
24     And the following "question categories" exist:
25       | contextlevel | reference | name           |
26       | Course       | C1        | Test questions |
27     And the following "activities" exist:
28       | activity   | name   | intro              | course | idnumber |
29       | quiz       | Quiz 1 | Quiz 1 description | C1     | quiz1    |
30     And the following "questions" exist:
31       | questioncategory | qtype       | name  | questiontext    |
32       | Test questions   | truefalse   | TF1   | First question  |
33       | Test questions   | truefalse   | TF2   | Second question |
34     And quiz "Quiz 1" contains the following questions:
35       | question | page | maxmark |
36       | TF1      | 1    |         |
37       | TF2      | 1    | 3.0     |
38     And user "student1" has attempted "Quiz 1" with responses:
39       | slot | response |
40       |   1  | True    |
41       |   2  | False    |
42     And user "student2" has attempted "Quiz 1" with responses:
43       | slot | response |
44       |   1  | True    |
45       |   2  | True    |
47     # Basic check of the Grades report
48     When I log in as "teacher1"
49     And I am on "Course 1" course homepage
50     And I follow "Quiz 1"
51     And I navigate to "Results > Grades" in current page administration
52     Then I should see "Attempts: 2"
53     # Check student1's grade
54     And I should see "25.00" in the "S1 Student1" "table_row"
55     # And student2's grade
56     And I should see "100.00" in the "S2 Student2" "table_row"
58     # Check changing the form parameters
59     And I set the field "Attempts from" to "enrolled users who have not attempted the quiz"
60     And I press "Show report"
61     # Check teacher1's grade
62     And I should see "-" in the "T1 Teacher1" "table_row"
63     # Check student3's grade
64     And I should see "-" in the "S3 Student3" "table_row"
66     And I set the field "Attempts from" to "enrolled users who have, or have not, attempted the quiz"
67     And I press "Show report"
68     # Check student1's grade
69     And I should see "25.00" in the "S1 Student1" "table_row"
70     # Check student2's grade
71     And I should see "100.00" in the "S2 Student2" "table_row"
72     # Check teacher1's grade
73     And I should see "-" in the "T1 Teacher1" "table_row"
75     And I set the field "Attempts from" to "all users who have attempted the quiz"
76     And I press "Show report"
77     # Check student1's grade
78     And I should see "25.00" in the "S1 Student1" "table_row"
79     # Check student2's grade
80     And I should see "100.00" in the "S2 Student2" "table_row"
82     # Check regrade and delete attempts.
83     And I set the field with xpath "//tr[contains(normalize-space(.), 'student1@example.com')]//input[@type='checkbox']" to "1"
84     And I press "Regrade selected attempts"
85     And I press "Continue"
86     And I should see "student1@example.com"
87     And I set the field with xpath "//tr[contains(normalize-space(.), 'student1@example.com')]//input[@type='checkbox']" to "1"
88     And I press "Delete selected attempts"
89     And I press "Yes"
90     And I should not see "student1@example.com"