1 |
efrain |
1 |
@block @block_online_users
|
|
|
2 |
Feature: The online users block allow you to see who is currently online on frontpage
|
|
|
3 |
There should be some commonality for the users to show up
|
|
|
4 |
In order to enable the online users block on the frontpage
|
|
|
5 |
As an admin
|
|
|
6 |
I can add the online users block to the frontpage
|
|
|
7 |
|
|
|
8 |
Background:
|
|
|
9 |
Given the following "users" exist:
|
|
|
10 |
| username | firstname | lastname | email |
|
|
|
11 |
| student1 | Student | 1 | student1@example.com |
|
|
|
12 |
| student2 | Student | 2 | student2@example.com |
|
|
|
13 |
And the following "courses" exist:
|
|
|
14 |
| fullname | shortname | category |
|
|
|
15 |
| Course 1 | C1 | 0 |
|
|
|
16 |
And the following "course enrolments" exist:
|
|
|
17 |
| user | course | role |
|
|
|
18 |
| student1 | C1 | student |
|
|
|
19 |
| student2 | C1 | student |
|
|
|
20 |
|
|
|
21 |
Scenario: View the online users block on the front page and see myself
|
|
|
22 |
Given I log in as "admin"
|
|
|
23 |
And I am on site homepage
|
|
|
24 |
And I turn editing mode on
|
|
|
25 |
When I add the "Online users" block
|
|
|
26 |
Then I should see "Admin User" in the "Online users" "block"
|
|
|
27 |
And I should see "1 online user" in the "Online users" "block"
|
|
|
28 |
|
|
|
29 |
Scenario: View the online users block on the front page as a logged in user
|
|
|
30 |
Given I log in as "admin"
|
|
|
31 |
And I am on site homepage
|
|
|
32 |
And I turn editing mode on
|
|
|
33 |
And I add the "Online users" block
|
|
|
34 |
And I log out
|
|
|
35 |
And I log in as "student2"
|
|
|
36 |
And I log out
|
|
|
37 |
When I log in as "student1"
|
|
|
38 |
And I am on site homepage
|
|
|
39 |
Then I should not see "Admin User" in the "Online users" "block"
|
|
|
40 |
And I should see "Other users (1)" in the "Online users" "block"
|
|
|
41 |
And I should see "Student 1" in the "Online users" "block"
|
|
|
42 |
And I should see "Student 2" in the "Online users" "block"
|
|
|
43 |
And I should see "3 online users" in the "Online users" "block"
|
|
|
44 |
|
|
|
45 |
Scenario: View the online users block on the front page as a guest
|
|
|
46 |
Given I log in as "admin"
|
|
|
47 |
And I am on site homepage
|
|
|
48 |
And I turn editing mode on
|
|
|
49 |
And I add the "Online users" block
|
|
|
50 |
And I log out
|
|
|
51 |
And I log in as "student2"
|
|
|
52 |
And I log out
|
|
|
53 |
And I log in as "student1"
|
|
|
54 |
And I log out
|
|
|
55 |
When I log in as "guest"
|
|
|
56 |
And I am on site homepage
|
|
|
57 |
Then I should not see "Admin User" in the "Online users" "block"
|
|
|
58 |
And I should not see "Student 1" in the "Online users" "block"
|
|
|
59 |
And I should not see "Student 2" in the "Online users" "block"
|
|
|
60 |
And I should see "3 online users" in the "Online users" "block"
|
|
|
61 |
|
|
|
62 |
@javascript
|
|
|
63 |
Scenario: Hide/show user's online status from/to other users in the online users block on front page
|
|
|
64 |
Given the following config values are set as admin:
|
|
|
65 |
| block_online_users_onlinestatushiding | 1 |
|
|
|
66 |
And I log in as "admin"
|
|
|
67 |
And I am on site homepage
|
|
|
68 |
And I turn editing mode on
|
|
|
69 |
And I add the "Online users" block
|
|
|
70 |
And I log out
|
|
|
71 |
When I log in as "student1"
|
|
|
72 |
And I am on site homepage
|
|
|
73 |
Then "Hide" "icon" should exist in the "#change-user-visibility" "css_element"
|
|
|
74 |
When I click on "#change-user-visibility" "css_element"
|
|
|
75 |
And I wait "1" seconds
|
|
|
76 |
Then "Show" "icon" should exist in the "#change-user-visibility" "css_element"
|
|
|
77 |
And I log out
|
|
|
78 |
When I log in as "student2"
|
|
|
79 |
And I am on site homepage
|
|
|
80 |
Then I should see "2 online user" in the "Online users" "block"
|
|
|
81 |
And I should not see "Admin" in the "Online users" "block"
|
|
|
82 |
And I should see "Other users (1)" in the "Online users" "block"
|
|
|
83 |
And I should see "Student 2" in the "Online users" "block"
|
|
|
84 |
And I should not see "Student 1" in the "Online users" "block"
|
|
|
85 |
And I log out
|
|
|
86 |
When I log in as "student1"
|
|
|
87 |
And I am on site homepage
|
|
|
88 |
Then "Show" "icon" should exist in the "#change-user-visibility" "css_element"
|
|
|
89 |
When I click on "#change-user-visibility" "css_element"
|
|
|
90 |
And I wait "1" seconds
|
|
|
91 |
Then "Hide" "icon" should exist in the "#change-user-visibility" "css_element"
|
|
|
92 |
And I log out
|
|
|
93 |
When I log in as "student2"
|
|
|
94 |
And I am on site homepage
|
|
|
95 |
Then I should see "3 online users" in the "Online users" "block"
|
|
|
96 |
And I should not see "Admin" in the "Online users" "block"
|
|
|
97 |
And I should see "Other users (1)" in the "Online users" "block"
|
|
|
98 |
And I should see "Student 2" in the "Online users" "block"
|
|
|
99 |
And I should see "Student 1" in the "Online users" "block"
|
|
|
100 |
|
|
|
101 |
@javascript
|
|
|
102 |
Scenario: Hide/show icon is not visible in the online users block on front page when the setting is disabled
|
|
|
103 |
Given the following config values are set as admin:
|
|
|
104 |
| block_online_users_onlinestatushiding | 1 |
|
|
|
105 |
And I log in as "admin"
|
|
|
106 |
And I am on site homepage
|
|
|
107 |
And I turn editing mode on
|
|
|
108 |
And I add the "Online users" block
|
|
|
109 |
And I log out
|
|
|
110 |
And I log in as "student1"
|
|
|
111 |
And I am on site homepage
|
|
|
112 |
And "Hide" "icon" should exist in the ".block.block_online_users" "css_element"
|
|
|
113 |
And I log out
|
|
|
114 |
And the following config values are set as admin:
|
|
|
115 |
| block_online_users_onlinestatushiding | 0 |
|
|
|
116 |
When I log in as "student1"
|
|
|
117 |
And I am on site homepage
|
|
|
118 |
Then I should see "Student 1" in the "Online users" "block"
|
|
|
119 |
And "Hide" "icon" should not exist in the ".block.block_online_users" "css_element"
|
|
|
120 |
|
|
|
121 |
@javascript
|
|
|
122 |
Scenario: User is displayed in the online users block on front page when visibility setting is disabled,
|
|
|
123 |
ignoring the previously set visibility state
|
|
|
124 |
Given the following config values are set as admin:
|
|
|
125 |
| block_online_users_onlinestatushiding | 1 |
|
|
|
126 |
And I log in as "admin"
|
|
|
127 |
And I am on site homepage
|
|
|
128 |
And I turn editing mode on
|
|
|
129 |
And I add the "Online users" block
|
|
|
130 |
And I log out
|
|
|
131 |
And I log in as "student1"
|
|
|
132 |
And I am on site homepage
|
|
|
133 |
And "Hide" "icon" should exist in the "#change-user-visibility" "css_element"
|
|
|
134 |
And I click on "#change-user-visibility" "css_element"
|
|
|
135 |
And I wait "1" seconds
|
|
|
136 |
And "Show" "icon" should exist in the "#change-user-visibility" "css_element"
|
|
|
137 |
And I log out
|
|
|
138 |
And I log in as "student2"
|
|
|
139 |
And I am on site homepage
|
|
|
140 |
And I should see "2 online user" in the "Online users" "block"
|
|
|
141 |
And I should not see "Admin" in the "Online users" "block"
|
|
|
142 |
And I should see "Other users (1)" in the "Online users" "block"
|
|
|
143 |
And I should see "Student 2" in the "Online users" "block"
|
|
|
144 |
And I should not see "Student 1" in the "Online users" "block"
|
|
|
145 |
And I log out
|
|
|
146 |
And the following config values are set as admin:
|
|
|
147 |
| block_online_users_onlinestatushiding | 0 |
|
|
|
148 |
And I log in as "student2"
|
|
|
149 |
When I am on site homepage
|
|
|
150 |
Then I should see "3 online users" in the "Online users" "block"
|
|
|
151 |
And I should not see "Admin" in the "Online users" "block"
|
|
|
152 |
And I should see "Other users (1)" in the "Online users" "block"
|
|
|
153 |
And I should see "Student 2" in the "Online users" "block"
|
|
|
154 |
And I should see "Student 1" in the "Online users" "block"
|