Proyectos de Subversion Moodle

Rev

Rev 1 | | Comparar con el anterior | 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
 
1441 ariadna 190
  @javascript @accessibility
1 efrain 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"
1441 ariadna 202
    And the page should meet accessibility standards
1 efrain 203
    And I click on "Collapse all" "link" in the "#courseindexdrawercontrols" "css_element"
204
    And I should see "Section 1" in the "courseindex-content" "region"
205
    And I should not see "Activity sample 1" in the "courseindex-content" "region"
206
    And I should see "Section 2" in the "courseindex-content" "region"
207
    And I should not see "Activity sample 2" in the "courseindex-content" "region"
208
    And I should see "Section 3" in the "courseindex-content" "region"
209
    And I should not see "Activity sample 3" in the "courseindex-content" "region"
210
    # Expand all sections
211
    And I click on "Course index options" "button" in the "#courseindexdrawercontrols" "css_element"
212
    And I click on "Expand all" "link" in the "#courseindexdrawercontrols" "css_element"
213
    And I should see "Section 1" in the "courseindex-content" "region"
214
    And I should see "Activity sample 1" in the "courseindex-content" "region"
215
    And I should see "Section 2" in the "courseindex-content" "region"
216
    And I should see "Activity sample 2" in the "courseindex-content" "region"
217
    And I should see "Section 3" in the "courseindex-content" "region"
218
    And I should see "Activity sample 3" in the "courseindex-content" "region"
219
 
220
  @javascript
221
  Scenario: Course index section preferences
222
    When I am on the "C1" "Course" page logged in as "teacher1"
223
    Then I should see "Section 1" in the "courseindex-content" "region"
224
    And I should see "Activity sample 1" in the "courseindex-content" "region"
225
    And I should see "Section 2" in the "courseindex-content" "region"
226
    And I should see "Activity sample 2" in the "courseindex-content" "region"
227
    And I should see "Section 3" in the "courseindex-content" "region"
228
    And I should see "Activity sample 3" in the "courseindex-content" "region"
229
    # Collapse section 1.
230
    And I click on "Collapse" "link" in the ".courseindex-section[data-number='1']" "css_element"
231
    And I reload the page
232
    And I should see "Section 1" in the "courseindex-content" "region"
233
    And I should not see "Activity sample 1" in the "courseindex-content" "region"
234
    And I should see "Section 2" in the "courseindex-content" "region"
235
    And I should see "Activity sample 2" in the "courseindex-content" "region"
236
    And I should see "Section 3" in the "courseindex-content" "region"
237
    And I should see "Activity sample 3" in the "courseindex-content" "region"
238
    # Collapse section 3.
239
    And I click on "Collapse" "link" in the ".courseindex-section[data-number='3']" "css_element"
240
    And I reload the page
241
    And I should see "Section 1" in the "courseindex-content" "region"
242
    And I should not see "Activity sample 1" in the "courseindex-content" "region"
243
    And I should see "Section 2" in the "courseindex-content" "region"
244
    And I should see "Activity sample 2" in the "courseindex-content" "region"
245
    And I should see "Section 3" in the "courseindex-content" "region"
246
    And I should not see "Activity sample 3" in the "courseindex-content" "region"
247
    # Delete section 1
248
    And I turn editing mode on
249
    And I delete section "1"
250
    And I click on "Delete" "button" in the ".modal" "css_element"
251
    And I reload the page
252
    And I should not see "Activity sample 1" in the "courseindex-content" "region"
253
    And I should see "Section 2" in the "courseindex-content" "region"
254
    And I should see "Activity sample 2" in the "courseindex-content" "region"
255
    And I should see "Section 3" in the "courseindex-content" "region"
256
    And I should not see "Activity sample 3" in the "courseindex-content" "region"
257
 
258
  @javascript
259
  Scenario: Adding section should alter the course index
260
    Given I log in as "teacher1"
261
    And I am on "Course 1" course homepage with editing mode on
262
    When I click on "Add section" "link" in the "course-addsection" "region"
263
    Then I should see "New section" in the "courseindex-content" "region"
264
 
265
  @javascript
266
  Scenario: Remove a section should alter the course index
267
    Given I log in as "teacher1"
268
    And I am on "Course 1" course homepage with editing mode on
269
    When I delete section "4"
270
    And I click on "Delete" "button" in the ".modal" "css_element"
271
    Then I should not see "Section 4" in the "courseindex-content" "region"
272
 
273
  @javascript
274
  Scenario: Delete a previous section should alter the course index unnamed sections
275
    Given I log in as "teacher1"
276
    And I am on "Course 1" course homepage with editing mode on
277
    When I delete section "1"
278
    And I click on "Delete" "button" in the ".modal" "css_element"
279
    Then I should not see "Section 1" in the "courseindex-content" "region"
280
    And I should not see "Activity sample 1" in the "courseindex-content" "region"
281
 
282
  @javascript
283
  Scenario: Course index locked activity link
284
    Given the following config values are set as admin:
285
      | enableavailability | 1 |
286
    And I log in as "teacher1"
287
    And I am on "Course 1" course homepage with editing mode on
288
    And I navigate to "Settings" in current page administration
289
    And I expand all fieldsets
290
    And I set the field "Course layout" to "Show one section per page"
291
    And I click on "Save and display" "button"
292
    # Add access restriction to Activity sample 3.
293
    And I open "Activity sample 3" actions menu
294
    And I click on "Edit settings" "link" in the "Activity sample 3" activity
295
    And I expand all fieldsets
296
    And I click on "Add restriction..." "button"
