| 1 | efrain | 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
 | 
        
           |  |  | 6 |   | 
        
           |  |  | 7 |   Background:
 | 
        
           |  |  | 8 |     Given the "multilang" filter is "on"
 | 
        
           |  |  | 9 |     And the "multilang" filter applies to "content and headings"
 | 
        
           |  |  | 10 |     And the following "custom profile fields" exist:
 | 
        
           |  |  | 11 |       | datatype | shortname | name  |
 | 
        
           |  |  | 12 |       | text     | fruit     | Fruit |
 | 
        
           |  |  | 13 |     And the following "users" exist:
 | 
        
           |  |  | 14 |       | username | firstname | lastname | email                | idnumber | profile_field_fruit |
 | 
        
           |  |  | 15 |       | teacher1 | T1        | Teacher1 | teacher1@example.com | T1000    |                     |
 | 
        
           |  |  | 16 |       | student1 | S1        | Student1 | student1@example.com | S1000    | Apple               |
 | 
        
           |  |  | 17 |       | student2 | S2        | Student2 | student2@example.com | S2000    | Banana              |
 | 
        
           |  |  | 18 |       | student3 | S3        | Student3 | student3@example.com | S3000    | Pear                |
 | 
        
           |  |  | 19 |     And the following "courses" exist:
 | 
        
           |  |  | 20 |       | fullname | shortname | category |
 | 
        
           |  |  | 21 |       | Course 1 | C1        | 0        |
 | 
        
           |  |  | 22 |     And the following "course enrolments" exist:
 | 
        
           |  |  | 23 |       | user     | course | role           |
 | 
        
           |  |  | 24 |       | teacher1 | C1     | editingteacher |
 | 
        
           |  |  | 25 |       | student1 | C1     | student        |
 | 
        
           |  |  | 26 |       | student2 | C1     | student        |
 | 
        
           |  |  | 27 |       | student3 | C1     | student        |
 | 
        
           |  |  | 28 |     And the following "groups" exist:
 | 
        
           |  |  | 29 |       | course | idnumber | name    |
 | 
        
           |  |  | 30 |       | C1     | G1       | <span class="multilang" lang="en">English</span><span class="multilang" lang="es">Spanish</span> |
 | 
        
           |  |  | 31 |       | C1     | G2       | Group 2                                                                                          |
 | 
        
           |  |  | 32 |     And the following "group members" exist:
 | 
        
           |  |  | 33 |       | group | user     |
 | 
        
           |  |  | 34 |       | G1    | student1 |
 | 
        
           |  |  | 35 |       | G1    | student2 |
 | 
        
           |  |  | 36 |       | G2    | student3 |
 | 
        
           |  |  | 37 |     And the following "question categories" exist:
 | 
        
           |  |  | 38 |       | contextlevel | reference | name           |
 | 
        
           |  |  | 39 |       | Course       | C1        | Test questions |
 | 
        
           |  |  | 40 |     And the following "activities" exist:
 | 
        
           |  |  | 41 |       | activity   | name   | intro              | course | idnumber | groupmode |
 | 
        
           |  |  | 42 |       | quiz       | Quiz 1 | Quiz 1 description | C1     | quiz1    | 2         |
 | 
        
           |  |  | 43 |     And the following "questions" exist:
 | 
        
           |  |  | 44 |       | questioncategory | qtype       | name  | questiontext         |
 | 
        
           |  |  | 45 |       | Test questions   | description | Intro | Welcome to this quiz |
 | 
        
           |  |  | 46 |       | Test questions   | truefalse   | TF1   | First question       |
 | 
        
           |  |  | 47 |       | Test questions   | truefalse   | TF2   | Second question      |
 | 
        
           |  |  | 48 |     And quiz "Quiz 1" contains the following questions:
 | 
        
           | 11 | efrain | 49 |       | question | page | maxmark | displaynumber |
 | 
        
           |  |  | 50 |       | Intro    | 1    |         |               |
 | 
        
           |  |  | 51 |       | TF1      | 1    |         |               |
 | 
        
           |  |  | 52 |       | TF2      | 1    | 3.0     | 2a            |
 | 
        
           | 1 | efrain | 53 |     And user "student1" has attempted "Quiz 1" with responses:
 | 
        
           |  |  | 54 |       | slot | response |
 | 
        
           |  |  | 55 |       |   2  | True     |
 | 
        
           |  |  | 56 |       |   3  | False    |
 | 
        
           |  |  | 57 |     And user "student2" has attempted "Quiz 1" with responses:
 | 
        
           |  |  | 58 |       | slot | response |
 | 
        
           |  |  | 59 |       |   2  | True     |
 | 
        
           |  |  | 60 |       |   3  | True     |
 | 
        
           |  |  | 61 |   | 
        
           |  |  | 62 |   @javascript
 | 
        
           |  |  | 63 |   Scenario: Using the Grades report
 | 
        
           |  |  | 64 |     # Basic check of the Grades report
 | 
        
           |  |  | 65 |     When I am on the "Quiz 1" "quiz activity" page logged in as teacher1
 | 
        
           |  |  | 66 |     And I navigate to "Results" in current page administration
 | 
        
           |  |  | 67 |     Then I should see "Attempts: 2"
 | 
        
           |  |  | 68 |   | 
        
           |  |  | 69 |     # Verify that the right columns are visible
 | 
        
           |  |  | 70 |     And I should see "Q. 1"
 | 
        
           | 11 | efrain | 71 |     And I should see "Q. 2a"
 | 
        
           | 1 | efrain | 72 |     And I should not see "Q. 3"
 | 
        
           |  |  | 73 |   | 
        
           |  |  | 74 |     # Check student1's grade
 | 
        
           |  |  | 75 |     And I should see "25.00" in the "S1 Student1" "table_row"
 | 
        
           |  |  | 76 |     # And student2's grade
 | 
        
           |  |  | 77 |     And I should see "100.00" in the "S2 Student2" "table_row"
 | 
        
           |  |  | 78 |   | 
        
           |  |  | 79 |     # Check changing the form parameters
 | 
        
           | 1441 | ariadna | 80 |     And I set the field "Attempts from" to "enrolled users who do not have a quiz attempt"
 | 
        
           | 1 | efrain | 81 |     And I press "Show report"
 | 
        
           |  |  | 82 |     # Note: teachers should not appear in the report.
 | 
        
           |  |  | 83 |     # Check student3's grade
 | 
        
           |  |  | 84 |     And I should see "-" in the "S3 Student3" "table_row"
 | 
        
           |  |  | 85 |   | 
        
           | 1441 | ariadna | 86 |     And I set the field "Attempts from" to "enrolled users who have, or do not have, a quiz attempt"
 | 
        
           | 1 | efrain | 87 |     And I press "Show report"
 | 
        
           |  |  | 88 |     # Check student1's grade
 | 
        
           |  |  | 89 |     And I should see "25.00" in the "S1 Student1" "table_row"
 | 
        
           |  |  | 90 |     # Check student2's grade
 | 
        
           |  |  | 91 |     And I should see "100.00" in the "S2 Student2" "table_row"
 | 
        
           |  |  | 92 |     # Check student3's grade
 | 
        
           |  |  | 93 |     And I should see "-" in the "S3 Student3" "table_row"
 | 
        
           |  |  | 94 |   | 
        
           | 1441 | ariadna | 95 |     And I set the field "Attempts from" to "all users who have a quiz attempt"
 | 
        
           | 1 | efrain | 96 |     And I press "Show report"
 | 
        
           |  |  | 97 |     # Check student1's grade
 | 
        
           |  |  | 98 |     And I should see "25.00" in the "S1 Student1" "table_row"
 | 
        
           |  |  | 99 |     # Check student2's grade
 | 
        
           |  |  | 100 |     And I should see "100.00" in the "S2 Student2" "table_row"
 | 
        
           |  |  | 101 |   | 
        
           |  |  | 102 |     # Verify groups are displayed correctly.
 | 
        
           |  |  | 103 |     And I set the field "Visible groups" to "English"
 | 
        
           |  |  | 104 |     And I should see "Number of students in group 'English' achieving grade ranges"
 | 
        
           |  |  | 105 |   | 
        
           |  |  | 106 |   @javascript
 | 
        
           |  |  | 107 |   Scenario: View custom user profile fields in the grades report
 | 
        
           |  |  | 108 |     Given the following config values are set as admin:
 | 
        
           |  |  | 109 |       | showuseridentity | email,profile_field_fruit |
 | 
        
           |  |  | 110 |     And I am on the "Quiz 1" "quiz activity" page logged in as teacher1
 | 
        
           |  |  | 111 |     And I navigate to "Results" in current page administration
 | 
        
           |  |  | 112 |     Then I should see "Apple" in the "S1 Student1" "table_row"
 | 
        
           |  |  | 113 |     And I should see "Banana" in the "S2 Student2" "table_row"
 |