2 Feature: Access to preferences page
3 In order to view the preferences page
5 I need global permissions to view the page.
8 Given the following "users" exist:
9 | username | firstname | lastname | email |
10 | student1 | Student | 1 | student1@example.com |
11 | student2 | Student | 2 | student2@example.com |
12 | manager1 | Manager | 1 | manager1@example.com |
13 | teacher1 | Teacher | 1 | teacher1@example.com |
14 | parent | Parent | 1 | parent1@example.com |
15 And the following "courses" exist:
16 | fullname | shortname | format |
17 | Course 1 | C1 | topics |
18 | Course 2 | C2 | topics |
19 And the following "course enrolments" exist:
20 | user | course | role |
21 | student1 | C1 | student |
22 | student2 | C1 | student |
23 | teacher1 | C1 | editingteacher |
24 And the following "system role assigns" exist:
25 | user | course | role |
26 | manager1 | Acceptance test site | manager |
28 Scenario: A student and teacher with normal permissions can not view another user's permissions page.
29 Given I log in as "student1"
30 And I follow "Course 1"
31 And I navigate to "Participants" node in "Current course > C1"
32 And I follow "Student 2"
33 And I should not see "Preferences" in the "#region-main" "css_element"
35 And I log in as "teacher1"
36 And I follow "Course 1"
37 When I navigate to "Participants" node in "Current course > C1"
38 And I follow "Student 2"
39 Then I should not see "Preferences" in the "#region-main" "css_element"
41 Scenario: Administrators and Managers can view another user's permissions page.
42 Given I log in as "admin"
43 And I am on site homepage
44 And I follow "Course 1"
45 And I navigate to "Participants" node in "Current course > C1"
46 And I follow "Student 2"
47 And I should see "Preferences" in the "#region-main" "css_element"
49 And I log in as "manager1"
50 And I am on site homepage
51 And I follow "Course 1"
52 When I navigate to "Participants" node in "Current course > C1"
53 And I follow "Student 2"
54 Then I should see "Preferences" in the "#region-main" "css_element"
57 Scenario: A user with the appropriate permissions can view another user's permissions page.
58 Given I log in as "admin"
59 And I am on site homepage
60 And I follow "Turn editing on"
61 And I add the "Mentees" block
62 And I navigate to "Define roles" node in "Site administration > Users > Permissions"
63 And I click on "Add a new role" "button"
64 And I click on "Continue" "button"
65 And I set the following fields to these values:
66 | Short name | Parent |
67 | Custom full name | Parent |
68 | contextlevel30 | 1 |
69 | moodle/user:editprofile | 1 |
70 | moodle/user:viewalldetails | 1 |
71 | moodle/user:viewuseractivitiesreport | 1 |
72 | moodle/user:viewdetails | 1 |
73 And I click on "Create this role" "button"
74 And I navigate to "Browse list of users" node in "Site administration > Users > Accounts"
75 And I follow "Student 1"
76 And I click on "Preferences" "link" in the ".profile_tree" "css_element"
77 And I follow "Assign roles relative to this user"
79 And I click on "//select[@id='addselect']/descendant::option[contains(., 'Parent 1 (parent1@example.com)')]" "xpath_element"
80 And I click on "Add" "button"
82 And I log in as "parent"
83 And I am on site homepage
84 When I follow "Student 1"
85 Then I should see "Preferences" in the "#region-main" "css_element"