MDL-60537 tool_httpsreplace: Fix behat following langstring
[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"
bcd5c6a9 109 And I click on "Delete" "button"
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! |
c448e19b 121 And I am on "Course 1" course homepage
ed84d85f 122 When I follow "This month"
c448e19b
SL
123 And I click on "Really awesome event!" "link"
124 And I click on "Edit" "button"
f083d614 125 And I set the following fields to these values:
bcd5c6a9
MN
126 | Event title | Mediocre event :( |
127 | Description | Wait, this event isn't that great. |
c448e19b 128 And I press "Save"
ed84d85f 129 Then I should see "Mediocre event"
7b792492
SL
130
131 @javascript
132 Scenario: Module events editing
133 Given I log in as "admin"
134 And I am on "Course 1" course homepage with editing mode on
135 And the following "activities" exist:
136 | activity | course | idnumber | name | intro | timeopen | timeclose |
137 | choice | C1 | choice1 | Test choice | Test choice description | ##today## | ##today## |
138 When I follow "This month"
139 Then I should see "Choice Test choice open"
140 And I should see "Choice Test choice close"
141 When I click on "Choice Test choice open" "link"
142 Then "Delete" "button" should not exist
143 And "Edit" "button" should not exist
144 And I should see "Open event"
145 When I click on "Go to activity" "link"
146 And I wait to be redirected
147 Then I should see "Test choice"
148 And I am on "Course 1" course homepage
149 And I follow "This month"
150 When I click on "Choice Test choice close" "link"
151 Then "Delete" "button" should not exist
152 And "Edit" "button" should not exist
153 And I should see "Close event"
154 When I click on "Go to activity" "link"
155 And I wait to be redirected
156 Then I should see "Test choice"