Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
@core @core_calendar
2
Feature: Perform basic calendar functionality
3
  In order to ensure the calendar works as expected
4
  As an admin
5
  I need to create calendar data
6
 
7
  Background:
8
    Given the following "users" exist:
9
      | username | firstname | lastname | email |
10
      | student1 | Student | 1 | student1@example.com |
11
      | student2 | Student | 2 | student2@example.com |
12
      | student3 | Student | 3 | student3@example.com |
13
      | teacher1 | Teacher | 1 | teacher1@example.com |
14
    And the following "categories" exist:
15
      | name     | category | idnumber |
16
      | CatA     | 0        | cata     |
17
    And the following "courses" exist:
18
      | fullname | shortname | format | category |
19
      | Course 1 | C1        | topics | cata     |
20
      | Course 2 | C2        | topics | cata     |
21
      | Course 3 | C3        | topics | cata     |
22
      | Course 4 | C4        | topics | cata     |
23
    And the following "course enrolments" exist:
24
      | user | course | role |
25
      | student1 | C1 | student |
26
      | student3 | C1 | student |
27
      | teacher1 | C1 | teacher |
28
      | admin    | C1 | editingteacher |
29
    And the following "groups" exist:
30
      | name | course | idnumber |
31
      | Group 1 | C1 | G1 |
32
    And the following "group members" exist:
33
      | user | group |
34
      | student1 | G1 |
35
      | teacher1 | G1 |
36
    And the following "blocks" exist:
37
      | blockname         | contextlevel | reference | pagetypepattern | defaultregion |
38
      | calendar_month    | Course       | C1        | course-view-*   | side-pre      |
39
      | calendar_upcoming | Course       | C4        | course-view-*   | side-pre      |
40
 
41
  @javascript
42
  Scenario: Create a site event
43
    Given I log in as "admin"
44
    And I create a calendar event with form data:
45
      | Type of event | site |
46
      | Event title | Really awesome event! |
47
      | Description | Come join this awesome event, sucka! |
48
    And I log out
49
    When I am on the "Course 1" course page logged in as student1
50
    And I follow "Course calendar"
51
    And I should see "Really awesome event!"
52
    And I log out
53
    And I log in as "student2"
54
    And I follow "Full calendar"
55
    Then I should see "Really awesome event!"
56
 
57
  @javascript
58
  Scenario: Create a course event
59
    Given I log in as "teacher1"
60
    And I create a calendar event with form data:
61
      | Type of event | course |
62
      | Course        | Course 1 |
63
      | Event title | Really awesome event! |
64
      | Description | Come join this awesome event, sucka! |
65
    And I log out
66
    When I am on the "Course 1" course page logged in as student1
67
    And I follow "Course calendar"
68
    And I click on "Really awesome event!" "link"
69
    And "Course 1" "link" should exist in the "Really awesome event!" "dialogue"
70
    And I click on "Close" "button" in the "Really awesome event!" "dialogue"
71
    And I log out
72
    And I log in as "student2"
73
    And I follow "Full calendar"
74
    Then I should not see "Really awesome event!"
75
 
76
  @javascript
77
  Scenario: Create a group event
78
    Given I log in as "teacher1"
79
    And I follow "Full calendar"
80
    And I set the field "course" to "C1"
81
    And I create a calendar event:
82
      | Type of event | group |
83
      | Group         | Group 1 |
84
      | Event title | Really awesome event! |
85
      | Description | Come join this awesome event |
86
    And I log out
87
    When I am on the "Course 1" course page logged in as student1
88
    And I follow "Course calendar"
89
    Then I follow "Really awesome event!"
90
 
91
  @javascript
92
  Scenario: Create a user event
93
    Given I log in as "teacher1"
94
    And I create a calendar event with form data:
95
      | Type of event | user |
96
      | Event title | Really awesome event! |
97
      | Description | Come join this awesome event, sucka! |
98
    And I log out
