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 "Full calendar"
47 And I should see "Really awesome event!"
49 And I log in as "student2"
50 And I follow "Full calendar"
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 "Full calendar"
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 "Full calendar"
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 follow "Full calendar"
77 And I set the field "course" to "C1"
78 And I create a calendar event:
79 | Type of event | group |
81 | Event title | Really awesome event! |
82 | Description | Come join this awesome event |
84 And I log in as "student1"
85 When I am on "Course 1" course homepage
86 And I follow "Full calendar"
87 Then I follow "Really awesome event!"
90 Scenario: Create a user event
91 Given I log in as "teacher1"
92 And I create a calendar event with form data:
93 | Type of event | user |
94 | Event title | Really awesome event! |
95 | Description | Come join this awesome event, sucka! |
97 And I log in as "student1"
98 When I am on "Course 1" course homepage
99 And I follow "Full calendar"
100 Then I should not see "Really awesome event!"
103 Scenario: Delete an event
104 Given I log in as "teacher1"
105 And I create a calendar event with form data:
106 | Type of event | user |
107 | Event title | Really awesome event! |
108 | Description | Come join this awesome event, sucka! |
109 And I am on "Course 1" course homepage
110 When I follow "Full calendar"
111 And I click on "Really awesome event!" "link"
112 And I click on "Delete" "button" in the "Really awesome event!" "dialogue"
113 And I click on "Delete event" "button"
114 And I wait to be redirected
115 Then I should not see "Really awesome event!"
118 Scenario: Edit an event
119 Given I log in as "teacher1"
120 And I create a calendar event with form data:
121 | Type of event | user |
122 | Event title | Really awesome event! |
123 | Description | Come join this awesome event, sucka! |
124 | Location | Cube office |
125 And I am on "Course 1" course homepage
126 When I follow "Full calendar"
127 And I click on "Really awesome event!" "link"
128 And ".location-content" "css_element" should exist
129 And I should see "Cube office"
130 And I click on "Edit" "button"
131 And I set the following fields to these values:
132 | Event title | Mediocre event :( |
133 | Description | Wait, this event isn't that great. |
136 And I should see "Mediocre event"
137 And I click on "Mediocre event :(" "link"
138 Then I should see "Mediocre event"
139 And ".location-content" "css_element" should not exist
142 Scenario: Module events editing
143 Given I log in as "teacher1"
144 And I am on "Course 1" course homepage
145 And the following "activities" exist:
146 | activity | course | idnumber | name | intro | timeopen | timeclose |
147 | choice | C1 | choice1 | Test choice | Test choice description | ##today## | ##today## |
148 When I follow "Full calendar"
149 And I set the field "course" to "C1"
150 Then I should see "Test choice opens"
151 And I should see "Test choice closes"
152 When I click on "Test choice opens" "link"
153 Then "Delete" "button" should not exist in the "Test choice opens" "dialogue"
154 And "Edit" "button" should not exist in the "Test choice opens" "dialogue"
155 And I should see "Course event"
156 When I click on "Go to activity" "link"
157 And I wait to be redirected
158 Then I should see "Test choice"
159 And I am on "Course 1" course homepage
160 And I follow "Full calendar"
161 When I click on "Test choice closes" "link"
162 Then "Delete" "button" should not exist in the "Test choice closes" "dialogue"
163 And "Edit" "button" should not exist in the "Test choice closes" "dialogue"
164 And I should see "Course event"
165 When I click on "Go to activity" "link"
166 And I wait to be redirected
167 Then I should see "Test choice"
170 Scenario: Attempt to create event without fill required fields should display validation errors
171 Given I log in as "teacher1"
172 And I am on "Course 1" course homepage
173 And I follow "Full calendar"
174 And I click on "New event" "button"
175 When I click on "Save" "button"
176 Then I should see "Required" in the "Event title" "form_row"
178 And I follow "Full calendar"
179 And I click on "New event" "button"
180 And I set the field "Event title" to "Really awesome event!"
181 And I set the field "Type of event" to "Course"
182 When I click on "Save" "button"
183 And I should see "Select a course" in the "Course" "form_row"
186 Scenario: Default event type selection in the event form
187 Given I log in as "teacher1"
188 When I am viewing site calendar
189 And I click on "New event" "button"
190 Then the field "Type of event" matches value "User"
191 And I click on "Close" "button"
192 And I set the field "course" to "C1"
193 When I click on "New event" "button"
194 Then the field "Type of event" matches value "Course"
197 Scenario: Admin can only see all courses if calendar_adminseesall setting is enabled.
198 Given I log in as "admin"
199 And I am on "Course 1" course homepage
200 And I enrol "admin" user as "Teacher"
201 And I am viewing site calendar
202 And I click on "New event" "button"
203 And I set the field "Type of event" to "Course"
204 When I expand the "Course" autocomplete
205 Then "Course 1" "autocomplete_suggestions" should exist
206 And "Course 2" "autocomplete_suggestions" should not exist
207 And "Course 3" "autocomplete_suggestions" should not exist
208 And I click on "Close" "button"
209 And I am on site homepage
210 And I navigate to "Appearance > Calendar" in site administration
211 And I set the field "Admins see all" to "1"
212 And I press "Save changes"
213 And I am viewing site calendar
214 And I click on "New event" "button"
215 And I set the field "Type of event" to "Course"
216 When I expand the "Course" autocomplete
217 Then "Course 1" "autocomplete_suggestions" should exist
218 And "Course 2" "autocomplete_suggestions" should exist
219 And "Course 3" "autocomplete_suggestions" should exist
222 Scenario: Students can only see user event type by default.
223 Given I log in as "student1"
224 And I am viewing site calendar
225 When I click on "New event" "button"
226 Then I should see "User" in the "div#fitem_id_staticeventtype" "css_element"
227 And I am on "Course 1" course homepage
228 And I follow "Full calendar"
229 When I click on "New event" "button"
230 Then I should see "User" in the "div#fitem_id_staticeventtype" "css_element"
231 And I click on "Close" "button"
233 Given I log in as "admin"
234 And I navigate to "Appearance > Calendar" in site administration
235 And I set the field "Admins see all" to "1"
236 And I press "Save changes"
238 Given I log in as "student1"
239 And I am on "Course 1" course homepage
240 And I follow "Full calendar"
241 When I click on "New event" "button"
242 Then I should see "User" in the "div#fitem_id_staticeventtype" "css_element"
244 @javascript @accessibility
245 Scenario: The calendar page must be accessible
246 Given I log in as "student1"
247 And I am on "Course 1" course homepage
248 When I follow "Full calendar"
249 Then the page should meet accessibility standards
250 And the page should meet "wcag131, wcag143, wcag412" accessibility standards
251 And the page should meet accessibility standards with "wcag131, wcag143, wcag412" extra tests