diff --git a/blocks/online_users/tests/behat/block_online_users_course.feature b/blocks/online_users/tests/behat/block_online_users_course.feature new file mode 100644 index 00000000000..f2022354fc3 --- /dev/null +++ b/blocks/online_users/tests/behat/block_online_users_course.feature @@ -0,0 +1,41 @@ +@block @block_online_users +Feature: The online users block allow you to see who is currently online + In order to enable the online users block on an course page + As a teacher + I can add the online users block to a course page + + Background: + Given the following "courses" exist: + | fullname | shortname | category | + | Course 1 | C1 | 0 | + And the following "users" exist: + | username | firstname | lastname | email | + | teacher1 | Teacher | 1 | teacher1@example.com | + | student1 | Student | 1 | student1@example.com | + | student2 | Student | 2 | student2@example.com | + + And the following "course enrolments" exist: + | user | course | role | + | teacher1 | C1 | editingteacher | + | student1 | C1 | student | + + Scenario: Add the online users on course page and see myself + Given I log in as "teacher1" + And I follow "Course 1" + And I turn editing mode on + When I add the "Online users" block + Then I should see "Teacher 1" in the "Online users" "block" + + Scenario: Add the online users on course page and see other logged in users + Given I log in as "teacher1" + And I follow "Course 1" + And I turn editing mode on + And I add the "Online users" block + And I log out + And I log in as "student2" + And I log out + When I log in as "student1" + And I follow "Course 1" + Then I should see "Teacher 1" in the "Online users" "block" + And I should see "Student 1" in the "Online users" "block" + And I should not see "Student 2" in the "Online users" "block" diff --git a/blocks/online_users/tests/behat/block_online_users_dashboard.feature b/blocks/online_users/tests/behat/block_online_users_dashboard.feature new file mode 100644 index 00000000000..ecde2a0ad4b --- /dev/null +++ b/blocks/online_users/tests/behat/block_online_users_dashboard.feature @@ -0,0 +1,26 @@ +@block @block_online_users +Feature: The online users block allow you to see who is currently online + In order to use the online users block on the dashboard + As a user + I can view the online users block on my dashboard + + Background: + Given the following "users" exist: + | username | firstname | lastname | email | + | teacher1 | Teacher | 1 | teacher1@example.com | + | student1 | Student | 1 | student1@example.com | + | student2 | Student | 2 | student2@example.com | + + Scenario: View the online users block on the dashboard and see myself + Given I log in as "teacher1" + Then I should see "Teacher 1" in the "Online users" "block" + + Scenario: View the online users block on the dashboard and see other logged in users + Given I log in as "student2" + And I log out + And I log in as "student1" + And I log out + When I log in as "teacher1" + Then I should see "Teacher 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" diff --git a/blocks/online_users/tests/behat/block_online_users_frontpage.feature b/blocks/online_users/tests/behat/block_online_users_frontpage.feature new file mode 100644 index 00000000000..3e4b56d6c24 --- /dev/null +++ b/blocks/online_users/tests/behat/block_online_users_frontpage.feature @@ -0,0 +1,48 @@ +@block @block_online_users +Feature: The online users block allow you to see who is currently online + In order to enable the online users block on the front page page + As an admin + I can add the online users block to the front page page + + Background: + Given the following "users" exist: + | username | firstname | lastname | email | + | student1 | Student | 1 | student1@example.com | + | student2 | Student | 2 | student2@example.com | + + Scenario: View the online users block on the front page and see myself + Given I log in as "admin" + And I am on site homepage + And I navigate to "Turn editing on" node in "Front page settings" + When I add the "Online users" block + Then I should see "Admin User" in the "Online users" "block" + + Scenario: View the online users block on the front page as a logged in user + Given I log in as "admin" + And I am on site homepage + And I navigate to "Turn editing on" node in "Front page settings" + And I add the "Online users" block + And I log out + And I log in as "student2" + 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" + And I should see "Student 1" in the "Online users" "block" + And I should see "Student 2" in the "Online users" "block" + + Scenario: View the online users block on the front page as a guest + Given I log in as "admin" + And I am on site homepage + And I navigate to "Turn editing on" node in "Front page settings" + And I add the "Online users" block + And I log out + And I log in as "student2" + And I log out + And I log in as "student1" + 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"