MDL-59860 core_calendar: fix behat failures
[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 |
56 | Event title | Really awesome event! |
57 | Description | Come join this awesome event, sucka! |
58 And I log out
59 And I log in as "student1"
ed84d85f 60 When I am on "Course 1" course homepage
bcd5c6a9 61 And I follow "This month"
21e3d8b8
SL
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"
bcd5c6a9
MN
65 And I log out
66 And I log in as "student2"
67 And I follow "This month"
1228bb6c 68 Then I should not see "Really awesome event!"
bcd5c6a9 69
ed84d85f 70 @javascript
c9653460 71 Scenario: Create a group event
ed84d85f 72 Given I log in as "teacher1"
c9653460
MG
73 And I create a calendar event with form data:
74 | Type of event | group |
c9653460
MG
75 | Event title | Really awesome event! |
76 | Description | Come join this awesome event |
77 And I log out
78 And I log in as "student1"
ed84d85f 79 When I am on "Course 1" course homepage
c9653460 80 And I follow "This month"
ed84d85f 81 Then I follow "Really awesome event!"
c9653460 82
ed84d85f 83 @javascript
bcd5c6a9 84 Scenario: Create a user event
ed84d85f 85 Given I log in as "teacher1"
bcd5c6a9
MN
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! |
90 And I log out
91 And I log in as "student1"
ed84d85f 92 When I am on "Course 1" course homepage
bcd5c6a9 93 And I follow "This month"
ed84d85f 94 Then I should not see "Really awesome event!"
bcd5c6a9 95
ed84d85f 96 @javascript
bcd5c6a9 97 Scenario: Delete an event
ed84d85f 98 Given I log in as "teacher1"
bcd5c6a9
MN
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! |
c448e19b 103 And I am on "Course 1" course homepage
ed84d85f 104 When I follow "This month"
c448e19b 105 And I click on "Really awesome event!" "link"
bcd5c6a9 106 And I click on "Delete" "button"
c448e19b
SL
107 And I click on "Yes" "button"
108 And I wait to be redirected
ed84d85f 109 Then I should not see "Really awesome event!"
bcd5c6a9 110
ed84d85f 111 @javascript
bcd5c6a9 112 Scenario: Edit an event
ed84d85f 113 Given I log in as "teacher1"
bcd5c6a9
MN
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! |
c448e19b 118 And I am on "Course 1" course homepage
ed84d85f 119 When I follow "This month"
c448e19b
SL
120 And I click on "Really awesome event!" "link"
121 And I click on "Edit" "button"
f083d614 122 And I set the following fields to these values:
bcd5c6a9
MN
123 | Event title | Mediocre event :( |
124 | Description | Wait, this event isn't that great. |
c448e19b 125 And I press "Save"
ed84d85f 126 Then I should see "Mediocre event"
6a87019b 127
1228bb6c 128 @javascript
6a87019b
SL
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## |
6a87019b
SL
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"