1441 |
ariadna |
1 |
@core @core_my @block_myoverview
|
|
|
2 |
Feature: Run tests over my courses page
|
1 |
efrain |
3 |
|
|
|
4 |
Background:
|
|
|
5 |
Given the following "users" exist:
|
|
|
6 |
| username | firstname | lastname | email |
|
|
|
7 |
| user1 | User | 1 | user1@example.com |
|
|
|
8 |
And the following "categories" exist:
|
|
|
9 |
| name | category | idnumber |
|
|
|
10 |
| CatA | 0 | cata |
|
|
|
11 |
And the following "roles" exist:
|
|
|
12 |
| shortname | name | archetype |
|
|
|
13 |
| role1 | Role 1 | |
|
|
|
14 |
And the following "system role assigns" exist:
|
|
|
15 |
| user | role | contextlevel | reference |
|
|
|
16 |
| user1 | role1 | Category | CatA |
|
|
|
17 |
|
|
|
18 |
Scenario: Admin can add new courses or manage them from my courses
|
|
|
19 |
Given I am on the "My courses" page logged in as "admin"
|
1441 |
ariadna |
20 |
And "Create course" "button" should not exist in the "page-header" "region"
|
|
|
21 |
And "Manage courses" "button" should not exist in the "page-header" "region"
|
|
|
22 |
When I click on "Create course" "button" in the "page-content" "region"
|
1 |
efrain |
23 |
Then I should see "Add a new course"
|
|
|
24 |
And I am on the "My courses" page
|
1441 |
ariadna |
25 |
And I click on "Manage course categories" "button" in the "page-content" "region"
|
1 |
efrain |
26 |
And I should see "Manage course categories and courses"
|
1441 |
ariadna |
27 |
# Check that the expected buttons are displayed in the header when the user is enrolled in a course.
|
|
|
28 |
But the following "course" exists:
|
|
|
29 |
| fullname | Course 1 |
|
|
|
30 |
| shortname | C1 |
|
|
|
31 |
| format | topics |
|
|
|
32 |
And the following "course enrolment" exists:
|
|
|
33 |
| user | admin |
|
|
|
34 |
| course | C1 |
|
|
|
35 |
| role | student |
|
|
|
36 |
And I am on the "My courses" page
|
|
|
37 |
And "Create course" "button" should exist in the "page-header" "region"
|
|
|
38 |
And "Manage courses" "button" should exist in the "page-header" "region"
|
|
|
39 |
And "Create course" "button" should not exist in the "page-content" "region"
|
|
|
40 |
And "Manage courses" "button" should not exist in the "page-content" "region"
|
|
|
41 |
And "Manage course categories" "button" should not exist in the "page-content" "region"
|
1 |
efrain |
42 |
|
|
|
43 |
Scenario: User without creating a course and managing category permissions cannot see any link
|
1441 |
ariadna |
44 |
When I am on the "My courses" page logged in as "user1"
|
|
|
45 |
Then "Create course" "button" should not exist
|
|
|
46 |
And "Manage courses" "button" should not exist
|
|
|
47 |
And "Manage course categories" "button" should not exist
|
|
|
48 |
# Check that the same buttons are displayed in the header when the user is enrolled in a course.
|
|
|
49 |
But the following "course" exists:
|
|
|
50 |
| fullname | Course 1 |
|
|
|
51 |
| shortname | C1 |
|
|
|
52 |
| format | topics |
|
|
|
53 |
And the following "course enrolment" exists:
|
|
|
54 |
| user | user1 |
|
|
|
55 |
| course | C1 |
|
|
|
56 |
| role | student |
|
|
|
57 |
And I am on the "My courses" page
|
|
|
58 |
And "Create course" "button" should not exist
|
|
|
59 |
And "Manage courses" "button" should not exist
|
|
|
60 |
And "Manage course categories" "button" should not exist
|
1 |
efrain |
61 |
|
|
|
62 |
Scenario: User without capability to browse courses cannot see any link
|
|
|
63 |
Given the following "permission overrides" exist:
|
|
|
64 |
| capability | permission | role | contextlevel | reference |
|
|
|
65 |
| moodle/category:viewcourselist | Prevent | user | System | |
|
1441 |
ariadna |
66 |
When I am on the "My courses" page logged in as "user1"
|
|
|
67 |
Then "Create course" "button" should not exist
|
|
|
68 |
And "Manage courses" "button" should not exist
|
|
|
69 |
And "Manage course categories" "button" should not exist
|
|
|
70 |
# Check that the same buttons are displayed in the header when the user is enrolled in a course.
|
|
|
71 |
But the following "course" exists:
|
|
|
72 |
| fullname | Course 1 |
|
|
|
73 |
| shortname | C1 |
|
|
|
74 |
| format | topics |
|
|
|
75 |
And the following "course enrolment" exists:
|
|
|
76 |
| user | user1 |
|
|
|
77 |
| course | C1 |
|
|
|
78 |
| role | student |
|
|
|
79 |
And I am on the "My courses" page
|
|
|
80 |
And "Create course" "button" should not exist
|
|
|
81 |
And "Manage courses" "button" should not exist
|
|
|
82 |
And "Manage course categories" "button" should not exist
|
1 |
efrain |
83 |
|
|
|
84 |
@javascript
|
|
|
85 |
Scenario: User with creating a course permission can see the Create course link only
|
|
|
86 |
Given the following "permission overrides" exist:
|
|
|
87 |
| capability | permission | role | contextlevel | reference |
|
|
|
88 |
| moodle/course:create | Allow | role1 | Category | cata |
|
|
|
89 |
When I am on the "My courses" page logged in as "user1"
|
1441 |
ariadna |
90 |
Then "Create course" "button" should exist in the "page-content" "region"
|
|
|
91 |
But "Manage course categories" "button" should not exist
|
|
|
92 |
And "Create course" "button" should not exist in the "page-header" "region"
|
|
|
93 |
And I click on "Create course" "button"
|
1 |
efrain |
94 |
And I should see "Add a new course"
|
|
|
95 |
And "CatA" "autocomplete_selection" should exist
|
1441 |
ariadna |
96 |
# Check that the same buttons are displayed in the header when the user is enrolled in a course.
|
|
|
97 |
But the following "course" exists:
|
|
|
98 |
| fullname | Course 1 |
|
|
|
99 |
| shortname | C1 |
|
|
|
100 |
| format | topics |
|
|
|
101 |
And the following "course enrolment" exists:
|
|
|
102 |
| user | user1 |
|
|
|
103 |
| course | C1 |
|
|
|
104 |
| role | student |
|
|
|
105 |
And I am on the "My courses" page
|
|
|
106 |
And "Create course" "button" should exist in the "page-header" "region"
|
|
|
107 |
And "Manage courses" "button" should not exist
|
|
|
108 |
And "Create course" "button" should not exist in the "page-content" "region"
|
1 |
efrain |
109 |
|
|
|
110 |
Scenario: User with managing a category permission can see the Manage course link only
|
|
|
111 |
Given the following "permission overrides" exist:
|
|
|
112 |
| capability | permission | role | contextlevel | reference |
|
|
|
113 |
| moodle/category:manage | Allow | role1 | Category | cata |
|
|
|
114 |
When I am on the "My courses" page logged in as "user1"
|
1441 |
ariadna |
115 |
Then "Manage course categories" "button" should exist in the "page-content" "region"
|
|
|
116 |
And "Create course" "button" should not exist
|
|
|
117 |
And I click on "Manage course categories" "button" in the "page-content" "region"
|
1 |
efrain |
118 |
And I should see "Manage course categories and courses"
|
1441 |
ariadna |
119 |
# Check that the same buttons are displayed in the header when the user is enrolled in a course.
|
|
|
120 |
But the following "course" exists:
|
|
|
121 |
| fullname | Course 1 |
|
|
|
122 |
| shortname | C1 |
|
|
|
123 |
| format | topics |
|
|
|
124 |
And the following "course enrolment" exists:
|
|
|
125 |
| user | user1 |
|
|
|
126 |
| course | C1 |
|
|
|
127 |
| role | student |
|
|
|
128 |
And I am on the "My courses" page
|
|
|
129 |
And "Manage courses" "button" should exist in the "page-header" "region"
|
|
|
130 |
And "Create course" "button" should not exist
|
|
|
131 |
And "Manage courses" "button" should not exist in the "page-content" "region"
|
1 |
efrain |
132 |
|
|
|
133 |
@javascript
|
|
|
134 |
Scenario: User with both creating a course and managing a category permission can see both links
|
|
|
135 |
Given the following "permission overrides" exist:
|
|
|
136 |
| capability | permission | role | contextlevel | reference |
|
|
|
137 |
| moodle/course:create | Allow | role1 | Category | cata |
|
|
|
138 |
| moodle/category:manage | Allow | role1 | Category | cata |
|
|
|
139 |
When I am on the "My courses" page logged in as "user1"
|
1441 |
ariadna |
140 |
Then "Create course" "button" should exist in the "page-content" "region"
|
|
|
141 |
And "Manage course categories" "button" should exist in the "page-content" "region"
|
|
|
142 |
And "Create course" "button" should not exist in the "page-header" "region"
|
|
|
143 |
And "Manage courses" "button" should not exist in the "page-header" "region"
|
|
|
144 |
And I click on "Create course" "button"
|
1 |
efrain |
145 |
And I should see "Add a new course"
|
|
|
146 |
And "CatA" "autocomplete_selection" should exist
|
|
|
147 |
And I am on the "My courses" page
|
1441 |
ariadna |
148 |
And I click on "Manage course categories" "button"
|
1 |
efrain |
149 |
And I should see "Manage course categories and courses"
|
1441 |
ariadna |
150 |
# Check that the same buttons are displayed in the header when the user is enrolled in a course.
|
|
|
151 |
But the following "course" exists:
|
|
|
152 |
| fullname | Course 1 |
|
|
|
153 |
| shortname | C1 |
|
|
|
154 |
| format | topics |
|
|
|
155 |
And the following "course enrolment" exists:
|
|
|
156 |
| user | user1 |
|
|
|
157 |
| course | C1 |
|
|
|
158 |
| role | student |
|
|
|
159 |
And I am on the "My courses" page
|
|
|
160 |
And "Create course" "button" should exist in the "page-header" "region"
|
|
|
161 |
And "Manage courses" "button" should exist in the "page-header" "region"
|
|
|
162 |
And "Create course" "button" should not exist in the "page-content" "region"
|
|
|
163 |
And "Manage courses" "button" should not exist in the "page-content" "region"
|
1 |
efrain |
164 |
|
|
|
165 |
@javascript
|
|
|
166 |
Scenario: Admin can see relevant blocks but not add or move them
|
|
|
167 |
Given I log in as "admin"
|
|
|
168 |
And I am on site homepage
|
|
|
169 |
And I turn editing mode on
|
|
|
170 |
And I add the "Text" block to the default region with:
|
|
|
171 |
| Text block title | Text on all pages |
|
|
|
172 |
| Content | This is visible on all pages |
|
|
|
173 |
And I configure the "Text on all pages" block
|
|
|
174 |
And I set the following fields to these values:
|
|
|
175 |
| Page contexts | Display throughout the entire site |
|
|
|
176 |
| Default region | Right |
|
|
|
177 |
And I click on "Save changes" "button" in the "Configure Text on all pages block" "dialogue"
|
|
|
178 |
And I should see "This is visible on all pages"
|
|
|
179 |
And "Move Text on all pages block" "menuitem" should exist in the "Text on all pages" "block"
|
|
|
180 |
When I am on the "My courses" page
|
|
|
181 |
# Check blocks visible but are "locked" in place.
|
|
|
182 |
Then "Course overview" "text" should exist in the "region-main" "region"
|
|
|
183 |
And I should not see "Add a block"
|
|
|
184 |
And I should see "This is visible on all pages"
|
|
|
185 |
And "Move Text on all pages block" "menuitem" should not exist in the "Text on all pages" "block"
|
|
|
186 |
And "Move Course overview block" "menuitem" should not exist in the "Course overview" "block"
|
1441 |
ariadna |
187 |
And "Actions menu" "icon" in the "Course overview" "block" should not be visible
|
1 |
efrain |
188 |
|
|
|
189 |
Scenario: User with creating a course permission can't see the Request course link
|
|
|
190 |
Given the following "permission overrides" exist:
|
|
|
191 |
| capability | permission | role | contextlevel | reference |
|
|
|
192 |
| moodle/course:request | Allow | user | System | |
|
|
|
193 |
When I am on the "My courses" page logged in as "admin"
|
1441 |
ariadna |
194 |
Then "Create course" "button" should exist in the "page-content" "region"
|
|
|
195 |
And "Request a course" "button" should not exist
|
|
|
196 |
And "Create course" "button" should not exist in the "page-header" "region"
|
|
|
197 |
# Check that the same buttons are displayed in the header when the user is enrolled in a course.
|
|
|
198 |
But the following "course" exists:
|
|
|
199 |
| fullname | Course 1 |
|
|
|
200 |
| shortname | C1 |
|
|
|
201 |
| format | topics |
|
|
|
202 |
And the following "course enrolment" exists:
|
|
|
203 |
| user | admin |
|
|
|
204 |
| course | C1 |
|
|
|
205 |
| role | student |
|
|
|
206 |
And I am on the "My courses" page
|
|
|
207 |
And "Create course" "button" should exist in the "page-header" "region"
|
|
|
208 |
And "Request a course" "button" should not exist
|
|
|
209 |
And "Create course" "button" should not exist in the "page-content" "region"
|
1 |
efrain |
210 |
|
|
|
211 |
Scenario: User without creating a course but with course request permission could see the Request course link
|
|
|
212 |
Given the following "permission overrides" exist:
|
|
|
213 |
| capability | permission | role | contextlevel | reference |
|
|
|
214 |
| moodle/course:request | Allow | user | System | |
|
|
|
215 |
When I am on the "My courses" page logged in as "user1"
|
1441 |
ariadna |
216 |
Then "Request a course" "button" should exist in the "page-content" "region"
|
|
|
217 |
And "Create course" "button" should not exist in the "page-content" "region"
|
|
|
218 |
And "Create course" "button" should not exist in the "page-header" "region"
|
|
|
219 |
And "Request a course" "button" should not exist in the "page-header" "region"
|
|
|
220 |
# Check the request a course button is not displayed when this feature is disabled.
|
1 |
efrain |
221 |
And the following config values are set as admin:
|
|
|
222 |
| enablecourserequests | 0 |
|
|
|
223 |
And I am on the "My courses" page logged in as "user1"
|
1441 |
ariadna |
224 |
And "Request a course" "button" should not exist
|
|
|
225 |
# Check that the same buttons are displayed in the header when the user is enrolled in a course.
|
|
|
226 |
But the following "course" exists:
|
|
|
227 |
| fullname | Course 1 |
|
|
|
228 |
| shortname | C1 |
|
|
|
229 |
| format | topics |
|
|
|
230 |
And the following "course enrolment" exists:
|
|
|
231 |
| user | user1 |
|
|
|
232 |
| course | C1 |
|
|
|
233 |
| role | student |
|
|
|
234 |
And the following config values are set as admin:
|
|
|
235 |
| enablecourserequests | 1 |
|
|
|
236 |
And I am on the "My courses" page
|
|
|
237 |
And "Request a course" "button" should exist in the "page-header" "region"
|
|
|
238 |
And "Create course" "button" should not exist
|
|
|
239 |
And "Request a course" "button" should not exist in the "page-content" "region"
|
1 |
efrain |
240 |
|
|
|
241 |
Scenario: User without creating nor course request permission shouldn't see any Request course link
|
|
|
242 |
Given I am on the "My courses" page logged in as "user1"
|
1441 |
ariadna |
243 |
Then "Request a course" "button" should not exist in the "page-content" "region"
|
|
|
244 |
And "Create course" "button" should not exist in the "page-content" "region"
|
|
|
245 |
And "Manage courses" "button" should not exist in the "page-content" "region"
|
|
|
246 |
# Check that the same buttons are displayed in the header when the user is enrolled in a course.
|
|
|
247 |
But the following "course" exists:
|
|
|
248 |
| fullname | Course 1 |
|
|
|
249 |
| shortname | C1 |
|
|
|
250 |
| format | topics |
|
|
|
251 |
And the following "course enrolment" exists:
|
|
|
252 |
| user | user1 |
|
|
|
253 |
| course | C1 |
|
|
|
254 |
| role | student |
|
|
|
255 |
And I am on the "My courses" page
|
|
|
256 |
And "Create course" "button" should not exist
|
|
|
257 |
And "Request a course" "button" should not exist
|
|
|
258 |
And "Manage courses" "button" should not exist
|