Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
@core @core_course @core_courseformat
2
Feature: Course index depending on role
3
  In order to quickly access the course structure
4
  As a user
5
  I need to see the current course structure in the course index.
6
 
7
  Background:
8
    Given the following "users" exist:
9
      | username | firstname | lastname | email                |
10
      | teacher1 | Teacher   | 1        | teacher1@example.com |
11
      | student1 | Student   | 1        | student1@example.com |
12
    And the following "course" exists:
13
      | fullname         | Course 1 |
14
      | shortname        | C1       |
15
      | category         | 0        |
16
      | enablecompletion | 1        |
17
      | numsections      | 4        |
18
      | initsections     | 1        |
19
    And the following "activities" exist:
20
      | activity | name                | intro                       | course | idnumber | section |
21
      | assign   | Activity sample 1   | Test assignment description | C1     | sample1  | 1       |
22
      | book     | Activity sample 2   |                             | C1     | sample2  | 2       |
23
      | choice   | Activity sample 3   | Test choice description     | C1     | sample3  | 3       |
24
    And the following "course enrolments" exist:
25
      | user     | course | role           |
26
      | student1 | C1     | student        |
27
      | teacher1 | C1     | editingteacher |
28
    # The course index is hidden by default in small devices.
29
    And I change window size to "large"
30
 
31
  @javascript
32
  Scenario: Course index is present on course pages.
33
    Given I am on the "C1" "Course" page logged in as "teacher1"
34
    And the "multilang" filter is "on"
35
    And the "multilang" filter applies to "content and headings"
36
#    Course index is visible on Course main page
37
    When I am on the "C1" "Course" page logged in as "teacher1"
38
    And "courseindex-content" "region" should be visible
39
#    Course index is visible on Settings page
40
    And I am on the "C1" "course editing" page
41
    And "courseindex-content" "region" should be visible
42
#    Course index is visible on Participants page
43
    And I am on the "C1" "enrolled users" page
44
    And "courseindex-content" "region" should be visible
45
#    Course index is visible on Enrolment methods page
46
    And I am on the "C1" "enrolment methods" page
47
    And "courseindex-content" "region" should be visible
48
#    Course index is visible on Groups page
49
    And I am on the "C1" "groups" page
50
    And "courseindex-content" "region" should be visible
51
#    Course index is visible on Permissions page
52
    And I am on the "C1" "permissions" page
53
    And "courseindex-content" "region" should be visible
54
#    Course index is visible on Activity edition page
55
    And I am on the "Activity sample 1" "assign activity editing" page
56
    And "courseindex-content" "region" should be visible
57
    And I set the field "Assignment name" in the "General" "fieldset" to "<span lang=\"en\" class=\"multilang\">Activity</span><span lang=\"de\" class=\"multilang\">Aktivität</span> sample 1"
58
    And I press "Save and display"
59
#    Course index is visible on Activity page
60
    And "courseindex-content" "region" should be visible
61
    And I should see "Activity sample 1" in the "courseindex-content" "region"
62
 
63
  @javascript
64
  Scenario: Course index as a teacher
65
    Given I log in as "teacher1"
66
    When I am on "Course 1" course homepage
67
    Then I should see "Section 1" in the "courseindex-content" "region"
68
    And I should see "Section 2" in the "courseindex-content" "region"
69
    And I should see "Section 3" in the "courseindex-content" "region"
70
    And I should see "Activity sample 1" in the "courseindex-content" "region"
71
    And I should see "Activity sample 2" in the "courseindex-content" "region"
72
    And I should see "Activity sample 3" in the "courseindex-content" "region"
73
 
74
  @javascript
75
  Scenario: Teacher can see hiden activities and sections
76
    Given I log in as "admin"
77
    And I am on "Course 1" course homepage with editing mode on
78
    And I hide section "2"
79
    And I open "Activity sample 3" actions menu
80
    And I choose "Hide" in the open action menu
81
    And I log out
82
    And I log in as "teacher1"
83
    When I am on "Course 1" course homepage
84
    Then I should see "Section 1" in the "courseindex-content" "region"
85
    And I should see "Section 2" in the "courseindex-content" "region"
86
    And I should see "Section 3" in the "courseindex-content" "region"
87
    And I should see "Activity sample 1" in the "courseindex-content" "region"
