MDL-37624 calendar: Added location support
[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! |
ef4e04ee 41 | Location | Cube office |
bcd5c6a9
MN
42 And I log out
43 And I log in as "student1"
fdeeaff9 44 And I am on "Course 1" course homepage
bcd5c6a9
MN
45 And I follow "This month"
46 And I should see "Really awesome event!"
47 And I log out
48 And I log in as "student2"
49 And I follow "This month"
50 And I should see "Really awesome event!"
51
ed84d85f 52 @javascript
bcd5c6a9 53 Scenario: Create a course event
ed84d85f 54 Given I log in as "teacher1"
bcd5c6a9
MN
55 And I create a calendar event with form data:
56 | Type of event | course |
de6d57cf 57 | Course | Course 1 |
bcd5c6a9
MN
58 | Event title | Really awesome event! |
59 | Description | Come join this awesome event, sucka! |
ef4e04ee 60 | Location | Cube office |
bcd5c6a9
MN
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 |
ef4e04ee 82 | Location | Cube office |
c9653460
MG
83 And I log out
84 And I log in as "student1"
ed84d85f 85 When I am on "Course 1" course homepage
c9653460 86 And I follow "This month"
ed84d85f 87 Then I follow "Really awesome event!"
c9653460 88
ed84d85f 89 @javascript
bcd5c6a9 90 Scenario: Create a user event
ed84d85f 91 Given I log in as "teacher1"
bcd5c6a9
MN
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! |
ef4e04ee 96 | Location | Cube office |
bcd5c6a9
MN
97 And I log out
98 And I log in as "student1"
ed84d85f 99 When I am on "Course 1" course homepage
bcd5c6a9 100 And I follow "This month"
ed84d85f 101 Then I should not see "Really awesome event!"
bcd5c6a9 102
ed84d85f 103 @javascript
bcd5c6a9 104 Scenario: Delete an event
ed84d85f 105 Given I log in as "teacher1"
bcd5c6a9
MN
106 And I create a calendar event with form data:
107 | Type of event | user |
108 | Event title | Really awesome event! |
109 | Description | Come join this awesome event, sucka! |
c448e19b 110 And I am on "Course 1" course homepage
ed84d85f 111 When I follow "This month"
c448e19b 112 And I click on "Really awesome event!" "link"
bcd5c6a9 113 And I click on "Delete" "button"
fb7fa04e 114 And I click on "Delete event" "button"
c448e19b 115 And I wait to be redirected
ed84d85f 116 Then I should not see "Really awesome event!"
bcd5c6a9 117
ed84d85f 118 @javascript
bcd5c6a9 119 Scenario: Edit an event
ed84d85f 120 Given I log in as "teacher1"
bcd5c6a9
MN
121 And I create a calendar event with form data:
122 | Type of event | user |
123 | Event title | Really awesome event! |
124 | Description | Come join this awesome event, sucka! |
ef4e04ee 125 | Location | Cube office |
c448e19b 126 And I am on "Course 1" course homepage
ed84d85f 127 When I follow "This month"
c448e19b
SL
128 And I click on "Really awesome event!" "link"
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. |
ef4e04ee 133 | Location | The park |
c448e19b 134 And I press "Save"
ed84d85f 135 Then I should see "Mediocre event"
7b792492
SL
136
137 @javascript
138 Scenario: Module events editing
139 Given I log in as "admin"
140 And I am on "Course 1" course homepage with editing mode on
141 And the following "activities" exist:
142 | activity | course | idnumber | name | intro | timeopen | timeclose |
143 | choice | C1 | choice1 | Test choice | Test choice description | ##today## | ##today## |
144 When I follow "This month"
345f23c9
AN
145 Then I should see "Test choice opens"
146 And I should see "Test choice closes"
147 When I click on "Test choice opens" "link"
7b792492
SL
148 Then "Delete" "button" should not exist
149 And "Edit" "button" should not exist
2e36c426 150 And I should see "Course event"
7b792492
SL
151 When I click on "Go to activity" "link"
152 And I wait to be redirected
153 Then I should see "Test choice"
154 And I am on "Course 1" course homepage
155 And I follow "This month"
345f23c9 156 When I click on "Test choice closes" "link"
7b792492
SL
157 Then "Delete" "button" should not exist
158 And "Edit" "button" should not exist
2e36c426 159 And I should see "Course event"
7b792492
SL
160 When I click on "Go to activity" "link"
161 And I wait to be redirected
162 Then I should see "Test choice"