MDL-72179 behat: Add page resolvers for activity roles/perms
[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:
13 | fullname | shortname | category |
14 | Course 1 | C1 | 0 |
15 And the following "course enrolments" exist:
16 | user | course | role |
17 | student1 | C1 | student |
18 | teacher1 | C1 | editingteacher |
19 And I log in as "teacher1"
20 And I am on "Course 1" course homepage
21 And I navigate to "Edit settings" in current page administration
22 And I expand all fieldsets
23 And I set the following fields to these values:
24 | Enable completion tracking | Yes |
ad30fde4 25 | Show activity completion conditions | Yes |
1f2daaef
MH
26 And I press "Save and display"
27 And the following "activity" exists:
28 | activity | data |
29 | course | C1 |
30 | idnumber | mh1 |
31 | name | Music history |
32 | section | 1 |
33 And I am on "Course 1" course homepage
34 And I follow "Music history"
35 And I navigate to "Edit settings" in current page administration
36 And I expand all fieldsets
37 And I set the following fields to these values:
38 | Aggregate type | Average of ratings |
39 | scale[modgrade_type] | Point |
40 | scale[modgrade_point] | 100 |
41 | Completion tracking | Show activity as complete when conditions are met |
42 | Require view | 1 |
43 | Require grade | 1 |
44 | completionentriesenabled | 1 |
45 | completionentries | 2 |
46 And I press "Save and display"
47 And I add a "Text input" field to "Music history" database and I fill the form with:
48 | Field name | Instrument types |
49 And I follow "Templates"
50 And I press "Save template"
51 And I log out
52
53 Scenario: View automatic completion items as a teacher and confirm all tabs display conditions
54 Given I log in as "teacher1"
55 And I am on "Course 1" course homepage
56 When I follow "Music history"
57 Then "Music history" should have the "View" completion condition
58 And "Music history" should have the "Make entries: 2" completion condition
59 And "Music history" should have the "Receive a grade" completion condition
60 And I follow "View single"
61 And "Music history" should have the "View" completion condition
62 And "Music history" should have the "Make entries: 2" completion condition
63 And "Music history" should have the "Receive a grade" completion condition
64 And I follow "Search"
65 And "Music history" should have the "View" completion condition
66 And "Music history" should have the "Make entries: 2" completion condition
67 And "Music history" should have the "Receive a grade" completion condition
68 And I follow "Add entry"
69 And "Music history" should have the "View" completion condition
70 And "Music history" should have the "Make entries: 2" completion condition
71 And "Music history" should have the "Receive a grade" completion condition
72 And I follow "Export"
73 And "Music history" should have the "View" completion condition
74 And "Music history" should have the "Make entries: 2" completion condition
75 And "Music history" should have the "Receive a grade" completion condition
76 And I follow "Templates"
77 And "Music history" should have the "View" completion condition
78 And "Music history" should have the "Make entries: 2" completion condition
79 And "Music history" should have the "Receive a grade" completion condition
80 And I follow "Fields"
81 And "Music history" should have the "View" completion condition
82 And "Music history" should have the "Make entries: 2" completion condition
83 And "Music history" should have the "Receive a grade" completion condition
84 And I follow "Presets"
85 And "Music history" should have the "View" completion condition
86 And "Music history" should have the "Make entries: 2" completion condition
87 And "Music history" should have the "Receive a grade" completion condition
88
89 Scenario: View automatic completion items as a student
90 Given I log in as "student1"
91 And I am on "Course 1" course homepage
92 And I follow "Music history"
93 And 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 "todo"
95 And the "Receive a grade" completion condition of "Music history" is displayed as "todo"
96 And I am on "Course 1" course homepage
97 And I add an entry to "Music history" database with:
98 | Instrument types | Drums |
99 And I press "Save and view"
100 # One entry is not enough to mark as complete.
6469e8c1 101 And the "View" completion condition of "Music history" is displayed as "done"
1f2daaef 102 And the "Make entries: 2" completion condition of "Music history" is displayed as "todo"
6469e8c1
MH
103 And the "Receive a grade" completion condition of "Music history" is displayed as "todo"
104 And I am on "Course 1" course homepage
105 And I add an entry to "Music history" database with:
106 | Instrument types | Hurdygurdy |
107 And I press "Save and view"
108 Then the "View" completion condition of "Music history" is displayed as "done"
109 And the "Make entries: 2" completion condition of "Music history" is displayed as "done"
110 And the "Receive a grade" completion condition of "Music history" is displayed as "todo"
1f2daaef
MH
111 And I log out
112 And I log in as "teacher1"
113 And I am on "Course 1" course homepage
114 And I follow "Music history"
115 And I follow "View single"
116 And I set the field "rating" to "3"
117 And I press "Rate"
118 And I log out
119 When I log in as "student1"
120 And I am on "Course 1" course homepage
6469e8c1 121 And I follow "Music history"
1f2daaef
MH
122 Then the "View" completion condition of "Music history" is displayed as "done"
123 And the "Make entries: 2" completion condition of "Music history" is displayed as "done"
124 And the "Receive a grade" completion condition of "Music history" is displayed as "done"
125 And I log out
126 And I log in as "teacher1"
127 And I am on "Course 1" course homepage
128 And "Vinnie Student1" user has completed "Music history" activity
129
130 @javascript
131 Scenario: Use manual completion
132 Given I log in as "teacher1"
133 And I am on "Course 1" course homepage
134 And I follow "Music history"
135 And I navigate to "Edit settings" in current page administration
136 And I expand all fieldsets
137 And I set the field "Completion tracking" to "Students can manually mark the activity as completed"
138 And I press "Save and display"
139 # Teacher view.
140 And the manual completion button for "Music history" should be disabled
141 And I log out
142 # Student view.
143 When I log in as "student1"
144 And I am on "Course 1" course homepage
145 And I follow "Music history"
146 Then the manual completion button of "Music history" is displayed as "Mark as done"
147 And I toggle the manual completion state of "Music history"
148 And the manual completion button of "Music history" is displayed as "Done"