1 |
efrain |
1 |
@availability @availability_completion
|
|
|
2 |
Feature: Confirm that availability_completion works with previous activity setting
|
|
|
3 |
In order to control student access to activities
|
|
|
4 |
As a teacher
|
|
|
5 |
I need to set completion conditions which prevent student access
|
|
|
6 |
|
|
|
7 |
Background:
|
|
|
8 |
Given the following "courses" exist:
|
|
|
9 |
| fullname | shortname | format | enablecompletion | numsections |
|
|
|
10 |
| Course 1 | C1 | topics | 1 | 5 |
|
|
|
11 |
And the following "users" exist:
|
|
|
12 |
| username |
|
|
|
13 |
| teacher1 |
|
|
|
14 |
And the following "course enrolments" exist:
|
|
|
15 |
| user | course | role |
|
|
|
16 |
| teacher1 | C1 | editingteacher |
|
|
|
17 |
Given the following "activities" exist:
|
|
|
18 |
| activity | name | intro | course | idnumber | groupmode | completion | section |
|
|
|
19 |
| page | Page1 | Page 1 description | C1 | page1 | 1 | 1 | 1 |
|
|
|
20 |
| page | Page Ignored 1 | Page Ignored | C1 | pagei1 | 1 | 0 | 1 |
|
|
|
21 |
| page | Page2 | Page 2 description | C1 | page2 | 1 | 1 | 3 |
|
|
|
22 |
| page | Page3 | Page 3 description | C1 | page3 | 1 | 1 | 4 |
|
|
|
23 |
|
|
|
24 |
@javascript
|
|
|
25 |
Scenario: Test condition with previous activity on an activity
|
|
|
26 |
Given I log in as "teacher1"
|
|
|
27 |
And I am on "Course 1" course homepage with editing mode on
|
|
|
28 |
|
|
|
29 |
# Set Page3 restriction to Previous Activity with completion.
|
|
|
30 |
When I open "Page3" actions menu
|
|
|
31 |
And I click on "Edit settings" "link" in the "Page3" activity
|
|
|
32 |
And I expand all fieldsets
|
|
|
33 |
And I click on "Add restriction..." "button"
|
|
|
34 |
And I click on "Activity completion" "button" in the "Add restriction..." "dialogue"
|
|
|
35 |
And I click on "Displayed if student doesn't meet this condition • Click to hide" "link"
|
|
|
36 |
And I set the field "Activity or resource" to "Previous activity with completion"
|
|
|
37 |
And I press "Save and return to course"
|
|
|
38 |
Then I should see "Not available unless: The previous activity with completion" in the "region-main" "region"
|
|
|
39 |
|
|
|
40 |
When I turn editing mode off
|
|
|
41 |
Then I should see "Not available unless: The activity Page2 is marked complete" in the "region-main" "region"
|
|
|
42 |
|
|
|
43 |
# Remove Page 2 and check Page3 depends now on Page1.
|
|
|
44 |
When I turn editing mode on
|
|
|
45 |
And I change window size to "large"
|
|
|
46 |
And I delete "Page2" activity
|
|
|
47 |
And I turn editing mode off
|
|
|
48 |
Then I should see "Not available unless: The activity Page1 is marked complete" in the "region-main" "region"
|
|
|
49 |
|
|
|
50 |
@javascript
|
|
|
51 |
Scenario: Test previous activity availability when duplicate an activity
|
|
|
52 |
Given I log in as "teacher1"
|
|
|
53 |
And I am on "Course 1" course homepage with editing mode on
|
|
|
54 |
|
|
|
55 |
# Set Page3 restriction to Previous Activity with completion.
|
|
|
56 |
When I open "Page3" actions menu
|
|
|
57 |
And I click on "Edit settings" "link" in the "Page3" activity
|
|
|
58 |
And I expand all fieldsets
|
|
|
59 |
And I click on "Add restriction..." "button"
|
|
|
60 |
And I click on "Activity completion" "button" in the "Add restriction..." "dialogue"
|
|
|
61 |
And I click on "Displayed if student doesn't meet this condition • Click to hide" "link"
|
|
|
62 |
And I set the field "Activity or resource" to "Previous activity with completion"
|
|
|
63 |
And I press "Save and return to course"
|
|
|
64 |
Then I should see "Not available unless: The previous activity with completion" in the "region-main" "region"
|
|
|
65 |
|
|
|
66 |
When I turn editing mode off
|
|
|
67 |
Then I should see "Not available unless: The activity Page2 is marked complete" in the "region-main" "region"
|
|
|
68 |
|
|
|
69 |
# Duplicate Page3.
|
|
|
70 |
When I turn editing mode on
|
|
|
71 |
And I duplicate "Page3" activity
|
|
|
72 |
And I turn editing mode off
|
|
|
73 |
Then I should see "Not available unless: The activity Page3 is marked complete" in the "region-main" "region"
|
|
|
74 |
|
|
|
75 |
@javascript
|
|
|
76 |
Scenario: Test previous activity availability when modify completion tacking
|
|
|
77 |
Given I log in as "teacher1"
|
|
|
78 |
And I am on "Course 1" course homepage with editing mode on
|
|
|
79 |
|
|
|
80 |
# Set Page3 restriction to Previous Activity with completion.
|
|
|
81 |
When I open "Page3" actions menu
|
|
|
82 |
And I click on "Edit settings" "link" in the "Page3" activity
|
|
|
83 |
And I expand all fieldsets
|
|
|
84 |
And I click on "Add restriction..." "button"
|
|
|
85 |
And I click on "Activity completion" "button" in the "Add restriction..." "dialogue"
|
|
|
86 |
And I click on "Displayed if student doesn't meet this condition • Click to hide" "link"
|
|
|
87 |
And I set the field "Activity or resource" to "Previous activity with completion"
|
|
|
88 |
And I press "Save and return to course"
|
|
|
89 |
Then I should see "Not available unless: The previous activity with completion" in the "region-main" "region"
|
|
|
90 |
|
|
|
91 |
When I turn editing mode off
|
|
|
92 |
Then I should see "Not available unless: The activity Page2 is marked complete" in the "region-main" "region"
|
|
|
93 |
|
|
|
94 |
# Test if I disable completion tracking on Page2 section 5 depends on Page2.
|
|
|
95 |
When I turn editing mode on
|
|
|
96 |
And I change window size to "large"
|
|
|
97 |
When I open "Page2" actions menu
|
|
|
98 |
And I click on "Edit settings" "link" in the "Page2" activity
|
|
|
99 |
And I set the following fields to these values:
|
|
|
100 |
| None | 1 |
|
|
|
101 |
And I press "Save and return to course"
|
|
|
102 |
When I turn editing mode off
|
|
|
103 |
Then I should see "Not available unless: The activity Page1 is marked complete" in the "region-main" "region"
|
|
|
104 |
|
|
|
105 |
@javascript
|
|
|
106 |
Scenario: Test condition with previous activity on a section
|
|
|
107 |
Given I log in as "teacher1"
|
|
|
108 |
And I am on "Course 1" course homepage with editing mode on
|
|
|
109 |
|
|
|
110 |
# Set section 4 restriction to Previous Activity with completion.
|
|
|
111 |
When I edit the section "4"
|
|
|
112 |
And I expand all fieldsets
|
|
|
113 |
And I click on "Add restriction..." "button"
|
|
|
114 |
And I click on "Activity completion" "button" in the "Add restriction..." "dialogue"
|
|
|
115 |
And I click on "Displayed if student doesn't meet this condition • Click to hide" "link"
|
|
|
116 |
And I set the field "Activity or resource" to "Previous activity with completion"
|
|
|
117 |
And I press "Save changes"
|
|
|
118 |
Then I should see "Not available unless: The previous activity with completion" in the "region-main" "region"
|
|
|
119 |
|
|
|
120 |
When I turn editing mode off
|
|
|
121 |
Then I should see "Not available unless: The activity Page2 is marked complete" in the "region-main" "region"
|
|
|
122 |
|
|
|
123 |
# Remove Page 2 and check Section 4 depends now on Page1.
|
|
|
124 |
When I am on "Course 1" course homepage with editing mode on
|
|
|
125 |
And I change window size to "large"
|
|
|
126 |
And I delete "Page2" activity
|
|
|
127 |
And I turn editing mode off
|
|
|
128 |
Then I should see "Not available unless: The activity Page1 is marked complete" in the "region-main" "region"
|
|
|
129 |
|
|
|
130 |
@javascript
|
|
|
131 |
Scenario: Test condition with previous activity on the first activity of the course
|
|
|
132 |
Given I log in as "teacher1"
|
|
|
133 |
And I am on "Course 1" course homepage with editing mode on
|
|
|
134 |
|
|
|
135 |
# Try to set Page1 restriction to Previous Activity with completion.
|
|
|
136 |
When I open "Page1" actions menu
|
|
|
137 |
And I click on "Edit settings" "link" in the "Page1" activity
|
|
|
138 |
And I expand all fieldsets
|
|
|
139 |
And I click on "Add restriction..." "button"
|
|
|
140 |
And I click on "Activity completion" "button" in the "Add restriction..." "dialogue"
|
|
|
141 |
And I click on "Displayed if student doesn't meet this condition • Click to hide" "link"
|
|
|
142 |
Then the "Activity or resource" select box should not contain "Previous activity with completion"
|
|
|
143 |
|
|
|
144 |
# Set Page2 restriction to Previous Activity with completion and delete Page1.
|
|
|
145 |
When I am on "Course 1" course homepage
|
|
|
146 |
When I open "Page2" actions menu
|
|
|
147 |
And I click on "Edit settings" "link" in the "Page2" activity
|
|
|
148 |
And I expand all fieldsets
|
|
|
149 |
And I click on "Add restriction..." "button"
|
|
|
150 |
And I click on "Activity completion" "button" in the "Add restriction..." "dialogue"
|
|
|
151 |
And I click on "Displayed if student doesn't meet this condition • Click to hide" "link"
|
|
|
152 |
And I set the field "Activity or resource" to "Previous activity with completion"
|
|
|
153 |
And I press "Save and return to course"
|
|
|
154 |
Then I should see "Not available unless: The previous activity with completion" in the "region-main" "region"
|
|
|
155 |
|
|
|
156 |
# Delete Page 1 and check than Page2 now depends on a missing activity (no previous activity found).
|
|
|
157 |
When I am on "Course 1" course homepage
|
|
|
158 |
And I delete "Page1" activity
|
|
|
159 |
And I turn editing mode off
|
|
|
160 |
Then I should see "Not available unless: The activity (Missing activity)" in the "region-main" "region"
|
|
|
161 |
|
|
|
162 |
@javascript
|
|
|
163 |
Scenario: Test previous activities on empty sections
|
|
|
164 |
Given I log in as "teacher1"
|
|
|
165 |
And I am on "Course 1" course homepage with editing mode on
|
|
|
166 |
And I change window size to "large"
|
|
|
167 |
|
|
|
168 |
# Set section 2 restriction to Previous Activity with completion.
|
|
|
169 |
When I edit the section "2"
|
|
|
170 |
And I expand all fieldsets
|
|
|
171 |
And I click on "Add restriction..." "button"
|
|
|
172 |
And I click on "Activity completion" "button" in the "Add restriction..." "dialogue"
|
|
|
173 |
And I click on "Displayed if student doesn't meet this condition • Click to hide" "link"
|
|
|
174 |
And I set the field "Activity or resource" to "Previous activity with completion"
|
|
|
175 |
And I press "Save changes"
|
|
|
176 |
Then I should see "Not available unless: The previous activity with completion" in the "region-main" "region"
|
|
|
177 |
|
|
|
178 |
And I turn editing mode off
|
|
|
179 |
And I should see "Not available unless: The activity Page1 is marked complete" in the "region-main" "region"
|
|
|
180 |
|
|
|
181 |
# Set section 5 restriction to Previous Activity with completion.
|
|
|
182 |
And I am on "Course 1" course homepage with editing mode on
|
|
|
183 |
And I edit the section "5"
|
|
|
184 |
And I expand all fieldsets
|
|
|
185 |
And I click on "Add restriction..." "button"
|
|
|
186 |
And I click on "Activity completion" "button" in the "Add restriction..." "dialogue"
|
|
|
187 |
And I click on "Displayed if student doesn't meet this condition • Click to hide" "link"
|
|
|
188 |
And I set the field "Activity or resource" to "Previous activity with completion"
|
|
|
189 |
And I press "Save changes"
|
|
|
190 |
And I should see "Not available unless: The previous activity with completion" in the "region-main" "region"
|
|
|
191 |
|
|
|
192 |
And I turn editing mode off
|
|
|
193 |
Then I should see "Not available unless: The activity Page3 is marked complete" in the "region-main" "region"
|
|
|
194 |
|
|
|
195 |
# Test if I disable completion tracking on Page3 section 5 depends on Page2.
|
|
|
196 |
And I am on "Course 1" course homepage with editing mode on
|
|
|
197 |
And I open "Page3" actions menu
|
|
|
198 |
And I click on "Edit settings" "link" in the "Page3" activity
|
|
|
199 |
And I set the following fields to these values:
|
|
|
200 |
| None | 1 |
|
|
|
201 |
And I press "Save and return to course"
|
|
|
202 |
|
|
|
203 |
And I turn editing mode off
|
|
|
204 |
And I should see "Not available unless: The activity Page2 is marked complete" in the "region-main" "region"
|