1
0
mirror of https://github.com/moodle/moodle.git synced 2025-04-24 18:04:43 +02:00

Merge branch 'MDL-54577-master' of git://github.com/cameron1729/moodle

This commit is contained in:
David Monllao 2016-05-30 15:45:47 +08:00
commit 7e93c2e6f6
3 changed files with 162 additions and 0 deletions

@ -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"

@ -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"

@ -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"