MDL-27177 roles: Update to behat full profile tests.
[moodle.git] / user / tests / behat / view_full_profile.feature
CommitLineData
5d9204af
MG
1@core @core_user
2Feature: Access to full profiles of users
3 In order to allow visibility of full profiles
4 As an admin
5 I need to set global permission or disable forceloginforprofiles
6
7 Background:
8 Given the following "users" exist:
9 | username | firstname | lastname | email |
0fe86bbd
RT
10 | student1 | Student | 1 | student1@example.com |
11 | student2 | Student | 2 | student2@example.com |
4fc7b6a0 12 | student3 | Student | 3 | student2@example.com |
0fe86bbd 13 | teacher1 | Teacher | 1 | teacher1@example.com |
5d9204af
MG
14 And the following "courses" exist:
15 | fullname | shortname | format |
16 | Course 1 | C1 | topics |
4fc7b6a0 17 | Course 2 | C2 | topics |
5d9204af
MG
18 And the following "course enrolments" exist:
19 | user | course | role |
20 | student1 | C1 | student |
21 | student2 | C1 | student |
22 | teacher1 | C1 | editingteacher |
4fc7b6a0 23 | student3 | C2 | student |
5d9204af
MG
24
25 Scenario: Viewing full profiles with default settings
26 When I log in as "student1"
27 And I follow "Course 1"
28 # Another student's full profile is not visible
29 And I navigate to "Participants" node in "Current course > C1"
30 And I follow "Student 2"
31 Then I should not see "Full profile"
32 # Teacher's full profile is visible
33 And I navigate to "Participants" node in "Current course > C1"
34 And I follow "Teacher 1"
35 And I follow "Full profile"
36 And I should see "First access to site"
37 # Own full profile is visible
38 And I follow "Course 1"
39 And I navigate to "Participants" node in "Current course > C1"
40 And I click on "Student 1" "link" in the "#participants" "css_element"
41 And I follow "Full profile"
42 And I should see "First access to site"
43
44 @javascript
45 Scenario: Viewing full profiles with forceloginforprofiles off
bed97c39
RT
46 Given the following config values are set as admin:
47 | forceloginforprofiles | 0 |
5d9204af
MG
48 When I log in as "student1"
49 And I follow "Course 1"
50 And I navigate to "Participants" node in "Current course > C1"
51 And I follow "Student 2"
52 And I follow "Full profile"
53 Then I should see "First access to site"
54
5d9204af
MG
55 Scenario: Viewing full profiles with global permission
56 Given I log in as "admin"
57 And I set the following system permissions of "Authenticated user" role:
58 | moodle/user:viewdetails | Allow |
59 And I log out
60 When I log in as "student1"
61 And I follow "Course 1"
62 And I navigate to "Participants" node in "Current course > C1"
63 And I follow "Student 2"
64 And I follow "Full profile"
65 Then I should see "First access to site"
4fc7b6a0
AG
66
67 @javascript
68 Scenario: Viewing own full profile
69 Given I log in as "student1"
70 When I follow "Profile" in the user menu
71 Then I should see "First access to site"
72
73 @javascript
74 Scenario: Viewing full profiles of someone with the course contact role
75 Given I log in as "admin"
76 And I navigate to "Courses" node in "Site administration > Appearance"
77 And I set the following fields to these values:
78 | Course creator | 1 |
79 And I press "Save changes"
80 And I navigate to "Assign system roles" node in "Site administration > Users > Permissions"
81 And I follow "Course creator"
82 And I click on "//div[@class='userselector']/descendant::option[contains(., 'Student 3')]" "xpath_element"
83 And I press "Add"
84 And I log out
85 When I log in as "student1"
86 And I follow "Messages" in the user menu
87 And I set the following fields to these values:
88 | Search people and messages | Student 3 |
89 And I press "Search people and messages"
90 And I follow "Picture of Student 3"
91 Then I should see "First access to site"
92
93 @javascript
94 Scenario: View full profiles of someone in the same group in a course with separate groups.
95 Given I log in as "admin"
96 And I am on site homepage
97 And I follow "Course 1"
98 And I follow "Edit settings"
99 And I set the following fields to these values:
100 | Group mode | Separate groups |
101 | Force group mode | Yes |
102 And I press "Save and display"
103 And I log out
104 When I log in as "student1"
105 And I follow "Messages" in the user menu
106 And I set the following fields to these values:
107 | Search people and messages | Student 2 |
108 And I press "Search people and messages"
109 And I follow "Picture of Student 2"
110 And I should not see "First access to site"
111 And I should see "The details of this user are not available to you"
112 And I log out
113 And I log in as "admin"
114 And I am on site homepage
115 And I follow "Course 1"
116 And I expand "Users" node
117 And I follow "Groups"
118 And I press "Create group"
119 And I set the following fields to these values:
120 | Group name | Group 1 |
121 And I press "Save changes"
122 And I add "Student 1 (student1@example.com)" user to "Group 1" group members
123 And I add "Student 2 (student2@example.com)" user to "Group 1" group members
124 And I log out
125 And I log in as "student1"
126 And I follow "Messages" in the user menu
127 And I set the following fields to these values:
128 | Search people and messages | Student 2 |
129 And I press "Search people and messages"
130 And I follow "Picture of Student 2"
131 Then I should see "First access to site"