88
    And I should see "Activity sample 2" in the "courseindex-content" "region"
89
    And I should see "Activity sample 3" in the "courseindex-content" "region"
90
 
91
  @javascript
92
  Scenario: Students can only see visible activies and sections
93
    Given I log in as "admin"
94
    And I am on "Course 1" course homepage with editing mode on
95
    And I hide section "2"
96
    And I open "Activity sample 3" actions menu
97
    And I choose "Hide" in the open action menu
98
    And I log out
99
    And I log in as "student1"
100
    When I am on "Course 1" course homepage
101
    Then I should see "Section 1" in the "courseindex-content" "region"
102
    And I should not see "Section 2" in the "courseindex-content" "region"
103
    And I should see "Section 3" in the "courseindex-content" "region"
104
    And I should see "Activity sample 1" in the "courseindex-content" "region"
105
    And I should not see "Activity sample 2" in the "courseindex-content" "region"
106
    And I should not see "Activity sample 3" in the "courseindex-content" "region"
107
 
108
  @javascript
109
  Scenario: Delete an activity as a teacher
110
    Given I log in as "teacher1"
111
    And I am on "Course 1" course homepage with editing mode on
112
    When I delete "Activity sample 2" activity
113
    Then I should not see "Activity sample 2" in the "courseindex-content" "region"
114
 
115
  @javascript
116
  Scenario: Highlight sections are represented in the course index.
117
    Given I log in as "teacher1"
118
    And I am on "Course 1" course homepage with editing mode on
119
    And I turn section "2" highlighting on
120
    # Current section is only marked visually in the course index.
121
    And the "class" attribute of "#courseindex-content [data-for='section'][data-number='2']" "css_element" should contain "current"
122
    And I should not see "Highlighted" in the "#courseindex-content [data-for='section'][data-number='1']" "css_element"
123
    And I should see "Highlighted" in the "#courseindex-content [data-for='section'][data-number='2']" "css_element"
124
    When I turn section "1" highlighting on
125
    # Current section is only marked visually in the course index.
126
    Then the "class" attribute of "#courseindex-content [data-for='section'][data-number='1']" "css_element" should contain "current"
127
    And I should see "Highlighted" in the "#courseindex-content [data-for='section'][data-number='1']" "css_element"
128
    And I should not see "Highlighted" in the "#courseindex-content [data-for='section'][data-number='2']" "css_element"
129
 
130
  @javascript
131
  Scenario: Course index toggling
132
    Given the following "activities" exist:
133
      | activity | name                         | course | idnumber | section |
134
      | book     | Second activity in section 1 | C1     | sample4  | 1       |
135
    When I am on the "Course 1" course page logged in as teacher1
136
    # Sections should be opened by default.
137
    Then I should see "Section 1" in the "courseindex-content" "region"
138
    And I should see "Activity sample 1" in the "courseindex-content" "region"
139
    And I should see "Second activity in section 1" in the "courseindex-content" "region"
140
    And I should see "Section 2" in the "courseindex-content" "region"
141
    And I should see "Activity sample 2" in the "courseindex-content" "region"
142
    And I should see "Section 3" in the "courseindex-content" "region"
143
    And I should see "Activity sample 3" in the "courseindex-content" "region"
144
    # Collapse a section 1 via chevron.
145
    And I click on "Collapse" "link" in the ".courseindex-section[data-number='1']" "css_element"
146
    And I should see "Section 1" in the "courseindex-content" "region"
147
    And I should not see "Activity sample 1" in the "courseindex-content" "region"
148
    And I should not see "Second activity in section 1" in the "courseindex-content" "region"
149
    And I should see "Section 2" in the "courseindex-content" "region"
150
    And I should see "Activity sample 2" in the "courseindex-content" "region"
151
    And I should see "Section 3" in the "courseindex-content" "region"
152
    And I should see "Activity sample 3" in the "courseindex-content" "region"
153
    # Expand section 1 via section name.
154
    And I click on "Section 1" "link" in the "courseindex-content" "region"
155
    And I should see "Section 1" in the "courseindex-content" "region"
156
    And I should see "Activity sample 1" in the "courseindex-content" "region"
157
    And I should see "Second activity in section 1" in the "courseindex-content" "region"
158
    And I should see "Section 2" in the "courseindex-content" "region"
159
    And I should see "Activity sample 2" in the "courseindex-content" "region"
