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 |
56 | Event title | Really awesome event! |
57 | Description | Come join this awesome event, sucka! |
59 And I log in as "student1"
60 When I am on "Course 1" course homepage
61 And I follow "This month"
62 And I click on "Really awesome event!" "link"
63 And "C1" "link" should exist in the ".modal-body" "css_element"
64 And I click on ".close" "css_element"
66 And I log in as "student2"
67 And I follow "This month"
68 Then I should not see "Really awesome event!"
71 Scenario: Create a group event
72 Given I log in as "teacher1"
73 And I create a calendar event with form data:
74 | Type of event | group |
75 | Event title | Really awesome event! |
76 | Description | Come join this awesome event |
78 And I log in as "student1"
79 When I am on "Course 1" course homepage
80 And I follow "This month"
81 Then I follow "Really awesome event!"
84 Scenario: Create a user event
85 Given I log in as "teacher1"
86 And I create a calendar event with form data:
87 | Type of event | user |
88 | Event title | Really awesome event! |
89 | Description | Come join this awesome event, sucka! |
91 And I log in as "student1"
92 When I am on "Course 1" course homepage
93 And I follow "This month"
94 Then I should not see "Really awesome event!"
97 Scenario: Delete an event
98 Given I log in as "teacher1"
99 And I create a calendar event with form data:
100 | Type of event | user |
101 | Event title | Really awesome event! |
102 | Description | Come join this awesome event, sucka! |
103 And I am on "Course 1" course homepage
104 When I follow "This month"
105 And I click on "Really awesome event!" "link"
106 And I click on "Delete" "button"
107 And I click on "Yes" "button"
108 And I wait to be redirected
109 Then I should not see "Really awesome event!"
112 Scenario: Edit an event
113 Given I log in as "teacher1"
114 And I create a calendar event with form data:
115 | Type of event | user |
116 | Event title | Really awesome event! |
117 | Description | Come join this awesome event, sucka! |
118 And I am on "Course 1" course homepage
119 When I follow "This month"
120 And I click on "Really awesome event!" "link"
121 And I click on "Edit" "button"
122 And I set the following fields to these values:
123 | Event title | Mediocre event :( |
124 | Description | Wait, this event isn't that great. |
126 Then I should see "Mediocre event"
129 Scenario: Module events editing
130 Given I log in as "admin"
131 And I am on "Course 1" course homepage with editing mode on
132 And the following "activities" exist:
133 | activity | course | idnumber | name | intro | timeopen | timeclose |
134 | choice | C1 | choice1 | Test choice 1 | Test choice description | ##yesterday## | ##tomorrow## |
135 When I follow "This month"
136 Then I should see "Choice Test choice 1 open"
137 And I should see "Choice Test choice 1 close"
138 When I click on "Choice Test choice 1 open" "link"
139 Then "Delete" "button" should not exist
140 And I should see "Open event"
141 And "Edit" "button" should exist
142 When I click on "Edit" "button"
143 And I wait to be redirected
144 Then I should see "Updating: Choice"
145 And I am on "Course 1" course homepage
146 And I follow "This month"
147 When I click on "Choice Test choice 1 close" "link"
148 Then "Delete" "button" should not exist
149 And I should see "Close event"
150 And "Edit" "button" should exist
151 When I click on "Edit" "button"
152 And I wait to be redirected
153 Then I should see "Updating: Choice"