MDL-69391 calendar: Accessibility tests for calendar
[moodle.git] / calendar / tests / behat / calendar.feature
CommitLineData
ed84d85f 1@core @core_calendar
bcd5c6a9
MN
2Feature: 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:
759b323e 8 Given the following "users" exist:
bcd5c6a9 9 | username | firstname | lastname | email |
0fe86bbd
RT
10 | student1 | Student | 1 | student1@example.com |
11 | student2 | Student | 2 | student2@example.com |
12 | student3 | Student | 3 | student3@example.com |
c448e19b 13 | teacher1 | Teacher | 1 | teacher1@example.com |
759b323e 14 And the following "courses" exist:
bcd5c6a9
MN
15 | fullname | shortname | format |
16 | Course 1 | C1 | topics |
47177cd6
SL
17 | Course 2 | C2 | topics |
18 | Course 3 | C3 | topics |
759b323e 19 And the following "course enrolments" exist:
bcd5c6a9
MN
20 | user | course | role |
21 | student1 | C1 | student |
c9653460 22 | student3 | C1 | student |
c448e19b 23 | teacher1 | C1 | teacher |
c9653460
MG
24 And the following "groups" exist:
25 | name | course | idnumber |
26 | Group 1 | C1 | G1 |
27 And the following "group members" exist:
28 | user | group |
29 | student1 | G1 |
c448e19b 30 | teacher1 | G1 |
ed84d85f
SL
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
34 And I log out
bcd5c6a9 35
ed84d85f 36 @javascript
bcd5c6a9 37 Scenario: Create a site event
c448e19b 38 Given I log in as "admin"
bcd5c6a9
MN
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! |
43 And I log out
44 And I log in as "student1"
fdeeaff9 45 And I am on "Course 1" course homepage
bcd5c6a9
MN
46 And I follow "This month"
47 And I should see "Really awesome event!"
48 And I log out
49 And I log in as "student2"
50 And I follow "This month"
51 And I should see "Really awesome event!"
52
ed84d85f 53 @javascript
bcd5c6a9 54 Scenario: Create a course event
ed84d85f 55 Given I log in as "teacher1"
bcd5c6a9
MN
56 And I create a calendar event with form data:
57 | Type of event | course |
de6d57cf 58 | Course | Course 1 |
bcd5c6a9
MN
59 | Event title | Really awesome event! |
60 | Description | Come join this awesome event, sucka! |
61 And I log out
62 And I log in as "student1"
ed84d85f 63 When I am on "Course 1" course homepage
bcd5c6a9 64 And I follow "This month"
21e3d8b8 65 And I click on "Really awesome event!" "link"
2a77813b 66 And "Course 1" "link" should exist in the "Really awesome event!" "dialogue"
bc01fbbd 67 And I click on "Close" "button"
bcd5c6a9
MN
68 And I log out
69 And I log in as "student2"
70 And I follow "This month"
1228bb6c 71 Then I should not see "Really awesome event!"
bcd5c6a9 72
ed84d85f 73 @javascript
c9653460 74 Scenario: Create a group event
ed84d85f 75 Given I log in as "teacher1"
de6d57cf 76 And I am on "Course 1" course homepage
c9653460
MG
77 And I create a calendar event with form data:
78 | Type of event | group |
de6d57cf 79 | Group | Group 1 |
c9653460
MG
80 | Event title | Really awesome event! |
81 | Description | Come join this awesome event |
82 And I log out
83 And I log in as "student1"
ed84d85f 84 When I am on "Course 1" course homepage
c9653460 85 And I follow "This month"
ed84d85f 86 Then I follow "Really awesome event!"
c9653460 87
ed84d85f 88 @javascript
bcd5c6a9 89 Scenario: Create a user event
ed84d85f 90 Given I log in as "teacher1"
bcd5c6a9
MN
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! |
95 And I log out
96 And I log in as "student1"
ed84d85f 97 When I am on "Course 1" course homepage
bcd5c6a9 98 And I follow "This month"
ed84d85f 99 Then I should not see "Really awesome event!"
bcd5c6a9 100
ed84d85f 101 @javascript
bcd5c6a9 102 Scenario: Delete an event
ed84d85f 103 Given I log in as "teacher1"
bcd5c6a9
MN
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! |
c448e19b 108 And I am on "Course 1" course homepage
ed84d85f 109 When I follow "This month"
c448e19b 110 And I click on "Really awesome event!" "link"
705003be 111 And I click on "Delete" "button" in the "Really awesome event!" "dialogue"
fb7fa04e 112 And I click on "Delete event" "button"
c448e19b 113 And I wait to be redirected
ed84d85f 114 Then I should not see "Really awesome event!"
bcd5c6a9 115
ed84d85f 116 @javascript
bcd5c6a9 117 Scenario: Edit an event
ed84d85f 118 Given I log in as "teacher1"
bcd5c6a9
MN
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! |
ef4e04ee 123 | Location | Cube office |
c448e19b 124 And I am on "Course 1" course homepage
ed84d85f 125 When I follow "This month"
c448e19b 126 And I click on "Really awesome event!" "link"
9a3ee0c3
MH
127 And ".location-content" "css_element" should exist
128 And I should see "Cube office"
c448e19b 129 And I click on "Edit" "button"
f083d614 130 And I set the following fields to these values:
bcd5c6a9
MN
131 | Event title | Mediocre event :( |
132 | Description | Wait, this event isn't that great. |
9a3ee0c3 133 | Location | |
c448e19b 134 And I press "Save"
9a3ee0c3
MH
135 And I should see "Mediocre event"
136 And I click on "Mediocre event :(" "link"
ed84d85f 137 Then I should see "Mediocre event"
9a3ee0c3 138 And ".location-content" "css_element" should not exist
7b792492
SL
139
140 @javascript
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"
345f23c9
AN
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"
705003be
AN
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"
2e36c426 153 And I should see "Course event"
7b792492
SL
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"
345f23c9 159 When I click on "Test choice closes" "link"
705003be
AN
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"
2e36c426 162 And I should see "Course event"
7b792492
SL
163 When I click on "Go to activity" "link"
164 And I wait to be redirected
165 Then I should see "Test choice"
23b05f18
SL
166
167 @javascript
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"
669d54a4 174 Then I should see "Required" in the "Event title" "form_row"
2585f77a
AN
175 And I am on homepage
176 And I follow "This month"
23b05f18 177 And I click on "New event" "button"
23b05f18 178 And I set the field "Event title" to "Really awesome event!"
669d54a4 179 And I set the field "Type of event" to "Course"
23b05f18 180 When I click on "Save" "button"
669d54a4 181 And I should see "Select a course" in the "Course" "form_row"
ce715ce5
SL
182
183 @javascript
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"
47177cd6
SL
193
194 @javascript
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 open the autocomplete suggestions list
203 Then I should see "Course 1" in the ".form-autocomplete-suggestions" "css_element"
204 And I should not see "Course 2" in the ".form-autocomplete-suggestions" "css_element"
205 And I should not see "Course 3" in the ".form-autocomplete-suggestions" "css_element"
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 open the autocomplete suggestions list
215 Then I should see "Course 1" in the ".form-autocomplete-suggestions" "css_element"
216 And I should see "Course 2" in the ".form-autocomplete-suggestions" "css_element"
217 And I should see "Course 3" in the ".form-autocomplete-suggestions" "css_element"
218
da6ed259
SL
219 @javascript
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"
230 And I log out
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"
235 And I log out
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"
2c08e043
JP
241
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