160
    And I should see "Section 3" in the "courseindex-content" "region"
161
    And I should see "Activity sample 3" in the "courseindex-content" "region"
162
    # Collapse a section 2 via chevron.
163
    And I click on "Collapse" "link" in the ".courseindex-section[data-number='2']" "css_element"
164
    And I should see "Section 1" in the "courseindex-content" "region"
165
    And I should see "Activity sample 1" in the "courseindex-content" "region"
166
    And I should see "Second activity in section 1" in the "courseindex-content" "region"
167
    And I should see "Section 2" in the "courseindex-content" "region"
168
    And I should not see "Activity sample 2" in the "courseindex-content" "region"
169
    And I should see "Section 3" in the "courseindex-content" "region"
170
    And I should see "Activity sample 3" in the "courseindex-content" "region"
171
    # Expand section 2 via chevron.
172
    And I click on "Expand" "link" in the ".courseindex-section[data-number='2']" "css_element"
173
    And I should see "Section 1" in the "courseindex-content" "region"
174
    And I should see "Activity sample 1" in the "courseindex-content" "region"
175
    And I should see "Second activity in section 1" in the "courseindex-content" "region"
176
    And I should see "Section 2" in the "courseindex-content" "region"
177
    And I should see "Activity sample 2" in the "courseindex-content" "region"
178
    And I should see "Section 3" in the "courseindex-content" "region"
179
    And I should see "Activity sample 3" in the "courseindex-content" "region"
180
    # Click a section name does not collapse the section.
181
    And I click on "Section 2" "link" in the "courseindex-content" "region"
182
    And I should see "Section 1" in the "courseindex-content" "region"
183
    And I should see "Activity sample 1" in the "courseindex-content" "region"
184
    And I should see "Second activity in section 1" in the "courseindex-content" "region"
185
    And I should see "Section 2" in the "courseindex-content" "region"
186
    And I should see "Activity sample 2" in the "courseindex-content" "region"
187
    And I should see "Section 3" in the "courseindex-content" "region"
188
    And I should see "Activity sample 3" in the "courseindex-content" "region"
189
 
190
  @javascript
191
  Scenario: Course index toggling all sections
192
    When I am on the "Course 1" course page logged in as teacher1
193
    # Sections should be opened by default.
194
    Then I should see "Section 1" in the "courseindex-content" "region"
195
    And I should see "Activity sample 1" in the "courseindex-content" "region"
196
    And I should see "Section 2" in the "courseindex-content" "region"
197
    And I should see "Activity sample 2" in the "courseindex-content" "region"
198
    And I should see "Section 3" in the "courseindex-content" "region"
199
    And I should see "Activity sample 3" in the "courseindex-content" "region"
200
    # Collapse all sections
201
    And I click on "Course index options" "button" in the "#courseindexdrawercontrols" "css_element"
202
    And I click on "Collapse all" "link" in the "#courseindexdrawercontrols" "css_element"
203
    And I should see "Section 1" in the "courseindex-content" "region"
204
    And I should not see "Activity sample 1" in the "courseindex-content" "region"
205
    And I should see "Section 2" in the "courseindex-content" "region"
206
    And I should not see "Activity sample 2" in the "courseindex-content" "region"
207
    And I should see "Section 3" in the "courseindex-content" "region"
208
    And I should not see "Activity sample 3" in the "courseindex-content" "region"
209
    # Expand all sections
210
    And I click on "Course index options" "button" in the "#courseindexdrawercontrols" "css_element"
211
    And I click on "Expand all" "link" in the "#courseindexdrawercontrols" "css_element"
212
    And I should see "Section 1" in the "courseindex-content" "region"
213
    And I should see "Activity sample 1" in the "courseindex-content" "region"
214
    And I should see "Section 2" in the "courseindex-content" "region"
215
    And I should see "Activity sample 2" in the "courseindex-content" "region"
216
    And I should see "Section 3" in the "courseindex-content" "region"
217
    And I should see "Activity sample 3" in the "courseindex-content" "region"
218
 
219
  @javascript
220
  Scenario: Course index section preferences
221
    When I am on the "C1" "Course" page logged in as "teacher1"
222
    Then I should see "Section 1" in the "courseindex-content" "region"
223
    And I should see "Activity sample 1" in the "courseindex-content" "region"
