MDL-71913 mod_folder: Add tertiary navigation
[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 |
39 And I follow "Templates"
40 And I press "Save template"
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
48 And I follow "View single"
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
52 And I follow "Search"
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
56 And I follow "Add entry"
57 And "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 "Export"
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 "Templates"
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 "Fields"
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 "Presets"
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
77 Scenario: View automatic completion items as a student
776f4bd8 78 Given I am on the "Music history" "data activity" page logged in as student1
1f2daaef
MH
79 And the "View" completion condition of "Music history" is displayed as "done"
80 And the "Make entries: 2" completion condition of "Music history" is displayed as "todo"
81 And the "Receive a grade" completion condition of "Music history" is displayed as "todo"
82 And I am on "Course 1" course homepage
83 And I add an entry to "Music history" database with:
84 | Instrument types | Drums |
85 And I press "Save and view"
86 # One entry is not enough to mark as complete.
6469e8c1 87 And the "View" completion condition of "Music history" is displayed as "done"
1f2daaef 88 And the "Make entries: 2" completion condition of "Music history" is displayed as "todo"
6469e8c1
MH
89 And the "Receive a grade" completion condition of "Music history" is displayed as "todo"
90 And I am on "Course 1" course homepage
91 And I add an entry to "Music history" database with:
92 | Instrument types | Hurdygurdy |
93 And I press "Save and view"
94 Then the "View" completion condition of "Music history" is displayed as "done"
95 And the "Make entries: 2" completion condition of "Music history" is displayed as "done"
96 And the "Receive a grade" completion condition of "Music history" is displayed as "todo"
1f2daaef 97 And I log out
776f4bd8
AN
98
99 And I am on the "Music history" "data activity" page logged in as teacher1
1f2daaef
MH
100 And I follow "View single"
101 And I set the field "rating" to "3"
102 And I press "Rate"
103 And I log out
776f4bd8
AN
104
105 When I am on the "Music history" "data activity" page logged in as student1
1f2daaef
MH
106 Then the "View" completion condition of "Music history" is displayed as "done"
107 And the "Make entries: 2" completion condition of "Music history" is displayed as "done"
108 And the "Receive a grade" completion condition of "Music history" is displayed as "done"
109 And I log out
776f4bd8 110 When I am on the "Course 1" course page logged in as teacher1
1f2daaef
MH
111 And "Vinnie Student1" user has completed "Music history" activity
112
113 @javascript
114 Scenario: Use manual completion
776f4bd8 115 Given I am on the "Music history" "data activity editing" page logged in as teacher1
1f2daaef
MH
116 And I expand all fieldsets
117 And I set the field "Completion tracking" to "Students can manually mark the activity as completed"
118 And I press "Save and display"
119 # Teacher view.
120 And the manual completion button for "Music history" should be disabled
121 And I log out
122 # Student view.
776f4bd8 123 When I am on the "Music history" "data activity" page logged in as student1
1f2daaef
MH
124 Then the manual completion button of "Music history" is displayed as "Mark as done"
125 And I toggle the manual completion state of "Music history"
126 And the manual completion button of "Music history" is displayed as "Done"