weekly release 5.0dev
[moodle.git] / user / tests / behat / hidden_user_fields.feature
blob2ec8cbc26ae7c9d1f69988d67dc7402635ed34f9
1 @core @core_user
2 Feature: Hidden user fields behavior
3   In order to hide private information of users
4   As an admin
5   I can set Hide user fields setting
7   Background:
8     Given the following "users" exist:
9       | username | firstname | lastname | email               | description | city     |
10       | user     | Profile   | User     | user@example.com    | This is me  | Donostia |
11       | student  | Student   | User     | student@example.com |             |          |
12       | teacher  | Teacher   | User     | teacher@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       | user    | C1     | student        |
19       | student | C1     | student        |
20       | teacher | C1     | editingteacher |
21     And the following config values are set as admin:
22       | hiddenuserfields | description,email |
24   Scenario Outline: Hidden user fields on course context profile based on role permission
25     Given I log in as "<user>"
26     And I am on "Course 1" course homepage
27     And I navigate to course participants
28     And I should see "Profile User"
29     When I click on "Profile User" "link"
30     Then I <expected> "This is me"
31     And I <expected> "user@example.com"
32     And I should see "Donostia"
34     Examples:
35       | user    | expected       |
36       | student | should not see |
37       | teacher | should see     |
38       | admin   | should see     |
40   Scenario Outline: Hidden user fields on system context profile based on role permission
41     Given I log in as "<user>"
42     And I am on "Course 1" course homepage
43     And I navigate to course participants
44     And I should see "Profile User"
45     When I click on "Profile User" "link"
46     And I click on "Full profile" "link"
47     Then I <expected> "This is me"
48     And I <expected> "user@example.com"
49     And I should see "Donostia"
51     Examples:
52       | user    | expected       |
53       | student | should not see |
54       | teacher | should not see |
55       | admin   | should see     |