224
    And I should see "Section 2" in the "courseindex-content" "region"
225
    And I should see "Activity sample 2" in the "courseindex-content" "region"
226
    And I should see "Section 3" in the "courseindex-content" "region"
227
    And I should see "Activity sample 3" in the "courseindex-content" "region"
228
    # Collapse section 1.
229
    And I click on "Collapse" "link" in the ".courseindex-section[data-number='1']" "css_element"
230
    And I reload the page
231
    And I should see "Section 1" in the "courseindex-content" "region"
232
    And I should not see "Activity sample 1" in the "courseindex-content" "region"
233
    And I should see "Section 2" in the "courseindex-content" "region"
234
    And I should see "Activity sample 2" in the "courseindex-content" "region"
235
    And I should see "Section 3" in the "courseindex-content" "region"
236
    And I should see "Activity sample 3" in the "courseindex-content" "region"
237
    # Collapse section 3.
238
    And I click on "Collapse" "link" in the ".courseindex-section[data-number='3']" "css_element"
239
    And I reload the page
240
    And I should see "Section 1" in the "courseindex-content" "region"
241
    And I should not see "Activity sample 1" in the "courseindex-content" "region"
242
    And I should see "Section 2" in the "courseindex-content" "region"
243
    And I should see "Activity sample 2" in the "courseindex-content" "region"
244
    And I should see "Section 3" in the "courseindex-content" "region"
245
    And I should not see "Activity sample 3" in the "courseindex-content" "region"
246
    # Delete section 1
247
    And I turn editing mode on
248
    And I delete section "1"
249
    And I click on "Delete" "button" in the ".modal" "css_element"
250
    And I reload the page
251
    And I should not see "Activity sample 1" in the "courseindex-content" "region"
252
    And I should see "Section 2" in the "courseindex-content" "region"
253
    And I should see "Activity sample 2" in the "courseindex-content" "region"
254
    And I should see "Section 3" in the "courseindex-content" "region"
255
    And I should not see "Activity sample 3" in the "courseindex-content" "region"
256
 
257
  @javascript
258
  Scenario: Adding section should alter the course index
259
    Given I log in as "teacher1"
260
    And I am on "Course 1" course homepage with editing mode on
261
    When I click on "Add section" "link" in the "course-addsection" "region"
262
    Then I should see "New section" in the "courseindex-content" "region"
263
 
264
  @javascript
265
  Scenario: Remove a section should alter the course index
266
    Given I log in as "teacher1"
267
    And I am on "Course 1" course homepage with editing mode on
268
    When I delete section "4"
269
    And I click on "Delete" "button" in the ".modal" "css_element"
270
    Then I should not see "Section 4" in the "courseindex-content" "region"
271
 
272
  @javascript
273
  Scenario: Delete a previous section should alter the course index unnamed sections
274
    Given I log in as "teacher1"
275
    And I am on "Course 1" course homepage with editing mode on
276
    When I delete section "1"
277
    And I click on "Delete" "button" in the ".modal" "css_element"
278
    Then I should not see "Section 1" in the "courseindex-content" "region"
279
    And I should not see "Activity sample 1" in the "courseindex-content" "region"
280
 
281
  @javascript
282
  Scenario: Course index locked activity link
283
    Given the following config values are set as admin:
284
      | enableavailability | 1 |
285
    And I log in as "teacher1"
286
    And I am on "Course 1" course homepage with editing mode on
287
    And I navigate to "Settings" in current page administration
288
    And I expand all fieldsets
289
    And I set the field "Course layout" to "Show one section per page"
290
    And I click on "Save and display" "button"
291
    # Add access restriction to Activity sample 3.
292
    And I open "Activity sample 3" actions menu
293
    And I click on "Edit settings" "link" in the "Activity sample 3" activity
294
    And I expand all fieldsets
295
    And I click on "Add restriction..." "button"
296
    And I click on "Date" "button" in the "Add restriction..." "dialogue"
297
    And I set the following fields to these values:
298
      | x[day]   | 31                  |
299
      | x[month] | 12                  |
300
      | x[year]  | ## +1 year ## %Y ## |
301
    And I press "Save and return to course"
302
    And I log out
303
    # Check course index link goes to the specific section.
304
    When I log in as "student1"
305
    And I am on "Course 1" course homepage