99
    When I am on the "Course 1" course page logged in as student1
100
    And I follow "Course calendar"
101
    Then I should not see "Really awesome event!"
102
 
103
  @javascript
104
  Scenario: Create an event containing URL as location
105
    Given I log in as "admin"
106
    And I create a calendar event with form data:
107
      | Type of event | site               |
108
      | Event title   | Important webinar  |
109
      | Location      | https://moodle.org |
110
    When I click on "Important webinar" "link"
111
    Then "https://moodle.org" "link" should exist in the "Important webinar" "dialogue"
112
 
113
  @javascript
114
  Scenario: Delete an event
115
    Given I log in as "teacher1"
116
    And I create a calendar event with form data:
117
      | Type of event | user |
118
      | Event title | Really awesome event! |
119
      | Description | Come join this awesome event, sucka! |
120
    And I am on "Course 1" course homepage
121
    When I follow "Course calendar"
122
    And I click on "Really awesome event!" "link"
123
    And I click on "Delete" "button" in the "Really awesome event!" "dialogue"
124
    And I click on "Delete event" "button"
125
    And I wait to be redirected
126
    Then I should not see "Really awesome event!"
127
 
128
  @javascript
129
  Scenario: Edit an event
130
    Given I log in as "teacher1"
131
    And I create a calendar event with form data:
132
      | Type of event | user |
133
      | Event title | Really awesome event! |
134
      | Description | Come join this awesome event, sucka! |
135
      | Location | Cube office |
136
    And I am on "Course 1" course homepage
137
    When I follow "Course calendar"
138
    And I click on "Really awesome event!" "link"
139
    And ".location-content" "css_element" should exist
140
    And I should see "Cube office"
141
    And I click on "Edit" "button"
142
    And I set the following fields to these values:
