MDL-64745 block_online_users: Add behat tests

This commit is contained in:
Mihail Geshoski 2019-09-27 13:23:52 +08:00
parent e94de2d6d3
commit 0a9150c009
3 changed files with 144 additions and 3 deletions

View File

@ -42,7 +42,9 @@ Feature: The online users block allow you to see who is currently online
@javascript
Scenario: Hide/show user's online status from/to other users in the online users block on course page
Given I log in as "teacher1"
Given the following config values are set as admin:
| block_online_users_onlinestatushiding | 1 |
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add the "Online users" block
And I log out
@ -71,3 +73,45 @@ Feature: The online users block allow you to see who is currently online
Then I should see "2 online users" in the "Online users" "block"
And I should see "Teacher 1" in the "Online users" "block"
And I should see "Student 1" in the "Online users" "block"
@javascript
Scenario: Hide/show icon is not visible in the online users block on course page when the setting is disabled
Given the following config values are set as admin:
| block_online_users_onlinestatushiding | 1 |
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add the "Online users" block
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And "Hide" "icon" should exist in the ".block.block_online_users" "css_element"
And I log out
And the following config values are set as admin:
| block_online_users_onlinestatushiding | 0 |
When I log in as "student1"
Then I should see "Student 1" in the "Online users" "block"
And "Hide" "icon" should not exist in the ".block.block_online_users" "css_element"
@javascript
Scenario: User is displayed in the online users block on course page when visibility setting is disabled,
ignoring the previously set visibility state
Given the following config values are set as admin:
| block_online_users_onlinestatushiding | 1 |
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add the "Online users" block
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And "Hide" "icon" should exist in the "#change-user-visibility" "css_element"
And I click on "#change-user-visibility" "css_element"
And I wait "1" seconds
And "Show" "icon" should exist in the "#change-user-visibility" "css_element"
And I log out
And the following config values are set as admin:
| block_online_users_onlinestatushiding | 0 |
And I log in as "teacher1"
When I am on "Course 1" course homepage
Then I should see "2 online users" in the "Online users" "block"
And I should see "Teacher 1" in the "Online users" "block"
And I should see "Student 1" in the "Online users" "block"

View File

@ -29,7 +29,9 @@ Feature: The online users block allow you to see who is currently online on dash
@javascript
Scenario: Hide/show user's online status from/to other users in the online users block on dashboard
Given I log in as "student1"
Given the following config values are set as admin:
| block_online_users_onlinestatushiding | 1 |
And I log in as "student1"
And I should see "1 online user" in the "Online users" "block"
And I should see "Student 1" in the "Online users" "block"
And "Hide" "icon" should exist in the "#change-user-visibility" "css_element"
@ -52,3 +54,44 @@ Feature: The online users block allow you to see who is currently online on dash
Then I should see "2 online users" in the "Online users" "block"
And I should see "Student 2" in the "Online users" "block"
And I should see "Student 1" in the "Online users" "block"
@javascript
Scenario: Hide/show icon is not visible in the online users block when the setting is disabled
Given the following config values are set as admin:
| block_online_users_onlinestatushiding | 1 |
And I log in as "student1"
And I should see "1 online user" in the "Online users" "block"
And I should see "Student 1" in the "Online users" "block"
And "Hide" "icon" should exist in the ".block.block_online_users" "css_element"
And I log out
And the following config values are set as admin:
| block_online_users_onlinestatushiding | 0 |
When I log in as "student1"
Then I should see "1 online user" in the "Online users" "block"
And I should see "Student 1" in the "Online users" "block"
And "Hide" "icon" should not exist in the ".block.block_online_users" "css_element"
@javascript
Scenario: User is displayed in the online users block when visibility setting is disabled,
ignoring the previously set visibility state
Given the following config values are set as admin:
| block_online_users_onlinestatushiding | 1 |
And I log in as "student1"
And I should see "1 online user" in the "Online users" "block"
And I should see "Student 1" in the "Online users" "block"
And "Hide" "icon" should exist in the "#change-user-visibility" "css_element"
And I click on "#change-user-visibility" "css_element"
And I wait "1" seconds
And "Show" "icon" should exist in the "#change-user-visibility" "css_element"
And I log out
And I log in as "student2"
And I should see "1 online user" in the "Online users" "block"
And I should see "Student 2" in the "Online users" "block"
And I should not see "Student 1" in the "Online users" "block"
And I log out
And the following config values are set as admin:
| block_online_users_onlinestatushiding | 0 |
When I log in as "student2"
Then I should see "2 online users" in the "Online users" "block"
And I should see "Student 2" in the "Online users" "block"
And I should see "Student 1" in the "Online users" "block"

View File

@ -52,7 +52,9 @@ Feature: The online users block allow you to see who is currently online on fron
@javascript
Scenario: Hide/show user's online status from/to other users in the online users block on front page
Given I log in as "admin"
Given the following config values are set as admin:
| block_online_users_onlinestatushiding | 1 |
And I log in as "admin"
And I am on site homepage
And I navigate to "Turn editing on" in current page administration
And I add the "Online users" block
@ -84,3 +86,55 @@ Feature: The online users block allow you to see who is currently online on fron
And I should see "Admin" in the "Online users" "block"
And I should see "Student 2" in the "Online users" "block"
And I should see "Student 1" in the "Online users" "block"
@javascript
Scenario: Hide/show icon is not visible in the online users block on front page when the setting is disabled
Given the following config values are set as admin:
| block_online_users_onlinestatushiding | 1 |
And I log in as "admin"
And I am on site homepage
And I navigate to "Turn editing on" in current page administration
And I add the "Online users" block
And I log out
And I log in as "student1"
And I am on site homepage
And "Hide" "icon" should exist in the ".block.block_online_users" "css_element"
And I log out
And the following config values are set as admin:
| block_online_users_onlinestatushiding | 0 |
When I log in as "student1"
Then I should see "Student 1" in the "Online users" "block"
And "Hide" "icon" should not exist in the ".block.block_online_users" "css_element"
@javascript
Scenario: User is displayed in the online users block on front page when visibility setting is disabled,
ignoring the previously set visibility state
Given the following config values are set as admin:
| block_online_users_onlinestatushiding | 1 |
And I log in as "admin"
And I am on site homepage
And I navigate to "Turn editing on" in current page administration
And I add the "Online users" block
And I log out
And I log in as "student1"
And I am on site homepage
And "Hide" "icon" should exist in the "#change-user-visibility" "css_element"
And I click on "#change-user-visibility" "css_element"
And I wait "1" seconds
And "Show" "icon" should exist in the "#change-user-visibility" "css_element"
And I log out
And I log in as "student2"
And I am on site homepage
And I should see "2 online user" in the "Online users" "block"
And I should see "Admin" in the "Online users" "block"
And I should see "Student 2" in the "Online users" "block"
And I should not see "Student 1" in the "Online users" "block"
And I log out
And the following config values are set as admin:
| block_online_users_onlinestatushiding | 0 |
And I log in as "student2"
When I am on site homepage
Then I should see "3 online users" in the "Online users" "block"
And I should see "Admin" in the "Online users" "block"
And I should see "Student 2" in the "Online users" "block"
And I should see "Student 1" in the "Online users" "block"