306
    And I click on "Section 1" "link" in the "region-main" "region"
307
    And I should not see "Activity sample 3" in the "region-main" "region"
308
    And I click on "Activity sample 3" "link" in the "courseindex-content" "region"
309
    Then I should see "Activity sample 3" in the "region-main" "region"
310
 
311
  @javascript
312
  Scenario Outline: Course index is displayed by default depending on the screen size.
313
    When I change window size to "<device>"
314
    And I am on the "C1" "Course" page logged in as "student1"
315
    Then "courseindex-content" "region" should <bydefault> visible
316
    And I reload the page
317
    And "courseindex-content" "region" should <bydefault> visible
318
    # Check whenever preferences are saved.
319
    And I click on "<action1> course index" "button"
320
    And I reload the page
321
    And "courseindex-content" "region" should <visible1> visible
322
    And I click on "<action2> course index" "button"
323
    And I reload the page
324
    And "courseindex-content" "region" should <visible2> visible
325
 
326
    Examples:
327
      | device | bydefault | action1 | visible1 | action2 | visible2 |
328
      | large  | be        | Close   | not be   | Open    | be       |
329
      | tablet | not be    | Open    | not be   | Open    | not be   |
330
      | mobile | not be    | Open    | not be   | Open    | not be   |
331
 
332
  @javascript
333
  Scenario: Course index is refreshed when we change role.
334
    When I am on the "C1" "Course" page logged in as "teacher1"
335
    And I turn editing mode on
336
    And I hide section "1"
337
    And I turn editing mode off
338
    And I should see "Section 1" in the "courseindex-content" "region"
339
    And I follow "Switch role to..." in the user menu
340
    And I press "Student"
341
    Then I should not see "Section 1" in the "courseindex-content" "region"
342
 
343
  @javascript
344
  Scenario: Course index behaviour for activities without url
345
    # Add a label to the course (labels doesn't have URL, because they can't be displayed in a separate page).
346
    Given the following "activities" exist:
347
      | activity | name                | intro       | course | idnumber | section |
348
      | label    | Activity sample 4   | Test label  | C1     | sample4  | 2       |
349
    # Check resources without URL, as labels, are displayed in the CI and the link goes to the main page when it is clicked.
350
    When I am on the "sample1" "Activity" page logged in as "student1"
351
    Then I should see "Activity sample 4" in the "#courseindex" "css_element"
352
    And I click on "Activity sample 4" "link" in the "#courseindex" "css_element"
353
    And I should see "Test label" in the "region-main" "region"
354
    And I should see "Activity sample 2" in the "region-main" "region"
355
    # Check resources without URL, as labels, are displayed for teachers too, and the link is working even when edit mode is on.
356
    And I am on the "sample1" "Activity" page logged in as "teacher1"
357
    And I should see "Activity sample 4" in the "#courseindex" "css_element"
358
    And I turn editing mode on
359
    And I should see "Activity sample 4" in the "#courseindex" "css_element"
360
    And I click on "Activity sample 4" "link" in the "#courseindex" "css_element"
361
    And I should see "Test label" in the "region-main" "region"
362
    And I should see "Activity sample 2" in the "region-main" "region"
363
 
364
  @javascript
365
  Scenario: Course index behaviour for labels with name or without name
366
    # Add two labels to the course (one with name and one without name).
367
    Given the following "activities" exist:
368
      | activity | name                | intro         | course | idnumber | section |
369
      | label    | Activity sample 5   | Test label 1  | C1     | sample4  | 2       |
370
      | label    |                     | Test label 2  | C1     | sample5  | 2       |
371
    When I am on the "Course 1" course page logged in as teacher1
372
    And I should see "Section 2" in the "courseindex-content" "region"
373
    # Label name should be displayed if it is set.
374
    And I should see "Activity sample 5" in the "courseindex-content" "region"
375
    # Label intro text should be displayed if label name is not set.
376
    And I should see "Test label 2" in the "courseindex-content" "region"
377
 
378
  @javascript
379
  Scenario: Change the section name inline in section page
380
    When I am on the "Course 1 > Section 2" "course > section" page logged in as "teacher1"
381
    And I turn editing mode on
382
    When I set the field "Edit section name" in the "page-header" "region" to "Custom section name"
383
    Then I should see "Custom section name" in the "courseindex-content" "region"