MDL-65707 calendar: set the correct event type on site 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 |
759b323e 17 And the following "course enrolments" exist:
bcd5c6a9
MN
18 | user | course | role |
19 | student1 | C1 | student |
c9653460 20 | student3 | C1 | student |
c448e19b 21 | teacher1 | C1 | teacher |
c9653460
MG
22 And the following "groups" exist:
23 | name | course | idnumber |
24 | Group 1 | C1 | G1 |
25 And the following "group members" exist:
26 | user | group |
27 | student1 | G1 |
c448e19b 28 | teacher1 | G1 |
ed84d85f
SL
29 And I log in as "admin"
30 And I am on "Course 1" course homepage with editing mode on
31 And I add the "Calendar" block
32 And I log out
bcd5c6a9 33
ed84d85f 34 @javascript
bcd5c6a9 35 Scenario: Create a site event
c448e19b 36 Given I log in as "admin"
bcd5c6a9
MN
37 And I create a calendar event with form data:
38 | Type of event | site |
39 | Event title | Really awesome event! |
40 | Description | Come join this awesome event, sucka! |
41 And I log out
42 And I log in as "student1"
fdeeaff9 43 And I am on "Course 1" course homepage
bcd5c6a9
MN
44 And I follow "This month"
45 And I should see "Really awesome event!"
46 And I log out
47 And I log in as "student2"
48 And I follow "This month"
49 And I should see "Really awesome event!"
50
ed84d85f 51 @javascript
bcd5c6a9 52 Scenario: Create a course event
ed84d85f 53 Given I log in as "teacher1"
bcd5c6a9
MN
54 And I create a calendar event with form data:
55 | Type of event | course |
de6d57cf 56 | Course | Course 1 |
bcd5c6a9
MN
57 | Event title | Really awesome event! |
58 | Description | Come join this awesome event, sucka! |
59 And I log out
60 And I log in as "student1"
ed84d85f 61 When I am on "Course 1" course homepage
bcd5c6a9 62 And I follow "This month"
21e3d8b8 63 And I click on "Really awesome event!" "link"
2a77813b 64 And "Course 1" "link" should exist in the "Really awesome event!" "dialogue"
bc01fbbd 65 And I click on "Close" "button"
bcd5c6a9
MN
66 And I log out
67 And I log in as "student2"
68 And I follow "This month"
1228bb6c 69 Then I should not see "Really awesome event!"
bcd5c6a9 70
ed84d85f 71 @javascript
c9653460 72 Scenario: Create a group event
ed84d85f 73 Given I log in as "teacher1"
de6d57cf 74 And I am on "Course 1" course homepage
c9653460
MG
75 And I create a calendar event with form data:
76 | Type of event | group |
de6d57cf 77 | Group | Group 1 |
c9653460
MG
78 | Event title | Really awesome event! |
79 | Description | Come join this awesome event |
80 And I log out
81 And I log in as "student1"
ed84d85f 82 When I am on "Course 1" course homepage
c9653460 83 And I follow "This month"
ed84d85f 84 Then I follow "Really awesome event!"
c9653460 85
ed84d85f 86 @javascript
bcd5c6a9 87 Scenario: Create a user event
ed84d85f 88 Given I log in as "teacher1"
bcd5c6a9
MN
89 And I create a calendar event with form data:
90 | Type of event | user |
91 | Event title | Really awesome event! |
92 | Description | Come join this awesome event, sucka! |
93 And I log out
94 And I log in as "student1"
ed84d85f 95 When I am on "Course 1" course homepage
bcd5c6a9 96 And I follow "This month"
ed84d85f 97 Then I should not see "Really awesome event!"
bcd5c6a9 98
ed84d85f 99 @javascript
bcd5c6a9 100 Scenario: Delete an event
ed84d85f 101 Given I log in as "teacher1"
bcd5c6a9
MN
102 And I create a calendar event with form data:
103 | Type of event | user |
104 | Event title | Really awesome event! |
105 | Description | Come join this awesome event, sucka! |
c448e19b 106 And I am on "Course 1" course homepage
ed84d85f 107 When I follow "This month"
c448e19b 108 And I click on "Really awesome event!" "link"
705003be 109 And I click on "Delete" "button" in the "Really awesome event!" "dialogue"
fb7fa04e 110 And I click on "Delete event" "button"
c448e19b 111 And I wait to be redirected
ed84d85f 112 Then I should not see "Really awesome event!"
bcd5c6a9 113
ed84d85f 114 @javascript
bcd5c6a9 115 Scenario: Edit an event
ed84d85f 116 Given I log in as "teacher1"
bcd5c6a9
MN
117 And I create a calendar event with form data:
118 | Type of event | user |
119 | Event title | Really awesome event! |
120 | Description | Come join this awesome event, sucka! |
ef4e04ee 121 | Location | Cube office |
c448e19b 122 And I am on "Course 1" course homepage
ed84d85f 123 When I follow "This month"
c448e19b 124 And I click on "Really awesome event!" "link"
9a3ee0c3
MH
125 And ".location-content" "css_element" should exist
126 And I should see "Cube office"
c448e19b 127 And I click on "Edit" "button"
f083d614 128 And I set the following fields to these values:
bcd5c6a9
MN
129 | Event title | Mediocre event :( |
130 | Description | Wait, this event isn't that great. |
9a3ee0c3 131 | Location | |
c448e19b 132 And I press "Save"
9a3ee0c3
MH
133 And I should see "Mediocre event"
134 And I click on "Mediocre event :(" "link"
ed84d85f 135 Then I should see "Mediocre event"
9a3ee0c3 136 And ".location-content" "css_element" should not exist
7b792492
SL
137
138 @javascript
139 Scenario: Module events editing
140 Given I log in as "admin"
141 And I am on "Course 1" course homepage with editing mode on
142 And the following "activities" exist:
143 | activity | course | idnumber | name | intro | timeopen | timeclose |
144 | choice | C1 | choice1 | Test choice | Test choice description | ##today## | ##today## |
145 When I follow "This month"
345f23c9
AN
146 Then I should see "Test choice opens"
147 And I should see "Test choice closes"
148 When I click on "Test choice opens" "link"
705003be
AN
149 Then "Delete" "button" should not exist in the "Test choice opens" "dialogue"
150 And "Edit" "button" should not exist in the "Test choice opens" "dialogue"
2e36c426 151 And I should see "Course event"
7b792492
SL
152 When I click on "Go to activity" "link"
153 And I wait to be redirected
154 Then I should see "Test choice"
155 And I am on "Course 1" course homepage
156 And I follow "This month"
345f23c9 157 When I click on "Test choice closes" "link"
705003be
AN
158 Then "Delete" "button" should not exist in the "Test choice closes" "dialogue"
159 And "Edit" "button" should not exist in the "Test choice closes" "dialogue"
2e36c426 160 And I should see "Course event"
7b792492
SL
161 When I click on "Go to activity" "link"
162 And I wait to be redirected
163 Then I should see "Test choice"
23b05f18
SL
164
165 @javascript
166 Scenario: Attempt to create event without fill required fields should display validation errors
167 Given I log in as "teacher1"
168 And I am on "Course 1" course homepage
169 And I follow "This month"
170 And I click on "New event" "button"
171 When I click on "Save" "button"
669d54a4 172 Then I should see "Required" in the "Event title" "form_row"
2585f77a
AN
173 And I am on homepage
174 And I follow "This month"
23b05f18 175 And I click on "New event" "button"
23b05f18 176 And I set the field "Event title" to "Really awesome event!"
669d54a4 177 And I set the field "Type of event" to "Course"
23b05f18 178 When I click on "Save" "button"
669d54a4 179 And I should see "Select a course" in the "Course" "form_row"