c6eb29530aa1d84ff8e46a4d4e23f6348d120a06
[moodle.git] / user / tests / behat / view_full_profile.feature
1 @core @core_user
2 Feature: 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
7   Background:
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       | teacher1 | Teacher | 1 | teacher1@example.com |
13     And the following "courses" exist:
14       | fullname | shortname | format |
15       | Course 1 | C1 | topics |
16     And the following "course enrolments" exist:
17       | user | course | role |
18       | student1 | C1 | student |
19       | student2 | C1 | student |
20       | teacher1 | C1 | editingteacher |
22   Scenario: Viewing full profiles with default settings
23     When I log in as "student1"
24     And I follow "Course 1"
25     # Another student's full profile is not visible
26     And I navigate to "Participants" node in "Current course > C1"
27     And I follow "Student 2"
28     Then I should not see "Full profile"
29     # Teacher's full profile is visible
30     And I navigate to "Participants" node in "Current course > C1"
31     And I follow "Teacher 1"
32     And I follow "Full profile"
33     And I should see "First access to site"
34     # Own full profile is visible
35     And I follow "Course 1"
36     And I navigate to "Participants" node in "Current course > C1"
37     And I click on "Student 1" "link" in the "#participants" "css_element"
38     And I follow "Full profile"
39     And I should see "First access to site"
41   @javascript
42   Scenario: Viewing full profiles with forceloginforprofiles off
43     Given the following config values are set as admin:
44       |  forceloginforprofiles | 0 |
45     When I log in as "student1"
46     And I follow "Course 1"
47     And I navigate to "Participants" node in "Current course > C1"
48     And I follow "Student 2"
49     And I follow "Full profile"
50     Then I should see "First access to site"
52   Scenario: Viewing full profiles with global permission
53     Given I log in as "admin"
54     And I set the following system permissions of "Authenticated user" role:
55       | moodle/user:viewdetails | Allow |
56     And I log out
57     When I log in as "student1"
58     And I follow "Course 1"
59     And I navigate to "Participants" node in "Current course > C1"
60     And I follow "Student 2"
61     And I follow "Full profile"
62     Then I should see "First access to site"