From d1a71ec909f6b9ddd6cff49ad88210b491f6503d Mon Sep 17 00:00:00 2001 From: Peter Dias Date: Thu, 25 Feb 2021 10:06:10 +0800 Subject: [PATCH] MDL-59293 block_onlineusers: Update behat tests --- .../block_online_users_dashboard.feature | 9 +++++ .../block_online_users_frontpage.feature | 33 +++++++++++++------ 2 files changed, 32 insertions(+), 10 deletions(-) diff --git a/blocks/online_users/tests/behat/block_online_users_dashboard.feature b/blocks/online_users/tests/behat/block_online_users_dashboard.feature index 2d32fc61caf..d15e46a7b07 100644 --- a/blocks/online_users/tests/behat/block_online_users_dashboard.feature +++ b/blocks/online_users/tests/behat/block_online_users_dashboard.feature @@ -1,5 +1,6 @@ @block @block_online_users Feature: The online users block allow you to see who is currently online on dashboard + There should be some commonality for the users to show up In order to use the online users block on the dashboard As a user I can view the online users block on my dashboard @@ -10,6 +11,14 @@ Feature: The online users block allow you to see who is currently online on dash | teacher1 | Teacher | 1 | teacher1@example.com | | student1 | Student | 1 | student1@example.com | | student2 | Student | 2 | student2@example.com | + And the following "courses" exist: + | fullname | shortname | category | + | Course 1 | C1 | 0 | + And the following "course enrolments" exist: + | user | course | role | + | teacher1 | C1 | editingteacher | + | student1 | C1 | student | + | student2 | C1 | student | Scenario: View the online users block on the dashboard and see myself Given I log in as "teacher1" diff --git a/blocks/online_users/tests/behat/block_online_users_frontpage.feature b/blocks/online_users/tests/behat/block_online_users_frontpage.feature index ca817e8142d..1f141b09db7 100644 --- a/blocks/online_users/tests/behat/block_online_users_frontpage.feature +++ b/blocks/online_users/tests/behat/block_online_users_frontpage.feature @@ -1,14 +1,22 @@ @block @block_online_users Feature: The online users block allow you to see who is currently online on frontpage - In order to enable the online users block on the front page page + There should be some commonality for the users to show up + In order to enable the online users block on the frontpage As an admin - I can add the online users block to the front page page + I can add the online users block to the frontpage Background: Given the following "users" exist: | username | firstname | lastname | email | | student1 | Student | 1 | student1@example.com | | student2 | Student | 2 | student2@example.com | + And the following "courses" exist: + | fullname | shortname | category | + | Course 1 | C1 | 0 | + And the following "course enrolments" exist: + | user | course | role | + | student1 | C1 | student | + | student2 | C1 | student | Scenario: View the online users block on the front page and see myself Given I log in as "admin" @@ -28,7 +36,8 @@ Feature: The online users block allow you to see who is currently online on fron And I log out When I log in as "student1" And I am on site homepage - Then I should see "Admin User" in the "Online users" "block" + Then I should not see "Admin User" in the "Online users" "block" + And I should see "Other Users (1)" in the "Online users" "block" And I should see "Student 1" in the "Online users" "block" And I should see "Student 2" in the "Online users" "block" And I should see "3 online users" in the "Online users" "block" @@ -45,9 +54,9 @@ Feature: The online users block allow you to see who is currently online on fron And I log out When I log in as "guest" And I am on site homepage - Then I should see "Admin User" in the "Online users" "block" - And I should see "Student 1" in the "Online users" "block" - And I should see "Student 2" in the "Online users" "block" + Then I should not see "Admin User" in the "Online users" "block" + And I should not see "Student 1" in the "Online users" "block" + And I should not see "Student 2" in the "Online users" "block" And I should see "3 online users" in the "Online users" "block" @javascript @@ -69,7 +78,8 @@ Feature: The online users block allow you to see who is currently online on fron When I log in as "student2" And I am on site homepage Then I should see "2 online user" in the "Online users" "block" - And I should see "Admin" in the "Online users" "block" + And I should not see "Admin" in the "Online users" "block" + And I should see "Other Users (1)" 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 @@ -83,7 +93,8 @@ Feature: The online users block allow you to see who is currently online on fron When I log in as "student2" And 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 not see "Admin" in the "Online users" "block" + And I should see "Other Users (1)" 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" @@ -126,7 +137,8 @@ Feature: The online users block allow you to see who is currently online on fron 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 not see "Admin" in the "Online users" "block" + And I should see "Other Users (1)" 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 @@ -135,6 +147,7 @@ Feature: The online users block allow you to see who is currently online on fron 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 not see "Admin" in the "Online users" "block" + And I should see "Other Users (1)" 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"