143
      | Event title | Mediocre event :( |
144
      | Description | Wait, this event isn't that great. |
145
      | Location | |
146
    And I press "Save"
147
    And I should see "Mediocre event"
148
    And I click on "Mediocre event :(" "link"
149
    Then I should see "Mediocre event"
150
    And ".location-content" "css_element" should not exist
151
 
152
  @javascript @editor_tiny
153
  Scenario: Edit a newly created event using TinyMCE editor
154
    Given I log in as "teacher1"
155
    And I follow "Dashboard"
156
    And I click on "New event" "button"
157
    And I set the field "Event title" to "Newly created event"
158
    When I press "Save"
159
    Then I should see "Newly created event"
160
    And I click on "Newly created event" "link"
161
    And I click on "Edit" "button" in the "Newly created event" "dialogue"
162
    And I click on "Show more..." "link"
163
    And I click on the "Link" button for the "Description" TinyMCE editor
164
    And I set the field "Text to display" to "Read more..."
165
    And I set the field "Enter a URL" to "https://moodle.org/"
166
    And I click on "Create link" "button" in the "Create link" "dialogue"
167
    And I press "Save"
168
    And I click on "Newly created event" "link"
169
    And I should see "Read more..."
170
 
171
  @javascript
172
  Scenario: Module events editing
173
    Given I log in as "teacher1"
174
    And I am on "Course 1" course homepage
175
    And the following "activities" exist:
176
      | activity | course | idnumber | name        | intro                   | timeopen      | timeclose     |
177
      | choice   | C1     | choice1  | Test choice | Test choice description | ##today## | ##today##  |
178
    When I follow "Course calendar"
179
    Then I should see "Test choice opens"
180
    And I should see "Test choice closes"
181
    When I click on "Test choice opens" "link"
182
    Then "Delete" "button" should not exist in the "Test choice opens" "dialogue"
183
    And "Edit" "button" should not exist in the "Test choice opens" "dialogue"
184
    And I should see "Course event"
185
    When I click on "Go to activity" "link"
186
    And I wait to be redirected
187
    Then I should see "Test choice"
188
    And I am on "Course 1" course homepage
189
    And I follow "Course calendar"
190
    When I click on "Test choice closes" "link"
191
    Then "Delete" "button" should not exist in the "Test choice closes" "dialogue"
192
    And "Edit" "button" should not exist in the "Test choice closes" "dialogue"
193
    And I should see "Course event"
194
    When I click on "Go to activity" "link"
195
    And I wait to be redirected
196
    Then I should see "Test choice"
197
 
198
  @javascript
199
  Scenario: Attempt to create event without fill required fields should display validation errors
200
    Given I am on the "Course 1" course page logged in as teacher1
201
    And I follow "Course calendar"
202
    And I click on "New event" "button"
203
    When I click on "Save" "button"
204
    Then I should see "Required" in the "Event title" "form_row"
205
    And I am on homepage
206
    And I follow "Full calendar"
207
    And I click on "New event" "button"
208
    And I set the field "Event title" to "Really awesome event!"
209
    And I set the field "Type of event" to "Course"
210
    And I click on "Save" "button"
211
    And I should see "Select a course" in the "Course" "form_row"
212
 
213
  @javascript
214
  Scenario: Default event type selection in the event form
215
    Given I log in as "teacher1"
216
    When I am viewing site calendar
217
    And I click on "New event" "button"
218
    Then the field "Type of event" matches value "User"
219
    And I click on "Close" "button" in the "New event" "dialogue"
220
    And I set the field "course" to "C1"
221
    When I click on "New event" "button"
222
    Then the field "Type of event" matches value "Course"
223
 
224
  @javascript
225
  Scenario: Admin can only see all courses if calendar_adminseesall setting is enabled.
226
    Given I am on the "Course 1" course page logged in as admin
227
    And I am viewing site calendar
228
    And I click on "New event" "button"
229
    And I set the field "Type of event" to "Course"
230
    When I expand the "Course" autocomplete
231
    Then "Course 1" "autocomplete_suggestions" should exist
232
    And "Course 2" "autocomplete_suggestions" should not exist
233
    And "Course 3" "autocomplete_suggestions" should not exist
234
    And I click on "Close" "button" in the "New event" "dialogue"
235
    And I am on site homepage
236
    And I navigate to "Appearance > Calendar" in site administration
237
    And I set the field "Admins see all" to "1"
238
    And I press "Save changes"
239
    And I am viewing site calendar
240
    And I click on "New event" "button"
241
    And I set the field "Type of event" to "Course"
242
    When I expand the "Course" autocomplete
243
    Then "Course 1" "autocomplete_suggestions" should exist
244
    And "Course 2" "autocomplete_suggestions" should exist
245
    And "Course 3" "autocomplete_suggestions" should exist
246
 
247
  @javascript
248
  Scenario: Students can not see event type field by default.
249
    Given I log in as "student1"
250
    And I am viewing site calendar
251
    When I click on "New event" "button"
252
    # Only "user" event type is available, so "Type of event" field should not be displayed.
253
    Then "Type of event" "select" should not exist
254
 
255
  @javascript
256
  Scenario: "Student 2" has "manageentries" capability assigned but it's not enrolled in any course.
257
    Given the following "permission overrides" exist:
258
      | capability                    | permission | role    | contextlevel | reference |
259
      | moodle/calendar:manageentries | Allow      | student | System       |           |
260
    And I log in as "student2"
261
    And I am viewing site calendar
262
    When I click on "New event" "button"
263
    # Only "user" event type is available, so "Type of event" field should not be displayed.
264
    Then "Type of event" "select" should not exist
265
 
266
  @javascript
267
  Scenario: "Student 1" has "manageentries" capability assigned and it's enrolled in a course.
268
    Given the following "permission overrides" exist:
269
      | capability                    | permission | role    | contextlevel | reference |
270
      | moodle/calendar:manageentries | Allow      | student | System       |           |
271
    And I log in as "student1"
272
    And I am viewing site calendar
273
    When I click on "New event" "button"
274
    # Student 1 is enrolled in a course and have the capability assigned.
275
    # Then, the "Type of event" select box should be visible.
276
    Then "Type of event" "select" should exist
277
    And I should see "User" in the "Type of event" "select"
278
    And I should see "Course" in the "Type of event" "select"
279
 
280
  @javascript @accessibility
281
  Scenario: The calendar page must be accessible
282
    Given I am on the "Course 1" course page logged in as student1
283
    When I follow "Course calendar"
284
    Then the page should meet accessibility standards
285
    And the page should meet "wcag131, wcag143, wcag412" accessibility standards
286
    And the page should meet accessibility standards with "wcag131, wcag143, wcag412" extra tests
287
 
288
  @javascript
289
  Scenario: The calendar page should be responsive
290
    Given I log in as "admin"
291
    And I am viewing site calendar
292
    And I create a calendar event:
293
      | Type of event  | site      |
294
      | Event title    | Event 1:1 |
295
      | timestart[day] | 1         |
296
    When I change viewport size to "1200x1000"
297
    Then I should see "Event 1:1"
298
    And I change viewport size to "600x1000"
299
    # We need to give the browser a couple seconds to re-render the page after the screen has been resized.
300
    And I wait "1" seconds
301
    And I should not see "Event 1:1"
302
    And I hover over day "1" of this month in the full calendar page responsive view
303
    And I should see "Event 1:1"
304
 
305
  @javascript
306
  Scenario: Admin can create and edit course events if calendar_adminseesall setting is disabled
307
    Given I log in as "admin"
308
    And the following config values are set as admin:
309
      | calendar_adminseesall | 0 |
310
    And I am on "Course 4" course homepage with editing mode on
311
    And I click on "Go to calendar..." "link" in the "Upcoming events" "block"
312
    And I click on "New event" "button"
313
    And I should see "Course" in the "Type of event" "select"
314
    And "Course 4" "autocomplete_selection" should exist
315
    And I set the field "Event title" to "Test course event"
316
    And I click on "Save" "button"
317
    And I should see "Test course event"
318
    When I click on "Edit" "link" in the "region-main" "region"
319
    Then the field "Event title" matches value "Test course event"
320
    And the field "Type of event" matches value "Course"
321
    And "Course 4" "autocomplete_selection" should exist
322
 
323
  @javascript
324
  Scenario: Changing the event type should clear previous data
325
    Given I am on the "Course 1" course page logged in as admin
326
    And I follow "Course calendar"
327
    And I press "New event"
328
    And I set the following fields to these values:
329
      | Event title | Group 1 event |
330
      | Type of event | Group       |
331
    And I press "Save"
332
    And I am on "Course 1" course homepage
333
    And I follow "Course calendar"
334
    And I click on "Group 1 event" "link"
335
    And I should see "Group event"
336
    And I should see "Group 1"
337
    When I click on "Edit" "button" in the "Group 1 event" "dialogue"
338
    And I set the following fields to these values:
339
      | Event title | My own user event |
340
      | Type of event | user |
341
    And I press "Save"
342
    And I click on "My own user event" "link"
343
    Then I should see "User event"
344
    And I should not see "Group 1"
345
    And I click on "Edit" "button" in the "My own user event" "dialogue"
346
    And I set the following fields to these values:
347
      | Event title | Site event |
348
      | Type of event | site |
349
    And I press "Save"
350
    And I click on "Site event" "link"
351
    And I should see "Site event"
352
    And I click on "Edit" "button" in the "Site event" "dialogue"
353
    And I set the following fields to these values:
354
      | Event title | Course 1 event |
355
      | Type of event | course |
356
    And I expand the "Course" autocomplete
357
    And I click on "Course 1" item in the autocomplete list
358
    And I press "Save"
359
    And I click on "Course 1 event" "link"
360
    And I should see "Course event"
361
    And I click on "Edit" "button" in the "Course 1 event" "dialogue"
362
    And I set the following fields to these values:
363
      | Event title   | Category event |
364
      | Type of event | category       |
365
      | Category      | CatA           |
366
    And I press "Save"
367
    And I click on "Category event" "link"
368
    And I should see "Category event"
369
 
370
  @javascript
371
  Scenario: Changing the event type from user to anything else should work
372
    Given I log in as "teacher1"
373
    # We need this so we can see the groups.
374
    And the following "course enrolments" exist:
375
      | user     | course | role           |
376
      | teacher1 | C1     | editingteacher |
377
    And the following "role assigns" exist:
378
      | user     | role    | contextlevel  | reference |
379
      | teacher1 | manager | Category      | cata      |
380
    And I am on "Course 1" course homepage
381
    And I follow "Course calendar"
382
    And I press "New event"
383
    And I set the following fields to these values:
384
      | Event title   | type change test event |
385
      | Type of event | User                   |
386
    And I press "Save"
387
    And I am on "Course 1" course homepage
388
    And I follow "Course calendar"
389
    And I click on "type change test event" "link"
390
    And I should see "User event"
391
    When I click on "Edit" "button"
392
    And I set the following fields to these values:
393
      | Event title   | type change test event |
394
      | Type of event | Course                 |
395
    And I expand the "Course" autocomplete
396
    And I click on "Course 1" item in the autocomplete list
397
    And I press "Save"
398
    And I click on "type change test event" "link"
399
    Then I should see "Course event"
400
    # Reset to user event
401
    And I click on "Edit" "button" in the "type change test event" "dialogue"
402
    And I set the following fields to these values:
403
      | Event title   | type change test event |
404
      | Type of event | User                   |
405
    And I press "Save"
406
    And I click on "type change test event" "link"
407
    And I should see "User event"
408
    # Now test changing from user to group event.
409
    And I am on "Course 1" course homepage
410
    And I follow "Course calendar"
411
    And I click on "type change test event" "link"
412
    And I click on "Edit" "button"
413
    And I set the following fields to these values:
414
      | Event title   | type change test event |
415
      | Type of event | Group                  |
416
    And I click on "#fitem_id_groupcourseid .form-autocomplete-downarrow" "css_element"
417
    And I click on "Course 1" item in the autocomplete list
418
    And I set the following fields to these values:
419
      | Group | Group 1 |
420
    And I press "Save"
421
    And I click on "type change test event" "link"
422
    And I should see "Group event"
423
    # Reset to user event
424
    And I click on "Edit" "button" in the "type change test event" "dialogue"
425
    And I set the following fields to these values:
426
      | Event title | type change test event |
427
      | Type of event | User |
428
    And I press "Save"
429
    And I click on "type change test event" "link"
430
    And I should see "User event"
431
    # Now test changing from user to course event.
432
    And I click on "Edit" "button" in the "type change test event" "dialogue"
433
    And I set the following fields to these values:
434
      | Event title   | Course 1 event |
435
      | Type of event | Course         |
436
    And I expand the "Course" autocomplete
437
    And I click on "Course 1" item in the autocomplete list
438
    And I press "Save"
439
    And I click on "Course 1 event" "link"
440
    And I should see "Course event"
441
    # Reset to user event
442
    And I click on "Edit" "button" in the "Course 1 event" "dialogue"
443
    And I set the following fields to these values:
444
      | Event title   | type change test event |
445
      | Type of event | User                   |
446
    And I press "Save"
447
    And I click on "type change test event" "link"
448
    And I should see "User event"
449
    # Now test changing from user to category event.
450
    And I click on "Edit" "button" in the "type change test event" "dialogue"
451
    And I set the following fields to these values:
452
      | Event title   | type change test event |
453
      | Type of event | Category               |
454
    And I press "Save"
455
    And I click on "type change test event" "link"
456
    And I should see "Category event"