-
Notifications
You must be signed in to change notification settings - Fork 60
/
Copy paththeme_boost_union_menu_rules.feature
244 lines (237 loc) · 11 KB
/
theme_boost_union_menu_rules.feature
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
@theme @theme_boost_union @theme_boost_union_smartmenu @theme_boost_union_menurules
Feature: Configuring the theme_boost_union plugin on the "Smart menus" page, applying different configuration to the individual smart menus
In order to use th features
As admin
I need to be able to configure the theme Boost Union plugin
Background:
Given I log in as "admin"
And I navigate to "Language > Language packs" in site administration
And I set the field "Available language packs" to "fr"
When I press "Install selected language pack(s)"
Then I should see "Language pack 'fr' was successfully installed"
And I set the field "Available language packs" to "de"
When I press "Install selected language pack(s)"
Then I should see "Language pack 'de' was successfully installed"
And I am on homepage
Given the following "courses" exist:
| fullname| shortname | category |
| Test | C1 | 0 |
And the following "users" exist:
| username | firstname | lastname | email |
| student1 | student | User 1 | [email protected] |
| student2 | student2 | User 2 | [email protected] |
| teacher | Teacher | User 1 | [email protected] |
And the following "course enrolments" exist:
| user | course | role |
| teacher | C1 | editingteacher |
| student1 | C1 | student |
| admin | C1 | manager |
And the following "cohorts" exist:
| name | idnumber |
| Cohort 1 | CH1 |
| Cohort 2 | CH2 |
And the following "cohort members" exist:
| user | cohort |
| student1 | CH1 |
| teacher | CH2 |
And I create menu with the following fields to these values:
| Title | Quick Links |
| Locations | Main, Menu, User, Bottom |
And I set "Quick Links" items with the following fields to these values:
| Title | Resources |
| Type | Static |
| URL | https://moodle.org |
@javascript
Scenario: Smartmenu: Access Rules - Based on the user roles
Given I log in as "admin"
And I navigate to smartmenus
And I create menu with the following fields to these values:
| Title | Notifications |
| Locations | Main, Menu, User, Bottom |
And I should see "Quick Links" in the "smartmenus" "table"
And I should see menu "Quick Links" in location "Main, Menu, User, Bottom"
Then I click on ".action-edit" "css_element" in the "Quick Links" "table_row"
And I expand all fieldsets
And I set the field "By role" to "Manager"
And I click on "Save and return" "button"
And I should see "Quick Links" in the ".primary-navigation" "css_element"
Then I log out
And I log in as "student1"
And I should not see menu "Quick Links" in location "Main, Menu, User, Bottom"
And I log out
Then I log in as "admin"
And I navigate to smartmenus
And I click on ".action-edit" "css_element" in the "Quick Links" "table_row"
And I expand all fieldsets
And I set the field "By role" to "Manager, Student"
And I click on "Save and return" "button"
And I log out
Then I log in as "student1"
And I should see menu "Quick Links" in location "Main, Menu, User, Bottom"
And I log out
When I log in as "teacher"
And I should not see menu "Quick Links" in location "Main, Menu, User, Bottom"
And I log out
Then I log in as "admin"
And I navigate to smartmenus
Then I click on ".action-edit" "css_element" in the "Quick Links" "table_row"
And I expand all fieldsets
And I set the field "By role" to "Manager, Student, Teacher"
And I click on "Save and return" "button"
And I log out
Then I log in as "teacher"
And I should see menu "Quick Links" in location "Main, Menu, User, Bottom"
@javascript
Scenario: Smartmenu: Access Rules - Based on the user assignment in cohorts
Given I navigate to smartmenus
And I create menu with the following fields to these values:
| Title | Notifications |
| Locations | Main, Menu, User, Bottom |
And I should see "Quick Links" in the "smartmenus" "table"
And I should see menu "Quick Links" in location "Main, Menu, User, Bottom"
Then I click on ".action-edit" "css_element" in the "Quick Links" "table_row"
And I expand all fieldsets
And I set the field "By cohort" to "Cohort 1"
And I click on "Save and return" "button"
And I should not see "Quick Links" in the ".primary-navigation" "css_element"
Then I log out
And I log in as "student1"
And I should see menu "Quick Links" in location "Main, Menu, User, Bottom"
And I log out
When I log in as "teacher"
And I should not see menu "Quick Links" in location "Main, Menu, User, Bottom"
And I log out
Then I log in as "admin"
And I add "teacher" user to "CH1" cohort members
And I log out
Then I log in as "teacher"
And I should see menu "Quick Links" in location "Main, Menu, User, Bottom"
@javascript
Scenario: Smartmenu: Access Rules - Based on the user assignments in multiple cohorts
Given I navigate to smartmenus
And I create menu with the following fields to these values:
| Title | Notifications |
| Locations | Main, Menu, User, Bottom |
And I should see "Quick Links" in the "smartmenus" "table"
And I should see menu "Quick Links" in location "Main, Menu, User, Bottom"
Then I click on ".action-edit" "css_element" in the "Quick Links" "table_row"
And I expand all fieldsets
And I set the field "By cohort" to "Cohort 1, Cohort 2"
And I set the field "Operator" to "Any"
And I click on "Save and return" "button"
And I should not see "Quick Links" in the ".primary-navigation" "css_element"
Then I log out
And I log in as "student1"
And I should see menu "Quick Links" in location "Main, Menu, User, Bottom"
And I log out
When I log in as "teacher"
And I should see menu "Quick Links" in location "Main, Menu, User, Bottom"
And I log out
Then I log in as "admin"
And I navigate to smartmenus
Then I click on ".action-edit" "css_element" in the "Quick Links" "table_row"
And I expand all fieldsets
And I set the field "Operator" to "All"
And I click on "Save and return" "button"
And I log out
Then I log in as "teacher"
And I should not see menu "Quick Links" in location "Main, Menu, User, Bottom"
And I log out
And I log in as "student1"
And I should not see menu "Quick Links" in location "Main, Menu, User, Bottom"
And I log out
Then I log in as "admin"
And I add "student1" user to "CH2" cohort members
And I log out
And I log in as "student1"
And I should see menu "Quick Links" in location "Main, Menu, User, Bottom"
@javascript
Scenario: Smartmenu: Access Rules - Display menus for based on user prefered language
Given I log in as "teacher"
And I click on "#user-menu-toggle" "css_element"
And I click on "Preferences" "link" in the "#usermenu-carousel" "css_element"
And I click on "Preferred language" "link"
And I set the field "Preferred language" to "Deutsch (de)"
And I click on "Save changes" "button"
Given I log in as "student2"
And I click on "#user-menu-toggle" "css_element"
And I click on "Preferences" "link" in the "#usermenu-carousel" "css_element"
And I click on "Preferred language" "link"
And I set the field "Preferred language" to "Français (fr)"
And I click on "Save changes" "button"
Given I log in as "admin"
And I navigate to smartmenus
And I create menu with the following fields to these values:
| Title | Notifications |
| Locations | Main, Menu, User, Bottom |
And I click on ".action-edit" "css_element" in the "Quick Links" "table_row"
And I expand all fieldsets
And I set the field "By language" to "English"
And I click on "Save and return" "button"
And I should see "Quick Links" in the ".primary-navigation" "css_element"
And I log out
Then I log in as "student1"
And I should see menu "Quick Links" in location "Main, Menu, User, Bottom"
And I log out
And I log in as "teacher"
And I should not see menu "Quick Links" in location "Main, Menu, User, Bottom"
And I log out
Then I log in as "admin"
And I navigate to smartmenus
And I click on ".action-edit" "css_element" in the "Quick Links" "table_row"
And I expand all fieldsets
And I set the field "By language" to "English, Deutsch"
And I click on "Save and return" "button"
And I log out
Then I log in as "teacher"
And I should see menu "Quick Links" in location "Main, Menu, User, Bottom"
Then I log out
And I log in as "student1"
And I should see menu "Quick Links" in location "Main, Menu, User, Bottom"
And I log out
And I log in as "student2"
And I should not see menu "Quick Links" in location "Main, Menu, User, Bottom"
@javascript
Scenario: Smartmenu: Access Rules - Display menus based on multiple conditions
Given I log in as "teacher"
And I click on "#user-menu-toggle" "css_element"
And I click on "Preferences" "link" in the "#usermenu-carousel" "css_element"
And I click on "Preferred language" "link"
And I set the field "Preferred language" to "Deutsch (de)"
And I click on "Save changes" "button"
Given I log in as "student2"
And I click on "#user-menu-toggle" "css_element"
And I click on "Preferences" "link" in the "#usermenu-carousel" "css_element"
And I click on "Preferred language" "link"
And I set the field "Preferred language" to "Français (fr)"
And I click on "Save changes" "button"
Given I log in as "admin"
And I navigate to smartmenus
And I create menu with the following fields to these values:
| Title | Notifications |
| Locations | Main, Menu, User, Bottom |
And I click on ".action-edit" "css_element" in the "Quick Links" "table_row"
And I expand all fieldsets
And I set the field "By role" to "Manager, Student"
And I set the field "By cohort" to "Cohort 1"
And I set the field "By language" to "English"
And I click on "Save and return" "button"
And I should not see "Quick Links" in the ".primary-navigation" "css_element"
And I log out
Then I log in as "student1"
And I should see menu "Quick Links" in location "Main, Menu, User, Bottom"
And I log out
And I log in as "teacher"
And I should not see menu "Quick Links" in location "Main, Menu, User, Bottom"
And I log out
And I log in as "admin"
And I navigate to smartmenus
And I click on ".action-edit" "css_element" in the "Quick Links" "table_row"
And I expand all fieldsets
And I set the field "By role" to "Manager, Student, Teacher"
And I set the field "By cohort" to "Cohort 1, Cohort 2"
And I set the field "By language" to "English, Deutsch"
And I click on "Save and return" "button"
And I log out
Then I log in as "teacher"
And I should see menu "Quick Links" in location "Main, Menu, User, Bottom"