on-demand release 4.0dev+
[moodle.git] / mod / data / tests / behat / data_activity_completion.feature
CommitLineData
1f2daaef
MH
1@mod @mod_data @core_completion
2Feature: 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:
776f4bd8
AN
13 | fullname | shortname | enablecompletion | showcompletionconditions |
14 | Course 1 | C1 | 1 | 1 |
1f2daaef
MH
15 And the following "course enrolments" exist:
16 | user | course | role |
17 | student1 | C1 | student |
18 | teacher1 | C1 | editingteacher |
1f2daaef 19 And the following "activity" exists:
776f4bd8
AN
20 | activity | data |
21 | course | C1 |
22 | idnumber | mh1 |
23 | name | Music history |
24 | section | 1 |
25 | completionentriesenabled | 1 |
26 | completionentries | 2 |
27 Given I am on the "Music history" "data activity editing" page logged in as teacher1
1f2daaef
MH
28 And I expand all fieldsets
29 And I set the following fields to these values:
30 | Aggregate type | Average of ratings |
31 | scale[modgrade_type] | Point |
32 | scale[modgrade_point] | 100 |
33 | Completion tracking | Show activity as complete when conditions are met |
34 | Require view | 1 |
35 | Require grade | 1 |
1f2daaef
MH
36 And I press "Save and display"
37 And I add a "Text input" field to "Music history" database and I fill the form with:
38 | Field name | Instrument types |
6c0e1eee 39 And I navigate to "Templates" in current page administration
242ec086 40 And I press "Save template"
1f2daaef
MH
41 And I log out
42
43 Scenario: View automatic completion items as a teacher and confirm all tabs display conditions
776f4bd8 44 Given I am on the "Music history" "data activity" page logged in as teacher1
1f2daaef
MH
45 Then "Music history" should have the "View" completion condition
46 And "Music history" should have the "Make entries: 2" completion condition
47 And "Music history" should have the "Receive a grade" completion condition
6c0e1eee 48 And I select "Single view" from the "jump" singleselect
1f2daaef
MH
49 And "Music history" should have the "View" completion condition
50 And "Music history" should have the "Make entries: 2" completion condition
51 And "Music history" should have the "Receive a grade" completion condition
6c0e1eee 52 And I press "Add entry"
1f2daaef
MH
53 And "Music history" should have the "View" completion condition
54 And "Music history" should have the "Make entries: 2" completion condition
55 And "Music history" should have the "Receive a grade" completion condition
6c0e1eee
MG
56 And I set the following fields to these values:
57 | Instrument types | Hurdygurdy |
58 And I press "Save"
59 And I press "Export entries"
1f2daaef
MH
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
6c0e1eee 63 And I navigate to "Templates" in current page administration
1f2daaef
MH
64 And "Music history" should have the "View" completion condition
65 And "Music history" should have the "Make entries: 2" completion condition
66 And "Music history" should have the "Receive a grade" completion condition
6c0e1eee 67 And I navigate to "Fields" in current page administration
1f2daaef
MH
68 And "Music history" should have the "View" completion condition
69 And "Music history" should have the "Make entries: 2" completion condition
70 And "Music history" should have the "Receive a grade" completion condition
6c0e1eee 71 And I navigate to "Presets" in current page administration
1f2daaef
MH
72 And "Music history" should have the "View" completion condition
73 And "Music history" should have the "Make entries: 2" completion condition
74 And "Music history" should have the "Receive a grade" completion condition
75
76 Scenario: View automatic completion items as a student
776f4bd8 77 Given I am on the "Music history" "data activity" page logged in as student1
1f2daaef
MH
78 And the "View" completion condition of "Music history" is displayed as "done"
79 And the "Make entries: 2" completion condition of "Music history" is displayed as "todo"
80 And the "Receive a grade" completion condition of "Music history" is displayed as "todo"
81 And I am on "Course 1" course homepage
82 And I add an entry to "Music history" database with:
83 | Instrument types | Drums |
6c0e1eee 84 And I press "Save"
1f2daaef 85 # One entry is not enough to mark as complete.
6469e8c1 86 And the "View" completion condition of "Music history" is displayed as "done"
1f2daaef 87 And the "Make entries: 2" completion condition of "Music history" is displayed as "todo"
6469e8c1
MH
88 And the "Receive a grade" completion condition of "Music history" is displayed as "todo"
89 And I am on "Course 1" course homepage
90 And I add an entry to "Music history" database with:
91 | Instrument types | Hurdygurdy |
6c0e1eee 92 And I press "Save"
6469e8c1
MH
93 Then the "View" completion condition of "Music history" is displayed as "done"
94 And the "Make entries: 2" completion condition of "Music history" is displayed as "done"
95 And the "Receive a grade" completion condition of "Music history" is displayed as "todo"
1f2daaef 96 And I log out
776f4bd8
AN
97
98 And I am on the "Music history" "data activity" page logged in as teacher1
6c0e1eee 99 And I select "Single view" from the "jump" singleselect
1f2daaef
MH
100 And I set the field "rating" to "3"
101 And I press "Rate"
102 And I log out
776f4bd8
AN
103
104 When I am on the "Music history" "data activity" page logged in as student1
1f2daaef
MH
105 Then the "View" completion condition of "Music history" is displayed as "done"
106 And the "Make entries: 2" completion condition of "Music history" is displayed as "done"
107 And the "Receive a grade" completion condition of "Music history" is displayed as "done"
108 And I log out
776f4bd8 109 When I am on the "Course 1" course page logged in as teacher1
1f2daaef
MH
110 And "Vinnie Student1" user has completed "Music history" activity
111
112 @javascript
113 Scenario: Use manual completion
776f4bd8 114 Given I am on the "Music history" "data activity editing" page logged in as teacher1
1f2daaef
MH
115 And I expand all fieldsets
116 And I set the field "Completion tracking" to "Students can manually mark the activity as completed"
117 And I press "Save and display"
118 # Teacher view.
119 And the manual completion button for "Music history" should be disabled
120 And I log out
121 # Student view.
776f4bd8 122 When I am on the "Music history" "data activity" page logged in as student1
1f2daaef
MH
123 Then the manual completion button of "Music history" is displayed as "Mark as done"
124 And I toggle the manual completion state of "Music history"
125 And the manual completion button of "Music history" is displayed as "Done"