MDL-59687 core_calendar: create event step needs to wait page ready
[moodle.git] / calendar / tests / behat / calendar.feature
CommitLineData
c448e19b 1@core @core_calendar @javascript
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 |
bcd5c6a9
MN
29
30 Scenario: Create a site event
c448e19b
SL
31 Given I log in as "admin"
32 And I am on "Course 1" course homepage with editing mode on
33 And I add the "Calendar" block
bcd5c6a9
MN
34 And I create a calendar event with form data:
35 | Type of event | site |
36 | Event title | Really awesome event! |
37 | Description | Come join this awesome event, sucka! |
38 And I log out
39 And I log in as "student1"
fdeeaff9 40 And I am on "Course 1" course homepage
bcd5c6a9
MN
41 And I follow "This month"
42 And I should see "Really awesome event!"
43 And I log out
44 And I log in as "student2"
45 And I follow "This month"
46 And I should see "Really awesome event!"
c448e19b 47 And I log out
bcd5c6a9
MN
48
49 Scenario: Create a course event
c448e19b
SL
50 Given I log in as "admin"
51 And I am on "Course 1" course homepage with editing mode on
52 And I add the "Calendar" block
53 And I log out
54 And I log in as "teacher1"
bcd5c6a9
MN
55 And I create a calendar event with form data:
56 | Type of event | course |
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"
fdeeaff9 61 And I am on "Course 1" course homepage
bcd5c6a9
MN
62 And I follow "This month"
63 And I should see "Really awesome event!"
64 And I log out
65 And I log in as "student2"
66 And I follow "This month"
67 And I should not see "Really awesome event!"
c448e19b 68 And I log out
bcd5c6a9 69
c9653460 70 Scenario: Create a group event
c448e19b
SL
71 Given I log in as "admin"
72 And I am on "Course 1" course homepage with editing mode on
73 And I add the "Calendar" block
74 And I log out
75 And I log in as "teacher1"
c9653460
MG
76 And I create a calendar event with form data:
77 | Type of event | group |
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"
fdeeaff9 82 And I am on "Course 1" course homepage
c9653460
MG
83 And I follow "This month"
84 And I follow "Really awesome event!"
c9653460 85
bcd5c6a9 86 Scenario: Create a user event
c448e19b
SL
87 Given I log in as "admin"
88 And I am on "Course 1" course homepage with editing mode on
89 And I add the "Calendar" block
bcd5c6a9
MN
90 And I create a calendar event with form data:
91 | Type of event | user |
92 | Event title | Really awesome event! |
93 | Description | Come join this awesome event, sucka! |
94 And I log out
95 And I log in as "student1"
fdeeaff9 96 And I am on "Course 1" course homepage
bcd5c6a9
MN
97 And I follow "This month"
98 And I should not see "Really awesome event!"
99
100 Scenario: Delete an event
c448e19b
SL
101 Given I log in as "admin"
102 And I am on "Course 1" course homepage with editing mode on
103 And I add the "Calendar" block
104 And I log out
105 And 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
SL
110 And I am on "Course 1" course homepage
111 And I follow "This month"
112 And I click on "Really awesome event!" "link"
bcd5c6a9 113 And I click on "Delete" "button"
c448e19b
SL
114 And I click on "Yes" "button"
115 And I wait to be redirected
bcd5c6a9
MN
116 And I should not see "Really awesome event!"
117
118 Scenario: Edit an event
c448e19b
SL
119 Given I log in as "admin"
120 And I am on "Course 1" course homepage with editing mode on
121 And I add the "Calendar" block
bcd5c6a9
MN
122 And I create a calendar event with form data:
123 | Type of event | user |
124 | Event title | Really awesome event! |
125 | Description | Come join this awesome event, sucka! |
c448e19b
SL
126 And I am on "Course 1" course homepage
127 And I follow "This month"
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. |
c448e19b 133 And I press "Save"
bcd5c6a9 134 And I should see "Mediocre event"