2 Feature: Perform basic calendar functionality
3 In order to ensure the calendar works as expected
5 I need to create calendar data
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 "courses" exist:
15 | fullname | shortname | format |
16 | Course 1 | C1 | topics |
17 | Course 2 | C2 | topics |
18 | Course 3 | C3 | topics |
19 And the following "course enrolments" exist:
20 | user | course | role |
21 | student1 | C1 | student |
22 | student3 | C1 | student |
23 | teacher1 | C1 | teacher |
24 And the following "groups" exist:
25 | name | course | idnumber |
27 And the following "group members" exist:
31 And I log in as "admin"
32 And I am on "Course 1" course homepage with editing mode on
33 And I add the "Calendar" block
37 Scenario: Create a site event
38 Given I log in as "admin"
39 And I create a calendar event with form data:
40 | Type of event | site |
41 | Event title | Really awesome event! |
42 | Description | Come join this awesome event, sucka! |
44 And I log in as "student1"
45 And I am on "Course 1" course homepage
46 And I follow "This month"
47 And I should see "Really awesome event!"
49 And I log in as "student2"
50 And I follow "This month"
51 And I should see "Really awesome event!"
54 Scenario: Create a course event
55 Given I log in as "teacher1"
56 And I create a calendar event with form data:
57 | Type of event | course |
59 | Event title | Really awesome event! |
60 | Description | Come join this awesome event, sucka! |
62 And I log in as "student1"
63 When I am on "Course 1" course homepage
64 And I follow "This month"
65 And I click on "Really awesome event!" "link"
66 And "Course 1" "link" should exist in the "Really awesome event!" "dialogue"
67 And I click on "Close" "button"
69 And I log in as "student2"
70 And I follow "This month"
71 Then I should not see "Really awesome event!"
74 Scenario: Create a group event
75 Given I log in as "teacher1"
76 And I am on "Course 1" course homepage
77 And I create a calendar event with form data:
78 | Type of event | group |
80 | Event title | Really awesome event! |
81 | Description | Come join this awesome event |
83 And I log in as "student1"
84 When I am on "Course 1" course homepage
85 And I follow "This month"
86 Then I follow "Really awesome event!"
89 Scenario: Create a user event
90 Given I log in as "teacher1"
91 And I create a calendar event with form data:
92 | Type of event | user |
93 | Event title | Really awesome event! |
94 | Description | Come join this awesome event, sucka! |
96 And I log in as "student1"
97 When I am on "Course 1" course homepage
98 And I follow "This month"
99 Then I should not see "Really awesome event!"
102 Scenario: Delete an event
103 Given I log in as "teacher1"
104 And I create a calendar event with form data:
105 | Type of event | user |
106 | Event title | Really awesome event! |
107 | Description | Come join this awesome event, sucka! |
108 And I am on "Course 1" course homepage
109 When I follow "This month"
110 And I click on "Really awesome event!" "link"
111 And I click on "Delete" "button" in the "Really awesome event!" "dialogue"
112 And I click on "Delete event" "button"
113 And I wait to be redirected
114 Then I should not see "Really awesome event!"
117 Scenario: Edit an event
118 Given I log in as "teacher1"
119 And I create a calendar event with form data:
120 | Type of event | user |
121 | Event title | Really awesome event! |
122 | Description | Come join this awesome event, sucka! |
123 | Location | Cube office |
124 And I am on "Course 1" course homepage
125 When I follow "This month"
126 And I click on "Really awesome event!" "link"
127 And ".location-content" "css_element" should exist
128 And I should see "Cube office"
129 And I click on "Edit" "button"
130 And I set the following fields to these values:
131 | Event title | Mediocre event :( |
132 | Description | Wait, this event isn't that great. |
135 And I should see "Mediocre event"
136 And I click on "Mediocre event :(" "link"
137 Then I should see "Mediocre event"
138 And ".location-content" "css_element" should not exist
141 Scenario: Module events editing
142 Given I log in as "admin"
143 And I am on "Course 1" course homepage with editing mode on
144 And the following "activities" exist:
145 | activity | course | idnumber | name | intro | timeopen | timeclose |
146 | choice | C1 | choice1 | Test choice | Test choice description | ##today## | ##today## |
147 When I follow "This month"
148 Then I should see "Test choice opens"
149 And I should see "Test choice closes"
150 When I click on "Test choice opens" "link"
151 Then "Delete" "button" should not exist in the "Test choice opens" "dialogue"
152 And "Edit" "button" should not exist in the "Test choice opens" "dialogue"
153 And I should see "Course event"
154 When I click on "Go to activity" "link"
155 And I wait to be redirected
156 Then I should see "Test choice"
157 And I am on "Course 1" course homepage
158 And I follow "This month"
159 When I click on "Test choice closes" "link"
160 Then "Delete" "button" should not exist in the "Test choice closes" "dialogue"
161 And "Edit" "button" should not exist in the "Test choice closes" "dialogue"
162 And I should see "Course event"
163 When I click on "Go to activity" "link"
164 And I wait to be redirected
165 Then I should see "Test choice"
168 Scenario: Attempt to create event without fill required fields should display validation errors
169 Given I log in as "teacher1"
170 And I am on "Course 1" course homepage
171 And I follow "This month"
172 And I click on "New event" "button"
173 When I click on "Save" "button"
174 Then I should see "Required" in the "Event title" "form_row"
176 And I follow "This month"
177 And I click on "New event" "button"
178 And I set the field "Event title" to "Really awesome event!"
179 And I set the field "Type of event" to "Course"
180 When I click on "Save" "button"
181 And I should see "Select a course" in the "Course" "form_row"
184 Scenario: Default event type selection in the event form
185 Given I log in as "teacher1"
186 When I am viewing site calendar
187 And I click on "New event" "button"
188 Then the field "Type of event" matches value "User"
189 And I am on "Course 1" course homepage
190 And I follow "This month"
191 When I click on "New event" "button"
192 Then the field "Type of event" matches value "Course"
195 Scenario: Admin can only see all courses if calendar_adminseesall setting is enabled.
196 Given I log in as "admin"
197 And I am on "Course 1" course homepage
198 And I enrol "admin" user as "Teacher"
199 And I am viewing site calendar
200 And I click on "New event" "button"
201 And I set the field "Type of event" to "Course"
202 When I expand the "Course" autocomplete
203 Then "Course 1" "autocomplete_suggestions" should exist
204 And "Course 2" "autocomplete_suggestions" should not exist
205 And "Course 3" "autocomplete_suggestions" should not exist
206 And I click on "Close" "button"
207 And I am on site homepage
208 And I navigate to "Appearance > Calendar" in site administration
209 And I set the field "Admins see all" to "1"
210 And I press "Save changes"
211 And I am viewing site calendar
212 And I click on "New event" "button"
213 And I set the field "Type of event" to "Course"
214 When I expand the "Course" autocomplete
215 Then "Course 1" "autocomplete_suggestions" should exist
216 And "Course 2" "autocomplete_suggestions" should exist
217 And "Course 3" "autocomplete_suggestions" should exist
220 Scenario: Students can only see user event type by default.
221 Given I log in as "student1"
222 And I am viewing site calendar
223 When I click on "New event" "button"
224 Then I should see "User" in the "div#fitem_id_staticeventtype" "css_element"
225 And I am on "Course 1" course homepage
226 And I follow "This month"
227 When I click on "New event" "button"
228 Then I should see "User" in the "div#fitem_id_staticeventtype" "css_element"
229 And I click on "Close" "button"
231 Given I log in as "admin"
232 And I navigate to "Appearance > Calendar" in site administration
233 And I set the field "Admins see all" to "1"
234 And I press "Save changes"
236 Given I log in as "student1"
237 And I am on "Course 1" course homepage
238 And I follow "This month"
239 When I click on "New event" "button"
240 Then I should see "User" in the "div#fitem_id_staticeventtype" "css_element"
242 @javascript @accessibility
243 Scenario: The calendar page must be accessible
244 And I log in as "student1"
245 And I am on "Course 1" course homepage
246 And I follow "This month"
247 Then the page should meet accessibility standards
248 And the page should meet "wcag131, wcag143, wcag412" accessibility standards
249 And the page should meet accessibility standards with "wcag131, wcag143, wcag412" extra tests