1 |
efrain |
1 |
@core @core_badges
|
|
|
2 |
Feature: Test role visibility for the badge administration page
|
|
|
3 |
In order to control access
|
|
|
4 |
As an admin
|
|
|
5 |
I need to control which roles can see each other
|
|
|
6 |
|
|
|
7 |
Background: Add a bunch of users
|
|
|
8 |
Given the following "courses" exist:
|
|
|
9 |
| fullname | shortname |
|
|
|
10 |
| Course 1 | C1 |
|
|
|
11 |
And the following "users" exist:
|
|
|
12 |
| username | firstname | lastname | email |
|
|
|
13 |
| teacher1 | Teacher | 1 | teacher1@example.com |
|
|
|
14 |
| manager1 | Manager | 1 | manager1@example.com |
|
|
|
15 |
And the following "course enrolments" exist:
|
|
|
16 |
| user | course | role |
|
|
|
17 |
| teacher1 | C1 | editingteacher |
|
|
|
18 |
| manager1 | C1 | manager |
|
|
|
19 |
|
|
|
20 |
@javascript @_file_upload
|
|
|
21 |
Scenario: Check the default roles are visible
|
|
|
22 |
Given I log in as "manager1"
|
|
|
23 |
And I am on "Course 1" course homepage
|
|
|
24 |
And I navigate to "Badges > Add a new badge" in current page administration
|
|
|
25 |
And I set the following fields to these values:
|
|
|
26 |
| Name | Course Badge |
|
|
|
27 |
| Description | Course badge description |
|
|
|
28 |
And I upload "badges/tests/behat/badge.png" file to "Image" filemanager
|
|
|
29 |
And I press "Create badge"
|
|
|
30 |
And I set the field "type" to "Manual issue by role"
|
|
|
31 |
Then I should see "Teacher"
|
|
|
32 |
And I should see "Manager"
|
|
|
33 |
|
|
|
34 |
@javascript @_file_upload
|
|
|
35 |
Scenario: Check hidden roles are not visible
|
|
|
36 |
Given I log in as "teacher1"
|
|
|
37 |
And I am on "Course 1" course homepage
|
|
|
38 |
And I navigate to "Badges > Add a new badge" in current page administration
|
|
|
39 |
And I set the following fields to these values:
|
|
|
40 |
| Name | Course Badge |
|
|
|
41 |
| Description | Course badge description |
|
|
|
42 |
And I upload "badges/tests/behat/badge.png" file to "Image" filemanager
|
|
|
43 |
And I press "Create badge"
|
|
|
44 |
And I set the following fields to these values:
|
|
|
45 |
| Add badge criteria | Manual issue by role |
|
|
|
46 |
Then I should see "Teacher"
|
|
|
47 |
And I should not see "Manager"
|