MDL-71817 calendar: behat changes for calendar block
[moodle.git] / blocks / calendar_month / tests / behat / block_calendar_month.feature
blobd97b494dd5a080ddc5d1038c67edb243bcd1ed47
1 @block @block_calendar_month
2 Feature: Enable the calendar block in a course and test it's functionality
3   In order to enable the calendar block in a course
4   As a teacher
5   I can add the calendar block to a course
7   Background:
8     Given the following "users" exist:
9       | username | firstname | lastname | email | idnumber |
10       | teacher1 | Teacher | 1 | teacher1@example.com | T1 |
11       | student1 | Student | 1 | student1@example.com | S1 |
12       | student2 | Student | 2 | student2@example.com | S2 |
13     And the following "courses" exist:
14       | fullname | shortname | category |
15       | Course 1 | C1 | 0 |
16     And the following "course enrolments" exist:
17       | user | course | role |
18       | teacher1 | C1 | editingteacher |
19       | student1 | C1 | student |
20       | student2 | C1 | student |
22   Scenario: Add the block to a the course
23     Given I log in as "teacher1"
24     And I am on "Course 1" course homepage with editing mode on
25     When I add the "Calendar" block
26     Then "Calendar" "block" should exist
28   @javascript
29   Scenario: View a site event in the calendar block
30     Given I log in as "admin"
31     And I create a calendar event with form data:
32       | id_eventtype | Site |
33       | id_name | Site Event |
34     And I log out
35     When I log in as "teacher1"
36     And I am on "Course 1" course homepage with editing mode on
37     And I add the "Calendar" block
38     Then I should see "Site Event"
40   @javascript
41   Scenario: Filter site events in the calendar block
42     Given I log in as "admin"
43     And I create a calendar event with form data:
44       | id_eventtype | Site |
45       | id_name | Site Event |
46     And I log out
47     When I log in as "teacher1"
48     And I am on "Course 1" course homepage with editing mode on
49     And I add the "Calendar" block
50     And I create a calendar event with form data:
51       | id_eventtype | Course |
52       | id_name | Course Event |
53     And I am on "Course 1" course homepage
54     And I follow "Hide site events"
55     Then I should not see "Site Event"
56     And I should see "Course Event"
58   @javascript
59   Scenario: View a course event in the calendar block
60     Given I log in as "teacher1"
61     And I am on "Course 1" course homepage with editing mode on
62     And I add the "Calendar" block
63     And I create a calendar event with form data:
64       | id_eventtype | Course |
65       | id_name | Course Event |
66     When I am on "Course 1" course homepage
67     Then I should see "Course Event"
69   @javascript
70   Scenario: Filter course events in the calendar block
71     Given I log in as "teacher1"
72     And I am on "Course 1" course homepage with editing mode on
73     And I add the "Calendar" block
74     And I create a calendar event with form data:
75       | id_eventtype | Course |
76       | id_name | Course Event |
77     And I am on "Course 1" course homepage
78     And I create a calendar event with form data:
79       | id_eventtype | User |
80       | id_name | User Event |
81     And I am on "Course 1" course homepage
82     And I follow "Hide course events"
83     Then I should not see "Course Event"
84     And I should see "User Event"
86   @javascript
87   Scenario: View a user event in the calendar block
88     Given I log in as "teacher1"
89     And I am on "Course 1" course homepage with editing mode on
90     And I add the "Calendar" block
91     And I create a calendar event with form data:
92       | id_eventtype | User |
93       | id_name | User Event |
94     When I am on "Course 1" course homepage
95     Then I should see "User Event"
97   @javascript
98   Scenario: Filter user events in the calendar block
99     Given I log in as "teacher1"
100     And I am on "Course 1" course homepage with editing mode on
101     And I add the "Calendar" block
102     And I create a calendar event with form data:
103       | id_eventtype | Course |
104       | id_name | Course Event |
105     And I am on "Course 1" course homepage
106     And I create a calendar event with form data:
107       | id_eventtype | User |
108       | id_name | User Event |
109     When I am on "Course 1" course homepage
110     And I follow "Hide user events"
111     Then I should not see "User Event"
112     And I should see "Course Event"
114   @javascript
115   Scenario: View a group event in the calendar block
116     Given the following "groups" exist:
117       | name    | course | idnumber |
118       | Group 1 | C1     | G1       |
119       | Group 2 | C1     | G2       |
120     And the following "group members" exist:
121       | user     | group   |
122       | student1 | G1 |
123       | student2 | G2 |
124     When I log in as "teacher1"
125     And I am on "Course 1" course homepage
126     And I navigate to "Edit settings" in current page administration
127     And I set the following fields to these values:
128       | id_groupmode | Separate groups |
129       | id_groupmodeforce | Yes |
130     And I press "Save and display"
131     And I turn editing mode on
132     And I add the "Calendar" block
133     And I click on "Full calendar" "link"
134     And I click on "New event" "button"
135     And I set the following fields to these values:
136       | id_eventtype | Group |
137       | id_name | Group Event |
138     And I set the following fields to these values:
139       | Group | Group 1 |
140     And I press "Save"
141     And I log out
142     Then I log in as "student1"
143     And I am on "Course 1" course homepage
144     And I should see "Group Event"
145     And I log out
146     And I log in as "student2"
147     And I am on "Course 1" course homepage
148     And I should not see "Group Event"
150   @javascript
151   Scenario: Filter group events in the calendar block
152     Given the following "groups" exist:
153       | name    | course | idnumber |
154       | Group 1 | C1     | G1       |
155       | Group 2 | C1     | G2       |
156     And the following "group members" exist:
157       | user     | group   |
158       | student1 | G1 |
159       | student2 | G2 |
160     When I log in as "teacher1"
161     And I am on "Course 1" course homepage
162     And I navigate to "Edit settings" in current page administration
163     And I set the following fields to these values:
164       | id_groupmode | Separate groups |
165       | id_groupmodeforce | Yes |
166     And I press "Save and display"
167     And I turn editing mode on
168     And I add the "Calendar" block
169     And I create a calendar event with form data:
170       | id_eventtype | Course |
171       | id_name | Course Event 1 |
172     And I am on "Course 1" course homepage
173     And I click on "Full calendar" "link"
174     And I click on "New event" "button"
175     And I set the following fields to these values:
176       | id_eventtype | Group |
177       | id_name | Group Event 1 |
178     And I set the following fields to these values:
179       | Group | Group 1 |
180     And I press "Save"
181     And I log out
182     Then I log in as "student1"
183     And I am on "Course 1" course homepage
184     And I follow "Hide group events"
185     And I should not see "Group Event 1"
186     And I should see "Course Event 1"