| 1 | efrain | 1 | @mod @mod_data @core_completion @javascript
 | 
        
           |  |  | 2 | Feature: View activity completion in the database activity
 | 
        
           |  |  | 3 |   In order to have visibility of database completion requirements
 | 
        
           |  |  | 4 |   As a student
 | 
        
           |  |  | 5 |   I need to be able to view my database completion progress
 | 
        
           |  |  | 6 |   | 
        
           |  |  | 7 |   Background:
 | 
        
           |  |  | 8 |     Given the following "users" exist:
 | 
        
           |  |  | 9 |       | username | firstname | lastname | email                |
 | 
        
           |  |  | 10 |       | student1 | Vinnie    | Student1 | student1@example.com |
 | 
        
           |  |  | 11 |       | teacher1 | Darrell   | Teacher1 | teacher1@example.com |
 | 
        
           |  |  | 12 |     And the following "courses" exist:
 | 
        
           |  |  | 13 |       | fullname | shortname | enablecompletion | showcompletionconditions |
 | 
        
           |  |  | 14 |       | Course 1 | C1        | 1                | 1                        |
 | 
        
           |  |  | 15 |     And the following "course enrolments" exist:
 | 
        
           |  |  | 16 |       | user | course | role           |
 | 
        
           |  |  | 17 |       | student1 | C1 | student        |
 | 
        
           |  |  | 18 |       | teacher1 | C1 | editingteacher |
 | 
        
           |  |  | 19 |     And the following "activity" exists:
 | 
        
           |  |  | 20 |       | activity                 | data          |
 | 
        
           |  |  | 21 |       | course                   | C1            |
 | 
        
           |  |  | 22 |       | idnumber                 | mh1           |
 | 
        
           |  |  | 23 |       | name                     | Music history |
 | 
        
           |  |  | 24 |       | section                  | 1             |
 | 
        
           |  |  | 25 |       | completionentriesenabled | 1             |
 | 
        
           |  |  | 26 |       | completionentries        | 2             |
 | 
        
           |  |  | 27 |     And the following "mod_data > fields" exist:
 | 
        
           |  |  | 28 |       | database | type | name             |
 | 
        
           |  |  | 29 |       | mh1      | text | Instrument types |
 | 
        
           |  |  | 30 |     And the following "mod_data > templates" exist:
 | 
        
           |  |  | 31 |       | database | name            |
 | 
        
           |  |  | 32 |       | mh1      | singletemplate  |
 | 
        
           |  |  | 33 |       | mh1      | listtemplate    |
 | 
        
           |  |  | 34 |       | mh1      | addtemplate     |
 | 
        
           |  |  | 35 |       | mh1      | asearchtemplate |
 | 
        
           |  |  | 36 |       | mh1      | rsstemplate     |
 | 
        
           |  |  | 37 |     Given I am on the "Music history" "data activity editing" page logged in as teacher1
 | 
        
           |  |  | 38 |     And I expand all fieldsets
 | 
        
           |  |  | 39 |     And I set the following fields to these values:
 | 
        
           |  |  | 40 |       | Aggregate type           | Average of ratings |
 | 
        
           |  |  | 41 |       | scale[modgrade_type]     | Point              |
 | 
        
           |  |  | 42 |       | scale[modgrade_point]    | 100                |
 | 
        
           |  |  | 43 |       | Add requirements         | 1                  |
 | 
        
           |  |  | 44 |       | View the activity        | 1                  |
 | 
        
           |  |  | 45 |       | Receive a grade          | 1                  |
 | 
        
           |  |  | 46 |       | Any grade                | 1                  |
 | 
        
           |  |  | 47 |     And I press "Save and display"
 | 
        
           |  |  | 48 |     And I log out
 | 
        
           |  |  | 49 |   | 
        
           | 1441 | ariadna | 50 |   Scenario: Database activity displays completion conditions to teachers
 | 
        
           | 1 | efrain | 51 | #   We add an entry to let the user change to a different view.
 | 
        
           |  |  | 52 |     Given the following "mod_data > entries" exist:
 | 
        
           |  |  | 53 |       | database | user     | Instrument types |
 | 
        
           |  |  | 54 |       | mh1      | teacher1 | Drums            |
 | 
        
           |  |  | 55 |     When I am on the "Music history" "data activity" page logged in as teacher1
 | 
        
           |  |  | 56 |     Then "Music history" should have the "View" completion condition
 | 
        
           |  |  | 57 |     And "Music history" should have the "Make entries: 2" completion condition
 | 
        
           |  |  | 58 |     And "Music history" should have the "Receive a grade" completion condition
 | 
        
           |  |  | 59 |     And I select "Single view" from the "jump" singleselect
 | 
        
           |  |  | 60 |     And "Music history" should have the "View" completion condition
 | 
        
           |  |  | 61 |     And "Music history" should have the "Make entries: 2" completion condition
 | 
        
           |  |  | 62 |     And "Music history" should have the "Receive a grade" completion condition
 | 
        
           |  |  | 63 |   | 
        
           | 1441 | ariadna | 64 |   Scenario: A student can complete an database activity by achieving a passing grade
 | 
        
           | 1 | efrain | 65 |     Given I am on the "Music history" "data activity" page logged in as student1
 | 
        
           |  |  | 66 |     And the "View" completion condition of "Music history" is displayed as "done"
 | 
        
           |  |  | 67 |     And the "Make entries: 2" completion condition of "Music history" is displayed as "todo"
 | 
        
           |  |  | 68 |     And the "Receive a grade" completion condition of "Music history" is displayed as "todo"
 | 
        
           |  |  | 69 |     And the following "mod_data > entries" exist:
 | 
        
           |  |  | 70 |       | database | user     | Instrument types |
 | 
        
           |  |  | 71 |       | mh1      | student1 | Drums            |
 | 
        
           |  |  | 72 |     And I am on "Course 1" course homepage
 | 
        
           |  |  | 73 |     # One entry is not enough to mark as complete.
 | 
        
           |  |  | 74 |     And the "View" completion condition of "Music history" is displayed as "done"
 | 
        
           |  |  | 75 |     And the "Make entries: 2" completion condition of "Music history" is displayed as "todo"
 | 
        
           |  |  | 76 |     And the "Receive a grade" completion condition of "Music history" is displayed as "todo"
 | 
        
           |  |  | 77 |     And the following "mod_data > entries" exist:
 | 
        
           |  |  | 78 |       | database | user     | Instrument types |
 | 
        
           |  |  | 79 |       | mh1      | student1 | Hurdygurdy       |
 | 
        
           |  |  | 80 |     And I am on "Course 1" course homepage
 | 
        
           |  |  | 81 |     Then the "View" completion condition of "Music history" is displayed as "done"
 | 
        
           |  |  | 82 |     And the "Make entries: 2" completion condition of "Music history" is displayed as "done"
 | 
        
           |  |  | 83 |     And the "Receive a grade" completion condition of "Music history" is displayed as "todo"
 | 
        
           |  |  | 84 |     And I log out
 | 
        
           |  |  | 85 |   | 
        
           |  |  | 86 |     And I am on the "Music history" "data activity" page logged in as teacher1
 | 
        
           |  |  | 87 |     And I select "Single view" from the "jump" singleselect
 | 
        
           |  |  | 88 |     And I set the field "rating" to "3"
 | 
        
           |  |  | 89 |     And I log out
 | 
        
           |  |  | 90 |   | 
        
           |  |  | 91 |     When I am on the "Music history" "data activity" page logged in as student1
 | 
        
           |  |  | 92 |     Then the "View" completion condition of "Music history" is displayed as "done"
 | 
        
           |  |  | 93 |     And the "Make entries: 2" completion condition of "Music history" is displayed as "done"
 | 
        
           |  |  | 94 |     And the "Receive a grade" completion condition of "Music history" is displayed as "done"
 | 
        
           |  |  | 95 |     And I log out
 | 
        
           |  |  | 96 |     When I am on the "Course 1" course page logged in as teacher1
 | 
        
           |  |  | 97 |     And "Vinnie Student1" user has completed "Music history" activity
 | 
        
           |  |  | 98 |   | 
        
           |  |  | 99 |   @javascript
 | 
        
           | 1441 | ariadna | 100 |   Scenario: A student can manually mark the data activity as done but a teacher cannot
 | 
        
           | 1 | efrain | 101 |     Given I am on the "Music history" "data activity editing" page logged in as teacher1
 | 
        
           |  |  | 102 |     And I expand all fieldsets
 | 
        
           |  |  | 103 |     And I set the field "Students must manually mark the activity as done" to "1"
 | 
        
           |  |  | 104 |     And I press "Save and display"
 | 
        
           |  |  | 105 |     # Teacher view.
 | 
        
           |  |  | 106 |     And the manual completion button for "Music history" should be disabled
 | 
        
           |  |  | 107 |     And I log out
 | 
        
           |  |  | 108 |     # Student view.
 | 
        
           |  |  | 109 |     When I am on the "Music history" "data activity" page logged in as student1
 | 
        
           |  |  | 110 |     Then the manual completion button of "Music history" is displayed as "Mark as done"
 | 
        
           |  |  | 111 |     And I toggle the manual completion state of "Music history"
 | 
        
           |  |  | 112 |     And the manual completion button of "Music history" is displayed as "Done"
 |