MDL-59382 core_calendar: change behat step
[moodle.git] / calendar / tests / behat / calendar.feature
CommitLineData
bcd5c6a9
MN
1@core @core_calendar
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 |
759b323e 13 And the following "courses" exist:
bcd5c6a9
MN
14 | fullname | shortname | format |
15 | Course 1 | C1 | topics |
759b323e 16 And the following "course enrolments" exist:
bcd5c6a9
MN
17 | user | course | role |
18 | student1 | C1 | student |
c9653460
MG
19 | student3 | C1 | student |
20 And the following "groups" exist:
21 | name | course | idnumber |
22 | Group 1 | C1 | G1 |
23 And the following "group members" exist:
24 | user | group |
25 | student1 | G1 |
bcd5c6a9 26 When I log in as "admin"
fdeeaff9 27 And I am on "Course 1" course homepage with editing mode on
bcd5c6a9
MN
28 And I add the "Calendar" block
29
30 Scenario: Create a site event
31 And I create a calendar event with form data:
32 | Type of event | site |
33 | Event title | Really awesome event! |
34 | Description | Come join this awesome event, sucka! |
35 And I log out
36 And I log in as "student1"
fdeeaff9 37 And I am on "Course 1" course homepage
bcd5c6a9
MN
38 And I follow "This month"
39 And I should see "Really awesome event!"
40 And I log out
41 And I log in as "student2"
42 And I follow "This month"
43 And I should see "Really awesome event!"
44
45 Scenario: Create a course event
46 And I create a calendar event with form data:
47 | Type of event | course |
48 | Event title | Really awesome event! |
49 | Description | Come join this awesome event, sucka! |
50 And I log out
51 And I log in as "student1"
fdeeaff9 52 And I am on "Course 1" course homepage
bcd5c6a9
MN
53 And I follow "This month"
54 And I should see "Really awesome event!"
55 And I log out
56 And I log in as "student2"
57 And I follow "This month"
58 And I should not see "Really awesome event!"
59
c9653460
MG
60 Scenario: Create a group event
61 And I create a calendar event with form data:
62 | Type of event | group |
63 | Group | Group 1 |
64 | Event title | Really awesome event! |
65 | Description | Come join this awesome event |
66 And I log out
67 And I log in as "student1"
fdeeaff9 68 And I am on "Course 1" course homepage
c9653460
MG
69 And I follow "This month"
70 And I follow "Really awesome event!"
71 And "Group 1" "text" should exist in the ".eventlist" "css_element"
72 And I log out
73 And I log in as "student3"
74 And I follow "This month"
75 And I should not see "Really awesome event!"
76
bcd5c6a9
MN
77 Scenario: Create a user event
78 And I create a calendar event with form data:
79 | Type of event | user |
80 | Event title | Really awesome event! |
81 | Description | Come join this awesome event, sucka! |
82 And I log out
83 And I log in as "student1"
fdeeaff9 84 And I am on "Course 1" course homepage
bcd5c6a9
MN
85 And I follow "This month"
86 And I should not see "Really awesome event!"
87
88 Scenario: Delete an event
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! |
b35c209d 93 And I click on "Delete event" "link" in the ".event div.commands" "css_element"
bcd5c6a9
MN
94 And I click on "Delete" "button"
95 And I should not see "Really awesome event!"
96
97 Scenario: Edit an event
98 And I create a calendar event with form data:
99 | Type of event | user |
100 | Event title | Really awesome event! |
101 | Description | Come join this awesome event, sucka! |
b35c209d 102 And I click on "Edit event" "link" in the ".event div.commands" "css_element"
f083d614 103 And I set the following fields to these values:
bcd5c6a9
MN
104 | Event title | Mediocre event :( |
105 | Description | Wait, this event isn't that great. |
106 And I press "Save changes"
107 And I should see "Mediocre event"