MDL-59293 block_onlineusers: Update behat tests

This commit is contained in:
Peter Dias 2021-02-25 10:06:10 +08:00 committed by Víctor Déniz
parent 9c4f2a55b6
commit d1a71ec909
2 changed files with 32 additions and 10 deletions

View file

@ -1,5 +1,6 @@
@block @block_online_users @block @block_online_users
Feature: The online users block allow you to see who is currently online on dashboard 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 In order to use the online users block on the dashboard
As a user As a user
I can view the online users block on my dashboard 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 | | teacher1 | Teacher | 1 | teacher1@example.com |
| student1 | Student | 1 | student1@example.com | | student1 | Student | 1 | student1@example.com |
| student2 | Student | 2 | student2@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 Scenario: View the online users block on the dashboard and see myself
Given I log in as "teacher1" Given I log in as "teacher1"

View file

@ -1,14 +1,22 @@
@block @block_online_users @block @block_online_users
Feature: The online users block allow you to see who is currently online on frontpage 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 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: Background:
Given the following "users" exist: Given the following "users" exist:
| username | firstname | lastname | email | | username | firstname | lastname | email |
| student1 | Student | 1 | student1@example.com | | student1 | Student | 1 | student1@example.com |
| student2 | Student | 2 | student2@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 Scenario: View the online users block on the front page and see myself
Given I log in as "admin" 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 And I log out
When I log in as "student1" When I log in as "student1"
And I am on site homepage 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 1" in the "Online users" "block"
And I should see "Student 2" 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" 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 And I log out
When I log in as "guest" When I log in as "guest"
And I am on site homepage 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 "Student 1" in the "Online users" "block" And I should not see "Student 1" in the "Online users" "block"
And I should see "Student 2" 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" And I should see "3 online users" in the "Online users" "block"
@javascript @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" When I log in as "student2"
And I am on site homepage And I am on site homepage
Then I should see "2 online user" in the "Online users" "block" 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 see "Student 2" in the "Online users" "block"
And I should not see "Student 1" in the "Online users" "block" And I should not see "Student 1" in the "Online users" "block"
And I log out 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" When I log in as "student2"
And I am on site homepage And I am on site homepage
Then I should see "3 online users" in the "Online users" "block" 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 2" in the "Online users" "block"
And I should see "Student 1" 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 log in as "student2"
And I am on site homepage And I am on site homepage
And I should see "2 online user" in the "Online users" "block" 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 see "Student 2" in the "Online users" "block"
And I should not see "Student 1" in the "Online users" "block" And I should not see "Student 1" in the "Online users" "block"
And I log out 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" And I log in as "student2"
When I am on site homepage When I am on site homepage
Then I should see "3 online users" in the "Online users" "block" 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 2" in the "Online users" "block"
And I should see "Student 1" in the "Online users" "block" And I should see "Student 1" in the "Online users" "block"