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 And the following "course enrolments" exist:
18 | user | course | role |
19 | student1 | C1 | student |
20 | student3 | C1 | student |
21 | teacher1 | C1 | teacher |
22 And the following "groups" exist:
23 | name | course | idnumber |
25 And the following "group members" exist:
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
35 Scenario: Create a site event
36 Given I log in as "admin"
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! |
42 And I log in as "student1"
43 And I am on "Course 1" course homepage
44 And I follow "This month"
45 And I should see "Really awesome event!"
47 And I log in as "student2"
48 And I follow "This month"
49 And I should see "Really awesome event!"
52 Scenario: Create a course event
53 Given I log in as "teacher1"
54 And I create a calendar event with form data:
55 | Type of event | course |
57 | Event title | Really awesome event! |
58 | Description | Come join this awesome event, sucka! |
60 And I log in as "student1"
61 When I am on "Course 1" course homepage
62 And I follow "This month"
63 And I click on "Really awesome event!" "link"
64 And "Course 1" "link" should exist in the "Really awesome event!" "dialogue"
65 And I click on "Close" "button"
67 And I log in as "student2"
68 And I follow "This month"
69 Then I should not see "Really awesome event!"
72 Scenario: Create a group event
73 Given I log in as "teacher1"
74 And I am on "Course 1" course homepage
75 And I create a calendar event with form data:
76 | Type of event | group |
78 | Event title | Really awesome event! |
79 | Description | Come join this awesome event |
81 And I log in as "student1"
82 When I am on "Course 1" course homepage
83 And I follow "This month"
84 Then I follow "Really awesome event!"
87 Scenario: Create a user event
88 Given I log in as "teacher1"
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! |
94 And I log in as "student1"
95 When I am on "Course 1" course homepage
96 And I follow "This month"
97 Then I should not see "Really awesome event!"
100 Scenario: Delete an event
101 Given I log in as "teacher1"
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! |
106 And I am on "Course 1" course homepage
107 When I follow "This month"
108 And I click on "Really awesome event!" "link"
109 And I click on "Delete" "button" in the "Really awesome event!" "dialogue"
110 And I click on "Delete event" "button"
111 And I wait to be redirected
112 Then I should not see "Really awesome event!"
115 Scenario: Edit an event
116 Given I log in as "teacher1"
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! |
121 | Location | Cube office |
122 And I am on "Course 1" course homepage
123 When I follow "This month"
124 And I click on "Really awesome event!" "link"
125 And ".location-content" "css_element" should exist
126 And I should see "Cube office"
127 And I click on "Edit" "button"
128 And I set the following fields to these values:
129 | Event title | Mediocre event :( |
130 | Description | Wait, this event isn't that great. |
133 And I should see "Mediocre event"
134 And I click on "Mediocre event :(" "link"
135 Then I should see "Mediocre event"
136 And ".location-content" "css_element" should not exist
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"
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"
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"
151 And I should see "Course event"
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"
157 When I click on "Test choice closes" "link"
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"
160 And I should see "Course event"
161 When I click on "Go to activity" "link"
162 And I wait to be redirected
163 Then I should see "Test choice"
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"
172 Then I should see "Required" in the "Event title" "form_row"
174 And I follow "This month"
175 And I click on "New event" "button"
176 And I set the field "Event title" to "Really awesome event!"
177 And I set the field "Type of event" to "Course"
178 When I click on "Save" "button"
179 And I should see "Select a course" in the "Course" "form_row"