MDL-66946 quiz reports: incorrectly show teachers sometimes
[moodle.git] / mod / quiz / report / overview / tests / behat / basic.feature
CommitLineData
dae0ccfc 1@mod @mod_quiz @quiz @quiz_overview
10c4fce5
JB
2Feature: 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
6
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 |
25b225a9
RT
12 | student1 | S1 | Student1 | student1@example.com | S1000 |
13 | student2 | S2 | Student2 | student2@example.com | S2000 |
14 | student3 | S3 | Student3 | student3@example.com | S3000 |
10c4fce5
JB
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 |
3c4ff02e
SL
38 And user "student1" has attempted "Quiz 1" with responses:
39 | slot | response |
9b1fc262 40 | 1 | True |
3c4ff02e
SL
41 | 2 | False |
42 And user "student2" has attempted "Quiz 1" with responses:
43 | slot | response |
9b1fc262
SL
44 | 1 | True |
45 | 2 | True |
10c4fce5
JB
46
47 # Basic check of the Grades report
48 When I log in as "teacher1"
fdeeaff9 49 And I am on "Course 1" course homepage
10c4fce5 50 And I follow "Quiz 1"
e5287f9b 51 And I navigate to "Results > Grades" in current page administration
10c4fce5
JB
52 Then I should see "Attempts: 2"
53 # Check student1's grade
25b225a9 54 And I should see "25.00" in the "S1 Student1" "table_row"
10c4fce5 55 # And student2's grade
25b225a9 56 And I should see "100.00" in the "S2 Student2" "table_row"
10c4fce5
JB
57
58 # Check changing the form parameters
25b225a9 59 And I set the field "Attempts from" to "enrolled users who have not attempted the quiz"
10c4fce5 60 And I press "Show report"
4d325589 61 # Note: teachers should not appear in the report.
10c4fce5 62 # Check student3's grade
25b225a9 63 And I should see "-" in the "S3 Student3" "table_row"
10c4fce5 64
25b225a9 65 And I set the field "Attempts from" to "enrolled users who have, or have not, attempted the quiz"
10c4fce5
JB
66 And I press "Show report"
67 # Check student1's grade
25b225a9 68 And I should see "25.00" in the "S1 Student1" "table_row"
10c4fce5 69 # Check student2's grade
25b225a9 70 And I should see "100.00" in the "S2 Student2" "table_row"
4d325589
TH
71 # Check student3's grade
72 And I should see "-" in the "S3 Student3" "table_row"
10c4fce5 73
25b225a9 74 And I set the field "Attempts from" to "all users who have attempted the quiz"
10c4fce5
JB
75 And I press "Show report"
76 # Check student1's grade
25b225a9 77 And I should see "25.00" in the "S1 Student1" "table_row"
10c4fce5 78 # Check student2's grade
25b225a9 79 And I should see "100.00" in the "S2 Student2" "table_row"