Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 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
6
 
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
      | student3 | Student | 3 | student3@example.com |
13
      | teacher1 | Teacher | 1 | teacher1@example.com |
14
    And the following "courses" exist:
15
      | fullname | shortname | format | groupmode |
16
      | Course 1 | C1        | topics | 0 |
17
      | Course 2 | C2        | topics | 1 |
18
    And the following "course enrolments" exist:
19
      | user | course | role |
20
      | student1 | C1 | student |
21
      | student2 | C1 | student |
22
      | teacher1 | C1 | editingteacher |
23
      | teacher1 | C2 | editingteacher |
24
      | student1 | C2 | student |
25
      | student3 | C2 | student |
26
    And the following config values are set as admin:
27
      | messaging | 1 |
28
 
29
  Scenario: Viewing full profiles with default settings
30
    When I log in as "student1"
31
    # Another student's full profile is visible
32
    And I am on "Course 1" course homepage
33
    And I navigate to course participants
34
    And I follow "Student 2"
35
    Then I should see "Full profile"
36
    # Teacher's full profile is visible
37
    And I am on "Course 1" course homepage
38
    And I navigate to course participants
39
    And I follow "Teacher 1"
40
    And I follow "Full profile"
41
    And I should see "First access to site"
42
    # Own full profile is visible
43
    And I am on "Course 1" course homepage
44
    And I navigate to course participants
45
    And I click on "Student 1" "link" in the "#participants" "css_element"
46
    And I follow "Full profile"
47
    And I should see "First access to site"
48
 
49
  Scenario: Viewing full profiles with forceloginforprofiles off
50
    Given the following config values are set as admin:
51
      |  forceloginforprofiles | 0 |
52
    When I log in as "student1"
53
    And I am on "Course 1" course homepage
54
    And I navigate to course participants
55
    And I follow "Student 2"
56
    And I follow "Full profile"
57
    Then I should see "First access to site"
58
 
59
  Scenario: Viewing full profiles with global permission
60
    Given the following "role capability" exists:
61
      | role                    | user  |
62
      | moodle/user:viewdetails | allow |
63
    When I log in as "student1"
64
    And I am on "Course 1" course homepage
65
    And I navigate to course participants
66
    And I follow "Student 2"
67
    And I follow "Full profile"
68
    Then I should see "First access to site"
69
 
70
  Scenario: Viewing full profiles of students as a teacher
71
    When I log in as "teacher1"
72
    And I am on "Course 1" course homepage
73
    And I navigate to course participants
74
    And I follow "Student 1"
75
    And I follow "Full profile"
76
    Then I should see "First access to site"
77
 
78
  Scenario: Viewing own full profile
79
    Given I log in as "student1"
80
    When I follow "Profile" in the user menu
81
    Then I should see "First access to site"
82
 
83
  Scenario: View only shared groups in a course with separate groups forced
84
    Given the following "groups" exist:
85
      | name       | course | idnumber |
86
      | Group 1    | C2     | G1       |
87
      | Group 2    | C2     | G2       |
88
    And the following "group members" exist:
89
      | user     | group |
90
      | student1 | G1    |
91
      | student3 | G2    |
92
      | teacher1 | G1    |
93
      | teacher1 | G2    |
94
    When I log in as "student3"
95
    And I am on "Course 2" course homepage
96
    And I navigate to course participants
97
    And I follow "Teacher 1"
98
    Then I should see "Group 2"
99
    And I should not see "Group 1"
100
 
101
  Scenario: View all groups in a course with visible groups
102
    Given the following "groups" exist:
103
      | name       | course | idnumber |
104
      | Group 1    | C1     | G1       |
105
      | Group 2    | C1     | G2       |
106
    And the following "group members" exist:
107
      | user     | group |
108
      | student1 | G1    |
109
      | student2 | G2    |
110
      | teacher1 | G1    |
111
      | teacher1 | G2    |
112
    When I log in as "student1"
113
    And I am on "Course 1" course homepage
114
    And I navigate to course participants
115
    And I follow "Teacher 1"
116
    Then I should see "Group 1"
117
    And I should see "Group 2"
118
 
119
  @javascript
120
  Scenario: Viewing full profiles of someone with the course contact role
121
    Given I log in as "admin"
122
    And I navigate to "Appearance > Courses" in site administration
123
    And I set the following fields to these values:
124
      | Course creator | 1 |
125
    And I press "Save changes"
126
    And I navigate to "Users > Permissions > Assign system roles" in site administration
127
    And I follow "Course creator"
128
    And I click on "//div[@class='userselector']/descendant::option[contains(., 'Student 3')]" "xpath_element"
129
    And I press "Add"
130
    And I log out
131
    # Message search will not return a course contact unless the searcher shares a course with them,
132
    # or site-wide messaging is enabled ($CFG->messagingallusers).
133
    When I log in as "student1"
134
    And I open messaging
135
    And I search for "Student 3" in messaging
136
    Then I should see "Student 3"
137
    And I log out
138
    When I log in as "student2"
139
    And I open messaging
140
    And I search for "Student 3" in messaging
141
    Then I should see "No results"
142
 
143
  @javascript
144
  Scenario: View full profiles of someone in the same group in a course with separate groups.
145
    Given I log in as "admin"
146
    And I am on "Course 1" course homepage
147
    And I navigate to "Settings" in current page administration
148
    And I set the following fields to these values:
149
      | Group mode | Separate groups |
150
      | Force group mode | Yes |
151
    And I press "Save and display"
152
    And I log out
153
    And the following "message contacts" exist:
154
      | user     | contact |
155
      | student1 | student2 |
156
    When I log in as "student1"
157
    And I view the "Student 2" contact in the message area
158
    And I should not see "First access to site"
159
    And I should see "The details of this user are not available to you"
160
    And I log out
161
    And I log in as "admin"
162
    And I am on the "Course 1" "groups" page
163
    And I press "Create group"
164
    And I set the following fields to these values:
165
      | Group name | Group 1 |
166
    And I press "Save changes"
167
    And I add "Student 1 (student1@example.com)" user to "Group 1" group members
168
    And I add "Student 2 (student2@example.com)" user to "Group 1" group members
169
    And I log out
170
    And I log in as "student1"
171
    And I view the "Student 2" contact in the message area
172
    Then I should see "First access to site"
173
 
174
  @javascript
175
  Scenario: Accessibility, users can not click on profile image when on user's profile page.
176
    Given I log in as "admin"
177
    And I am on "Course 1" course homepage
178
    When I navigate to course participants
179
    Then "//img[contains(@class, 'userpicture')]" "xpath_element" should exist
180
    And "//a/child::img[contains(@class, 'userpicture')]" "xpath_element" should exist
181
    When I follow "Teacher 1"
182
    Then I should see "Teacher 1"
183
    And "//img[contains(@class, 'userpicture')]" "xpath_element" should exist
184
    And "//a/child::img[contains(@class, 'userpicture')]" "xpath_element" should not exist
185
    When I follow "Full profile"
186
    And I should see "Teacher 1"
187
    Then "//img[contains(@class, 'userpicture')]" "xpath_element" should exist
188
    And "//a/child::img[contains(@class, 'userpicture')]" "xpath_element" should not exist