1 |
efrain |
1 |
@block @block_online_users
|
|
|
2 |
Feature: The online users block allow you to see who is currently online on dashboard
|
|
|
3 |
There should be some commonality for the users to show up
|
|
|
4 |
In order to use the online users block on the dashboard
|
|
|
5 |
As a user
|
|
|
6 |
I can view the online users block on my dashboard
|
|
|
7 |
|
|
|
8 |
Background:
|
|
|
9 |
Given the following "users" exist:
|
|
|
10 |
| username | firstname | lastname | email |
|
|
|
11 |
| teacher1 | Teacher | 1 | teacher1@example.com |
|
|
|
12 |
| student1 | Student | 1 | student1@example.com |
|
|
|
13 |
| student2 | Student | 2 | student2@example.com |
|
|
|
14 |
And the following "courses" exist:
|
|
|
15 |
| fullname | shortname | category |
|
|
|
16 |
| Course 1 | C1 | 0 |
|
|
|
17 |
And the following "course enrolments" exist:
|
|
|
18 |
| user | course | role |
|
|
|
19 |
| teacher1 | C1 | editingteacher |
|
|
|
20 |
| student1 | C1 | student |
|
|
|
21 |
| student2 | C1 | student |
|
|
|
22 |
And the following "blocks" exist:
|
|
|
23 |
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
|
|
|
24 |
| online_users | System | 1 | my-index | side-post |
|
|
|
25 |
|
|
|
26 |
Scenario: View the online users block on the dashboard and see myself
|
|
|
27 |
Given I log in as "teacher1"
|
|
|
28 |
Then I should see "Teacher 1" in the "Online users" "block"
|
|
|
29 |
And I should see "1 online user" in the "Online users" "block"
|
|
|
30 |
|
|
|
31 |
Scenario: View the online users block on the dashboard and see other logged in users
|
|
|
32 |
Given I log in as "student2"
|
|
|
33 |
And I log out
|
|
|
34 |
And I log in as "student1"
|
|
|
35 |
And I log out
|
|
|
36 |
When I log in as "teacher1"
|
|
|
37 |
Then I should see "Teacher 1" in the "Online users" "block"
|
|
|
38 |
And I should see "Student 1" in the "Online users" "block"
|
|
|
39 |
And I should see "Student 2" in the "Online users" "block"
|
|
|
40 |
And I should see "3 online users" in the "Online users" "block"
|
|
|
41 |
|
|
|
42 |
@javascript
|
|
|
43 |
Scenario: Hide/show user's online status from/to other users in the online users block on dashboard
|
|
|
44 |
Given the following config values are set as admin:
|
|
|
45 |
| block_online_users_onlinestatushiding | 1 |
|
|
|
46 |
And I log in as "student1"
|
|
|
47 |
And I should see "1 online user" in the "Online users" "block"
|
|
|
48 |
And I should see "Student 1" in the "Online users" "block"
|
|
|
49 |
And "Hide" "icon" should exist in the "#change-user-visibility" "css_element"
|
|
|
50 |
When I click on "#change-user-visibility" "css_element"
|
|
|
51 |
And I wait "1" seconds
|
|
|
52 |
Then "Show" "icon" should exist in the "#change-user-visibility" "css_element"
|
|
|
53 |
And I log out
|
|
|
54 |
When I log in as "student2"
|
|
|
55 |
Then I should see "1 online user" in the "Online users" "block"
|
|
|
56 |
And I should see "Student 2" in the "Online users" "block"
|
|
|
57 |
And I should not see "Student 1" in the "Online users" "block"
|
|
|
58 |
And I log out
|
|
|
59 |
When I log in as "student1"
|
|
|
60 |
Then "Show" "icon" should exist in the "#change-user-visibility" "css_element"
|
|
|
61 |
When I click on "#change-user-visibility" "css_element"
|
|
|
62 |
And I wait "1" seconds
|
|
|
63 |
Then "Hide" "icon" should exist in the "#change-user-visibility" "css_element"
|
|
|
64 |
And I log out
|
|
|
65 |
When I log in as "student2"
|
|
|
66 |
Then I should see "2 online users" in the "Online users" "block"
|
|
|
67 |
And I should see "Student 2" in the "Online users" "block"
|
|
|
68 |
And I should see "Student 1" in the "Online users" "block"
|
|
|
69 |
|
|
|
70 |
@javascript
|
|
|
71 |
Scenario: Hide/show icon is not visible in the online users block when the setting is disabled
|
|
|
72 |
Given the following config values are set as admin:
|
|
|
73 |
| block_online_users_onlinestatushiding | 1 |
|
|
|
74 |
And I log in as "student1"
|
|
|
75 |
And I should see "1 online user" in the "Online users" "block"
|
|
|
76 |
And I should see "Student 1" in the "Online users" "block"
|
|
|
77 |
And "Hide" "icon" should exist in the ".block.block_online_users" "css_element"
|
|
|
78 |
And I log out
|
|
|
79 |
And the following config values are set as admin:
|
|
|
80 |
| block_online_users_onlinestatushiding | 0 |
|
|
|
81 |
When I log in as "student1"
|
|
|
82 |
Then I should see "1 online user" in the "Online users" "block"
|
|
|
83 |
And I should see "Student 1" in the "Online users" "block"
|
|
|
84 |
And "Hide" "icon" should not exist in the ".block.block_online_users" "css_element"
|
|
|
85 |
|
|
|
86 |
@javascript
|
|
|
87 |
Scenario: User is displayed in the online users block when visibility setting is disabled,
|
|
|
88 |
ignoring the previously set visibility state
|
|
|
89 |
Given the following config values are set as admin:
|
|
|
90 |
| block_online_users_onlinestatushiding | 1 |
|
|
|
91 |
And I log in as "student1"
|
|
|
92 |
And I should see "1 online user" in the "Online users" "block"
|
|
|
93 |
And I should see "Student 1" in the "Online users" "block"
|
|
|
94 |
And "Hide" "icon" should exist in the "#change-user-visibility" "css_element"
|
|
|
95 |
And I click on "#change-user-visibility" "css_element"
|
|
|
96 |
And I wait "1" seconds
|
|
|
97 |
And "Show" "icon" should exist in the "#change-user-visibility" "css_element"
|
|
|
98 |
And I log out
|
|
|
99 |
And I log in as "student2"
|
|
|
100 |
And I should see "1 online user" in the "Online users" "block"
|
|
|
101 |
And I should see "Student 2" in the "Online users" "block"
|
|
|
102 |
And I should not see "Student 1" in the "Online users" "block"
|
|
|
103 |
And I log out
|
|
|
104 |
And the following config values are set as admin:
|
|
|
105 |
| block_online_users_onlinestatushiding | 0 |
|
|
|
106 |
When I log in as "student2"
|
|
|
107 |
Then I should see "2 online users" in the "Online users" "block"
|
|
|
108 |
And I should see "Student 2" in the "Online users" "block"
|
|
|
109 |
And I should see "Student 1" in the "Online users" "block"
|