diff --git a/blocks/messages/tests/behat/block_messages_course.feature b/blocks/messages/tests/behat/block_messages_course.feature new file mode 100644 index 00000000000..068b0e0dd66 --- /dev/null +++ b/blocks/messages/tests/behat/block_messages_course.feature @@ -0,0 +1,58 @@ +@block @block_messages +Feature: The messages block allows users to list new messages an a course + In order to enable the messages block in a course + As a teacher + I can add the messages block to a course and view my messages + + Background: + Given the following "users" exist: + | username | firstname | lastname | email | idnumber | + | teacher1 | Teacher | 1 | teacher1@example.com | T1 | + | student1 | Student | 1 | student1@example.com | S1 | + 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 | + + Scenario: View the block by a user with messaging disabled. + Given the following config values are set as admin: + | messaging | 0 | + And I log in as "teacher1" + And I follow "Course 1" + When I turn editing mode on + And I add the "Messages" block + Then I should see "Messaging is disabled on this site" in the "Messages" "block" + + Scenario: View the block by a user who does not have any messages. + Given I log in as "teacher1" + And I follow "Course 1" + When I turn editing mode on + And I add the "Messages" block + Then I should see "No messages waiting" in the "Messages" "block" + + Scenario: View the block by a user who has messages. + Given I log in as "student1" + And I follow "Messages" in the user menu + And I send "This is message 1" message to "Teacher 1" user + And I send "This is message 2" message to "Teacher 1" user + And I log out + And I log in as "teacher1" + And I follow "Course 1" + When I turn editing mode on + And I add the "Messages" block + Then I should see "Student 1" in the "Messages" "block" + + Scenario: Use the block to send a message to a user. + Given I log in as "teacher1" + And I follow "Course 1" + And I turn editing mode on + And I add the "Messages" block + And I follow "Messages" + And I send "This is message 1" message to "Student 1" user + And I log out + When I log in as "student1" + And I follow "Course 1" + Then I should see "Teacher 1" in the "Messages" "block" diff --git a/blocks/messages/tests/behat/block_messages_dashboard.feature b/blocks/messages/tests/behat/block_messages_dashboard.feature new file mode 100644 index 00000000000..8eb19186a89 --- /dev/null +++ b/blocks/messages/tests/behat/block_messages_dashboard.feature @@ -0,0 +1,48 @@ +@block @block_messages +Feature: The messages block allows users to list new messages on the dashboard + In order to enable the messages block on the dashboard + As a user + I can add the messages block to a my dashboard and view my messages + + Background: + Given the following "users" exist: + | username | firstname | lastname | email | idnumber | + | teacher1 | Teacher | 1 | teacher1@example.com | T1 | + | student1 | Student | 1 | student1@example.com | S1 | + + Scenario: View the block by a user with messaging disabled. + Given the following config values are set as admin: + | messaging | 0 | + And I log in as "teacher1" + And I press "Customise this page" + When I add the "Messages" block + Then I should see "Messaging is disabled on this site" in the "Messages" "block" + + Scenario: View the block by a user who does not have any messages. + Given I log in as "teacher1" + And I press "Customise this page" + When I add the "Messages" block + Then I should see "No messages waiting" in the "Messages" "block" + + Scenario: View the block by a user who has messages. + Given I log in as "student1" + And I follow "Messages" in the user menu + And I send "This is message 1" message to "Teacher 1" user + And I send "This is message 2" message to "Teacher 1" user + And I log out + When I log in as "teacher1" + And I press "Customise this page" + And I add the "Messages" block + Then I should see "Student 1" in the "Messages" "block" + + Scenario: Use the block to send a message to a user. + Given I log in as "teacher1" + And I press "Customise this page" + And I add the "Messages" block + And I follow "Messages" + And I send "This is message 1" message to "Student 1" user + And I log out + When I log in as "student1" + And I press "Customise this page" + And I add the "Messages" block + Then I should see "Teacher 1" in the "Messages" "block" diff --git a/blocks/messages/tests/behat/block_messages_frontpage.feature b/blocks/messages/tests/behat/block_messages_frontpage.feature new file mode 100644 index 00000000000..df009914525 --- /dev/null +++ b/blocks/messages/tests/behat/block_messages_frontpage.feature @@ -0,0 +1,56 @@ +@block @block_messages +Feature: The messages block allows users to list new messages on the frontpage + In order to enable the messages block on the frontpage + As an admin + I can add the messages block to a the frontpage and view my messages + + Background: + Given the following "users" exist: + | username | firstname | lastname | email | idnumber | + | teacher1 | Teacher | 1 | teacher1@example.com | T1 | + | student1 | Student | 1 | student1@example.com | S1 | + And 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 "Messages" block + And I log out + + Scenario: View the block by a user with messaging disabled. + Given the following config values are set as admin: + | messaging | 0 | + And I log in as "admin" + And I am on site homepage + When I navigate to "Turn editing on" node in "Front page settings" + And I should see "Messaging is disabled on this site" in the "Messages" "block" + Then I navigate to "Turn editing off" node in "Front page settings" + And I should not see "Messaging is disabled on this site" + + Scenario: View the block by a user who does not have any messages. + Given I log in as "teacher1" + When I am on site homepage + Then I should see "No messages waiting" in the "Messages" "block" + + Scenario: Try to view the block as a guest user. + Given I log in as "guest" + When I am on site homepage + Then I should not see "Messages" + + Scenario: View the block by a user who has messages. + Given I log in as "student1" + And I follow "Messages" in the user menu + And I send "This is message 1" message to "Teacher 1" user + And I send "This is message 2" message to "Teacher 1" user + And I log out + When I log in as "teacher1" + And I am on site homepage + Then I should see "Student 1" in the "Messages" "block" + + Scenario: Use the block to send a message to a user. + Given I log in as "teacher1" + And I am on site homepage + And I follow "Messages" + And I send "This is message 1" message to "Student 1" user + And I log out + When I log in as "student1" + And I am on site homepage + Then I should see "Teacher 1" in the "Messages" "block"