MDL-41792 core_calendar: added some behat tests to cover calendar functionality
[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:
8 Given the following "users" exists:
9 | username | firstname | lastname | email |
10 | student1 | Student | 1 | student1@asd.com |
11 | student2 | Student | 2 | student2@asd.com |
12 And the following "courses" exists:
13 | fullname | shortname | format |
14 | Course 1 | C1 | topics |
15 And the following "course enrolments" exists:
16 | user | course | role |
17 | student1 | C1 | student |
18 When I log in as "admin"
19 And I follow "Course 1"
20 And I turn editing mode on
21 And I add the "Calendar" block
22
23 Scenario: Create a site event
24 And I create a calendar event with form data:
25 | Type of event | site |
26 | Event title | Really awesome event! |
27 | Description | Come join this awesome event, sucka! |
28 And I log out
29 And I log in as "student1"
30 And I follow "Course 1"
31 And I follow "This month"
32 And I should see "Really awesome event!"
33 And I log out
34 And I log in as "student2"
35 And I follow "This month"
36 And I should see "Really awesome event!"
37
38 Scenario: Create a course event
39 And I create a calendar event with form data:
40 | Type of event | course |
41 | Event title | Really awesome event! |
42 | Description | Come join this awesome event, sucka! |
43 And I log out
44 And I log in as "student1"
45 And I follow "Course 1"
46 And I follow "This month"
47 And I should see "Really awesome event!"
48 And I log out
49 And I log in as "student2"
50 And I follow "This month"
51 And I should not see "Really awesome event!"
52
53 Scenario: Create a user event
54 And I create a calendar event with form data:
55 | Type of event | user |
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"
60 And I follow "Course 1"
61 And I follow "This month"
62 And I should not see "Really awesome event!"
63
64 Scenario: Delete an event
65 And I create a calendar event with form data:
66 | Type of event | user |
67 | Event title | Really awesome event! |
68 | Description | Come join this awesome event, sucka! |
69 And I click on "//div[@class='commands']//a[contains(@href, 'delete')]" "xpath_element"
70 And I click on "Delete" "button"
71 And I should not see "Really awesome event!"
72
73 Scenario: Edit an event
74 And I create a calendar event with form data:
75 | Type of event | user |
76 | Event title | Really awesome event! |
77 | Description | Come join this awesome event, sucka! |
78 And I click on "//div[@class='commands']//a[contains(@href, 'edit')]" "xpath_element"
79 And I fill the moodle form with:
80 | Event title | Mediocre event :( |
81 | Description | Wait, this event isn't that great. |
82 And I press "Save changes"
83 And I should see "Mediocre event"
84