297
    And I click on "Date" "button" in the "Add restriction..." "dialogue"
298
    And I set the following fields to these values:
299
      | x[day]   | 31                  |
300
      | x[month] | 12                  |
301
      | x[year]  | ## +1 year ## %Y ## |
302
    And I press "Save and return to course"
303
    And I log out
304
    # Check course index link goes to the specific section.
305
    When I log in as "student1"
306
    And I am on "Course 1" course homepage
307
    And I click on "Section 1" "link" in the "region-main" "region"
308
    And I should not see "Activity sample 3" in the "region-main" "region"
309
    And I click on "Activity sample 3" "link" in the "courseindex-content" "region"
310
    Then I should see "Activity sample 3" in the "region-main" "region"
311
 
312
  @javascript
313
  Scenario Outline: Course index is displayed by default depending on the screen size.
314
    When I change window size to "<device>"
315
    And I am on the "C1" "Course" page logged in as "student1"
316
    Then "courseindex-content" "region" should <bydefault> visible
317
    And I reload the page
318
    And "courseindex-content" "region" should <bydefault> visible
319
    # Check whenever preferences are saved.
320
    And I click on "<action1> course index" "button"
321
    And I reload the page
322
    And "courseindex-content" "region" should <visible1> visible
323
    And I click on "<action2> course index" "button"
324
    And I reload the page
325
    And "courseindex-content" "region" should <visible2> visible
326
 
327
    Examples:
328
      | device | bydefault | action1 | visible1 | action2 | visible2 |
329
      | large  | be        | Close   | not be   | Open    | be       |
330
      | tablet | not be    | Open    | not be   | Open    | not be   |
331
      | mobile | not be    | Open    | not be   | Open    | not be   |
332
 
333
  @javascript
334
  Scenario: Course index is refreshed when we change role.
335
    When I am on the "C1" "Course" page logged in as "teacher1"
336
    And I turn editing mode on
337
    And I hide section "1"
338
    And I turn editing mode off
339
    And I should see "Section 1" in the "courseindex-content" "region"
340
    And I follow "Switch role to..." in the user menu
341
    And I press "Student"
342
    Then I should not see "Section 1" in the "courseindex-content" "region"
343
 
344
  @javascript
345
  Scenario: Course index behaviour for activities without url
346
    # Add a label to the course (labels doesn't have URL, because they can't be displayed in a separate page).
347
    Given the following "activities" exist:
348
      | activity | name                | intro       | course | idnumber | section |
349
      | label    | Activity sample 4   | Test label  | C1     | sample4  | 2       |
350
    # Check resources without URL, as labels, are displayed in the CI and the link goes to the main page when it is clicked.
351
    When I am on the "sample1" "Activity" page logged in as "student1"
352
    Then I should see "Activity sample 4" in the "#courseindex" "css_element"
353
    And I click on "Activity sample 4" "link" in the "#courseindex" "css_element"
354
    And I should see "Test label" in the "region-main" "region"
355
    And I should see "Activity sample 2" in the "region-main" "region"
356
    # Check resources without URL, as labels, are displayed for teachers too, and the link is working even when edit mode is on.
357
    And I am on the "sample1" "Activity" page logged in as "teacher1"
358
    And I should see "Activity sample 4" in the "#courseindex" "css_element"
359
    And I turn editing mode on
360
    And I should see "Activity sample 4" in the "#courseindex" "css_element"
361
    And I click on "Activity sample 4" "link" in the "#courseindex" "css_element"
362
    And I should see "Test label" in the "region-main" "region"
363
    And I should see "Activity sample 2" in the "region-main" "region"
364
 
365
  @javascript
366
  Scenario: Course index behaviour for labels with name or without name
367
    # Add two labels to the course (one with name and one without name).
368
    Given the following "activities" exist:
369
      | activity | name                | intro         | course | idnumber | section |
370
      | label    | Activity sample 5   | Test label 1  | C1     | sample4  | 2       |
371
      | label    |                     | Test label 2  | C1     | sample5  | 2       |
372
    When I am on the "Course 1" course page logged in as teacher1
373
    And I should see "Section 2" in the "courseindex-content" "region"
374
    # Label name should be displayed if it is set.
375
    And I should see "Activity sample 5" in the "courseindex-content" "region"
376
    # Label intro text should be displayed if label name is not set.
377
    And I should see "Test label 2" in the "courseindex-content" "region"
378
 
379
  @javascript
380
  Scenario: Change the section name inline in section page
381
    When I am on the "Course 1 > Section 2" "course > section" page logged in as "teacher1"
382
    And I turn editing mode on
383
    When I set the field "Edit section name" in the "page-header" "region" to "Custom section name"
384
    Then I should see "Custom section name" in the "courseindex-content" "region"
1441 ariadna 385
 
386
  @javascript
387
  Scenario: We cannot add a section when the number of section reaches maxsections but as soon as we reach under the limit we can add a section again.
388
    Given the following config values are set as admin:
389
      | maxsections | 4 | moodlecourse|
390
    And I log in as "teacher1"
391
    And I am on "Course 1" course homepage with editing mode on
392
    Then I should see "Section 1" in the "courseindex-content" "region"
393
    And ".disabled" "css_element" should exist in the "[data-action='addSection']" "css_element"
394
    And I should see "You have reached the maximum number of sections allowed for a course."
395
    And I delete section "4"
396
    And I click on "Delete" "button" in the ".modal" "css_element"
397
    And ".disabled" "css_element" should not exist in the "[data-action='addSection']" "css_element"
398
    And I should not see "You have reached the maximum number of sections allowed for a course."