mirror of
https://github.com/moodle/moodle.git
synced 2025-03-14 04:30:15 +01:00
Merge branch 'MDL-55926-master-3' of git://github.com/ryanwyllie/moodle
This commit is contained in:
commit
ad2eba780a
@ -59,6 +59,8 @@ class behat_partial_named_selector extends \Behat\Mink\Selector\PartialNamedSele
|
||||
'dialogue' => 'dialogue',
|
||||
'fieldset' => 'fieldset',
|
||||
'list_item' => 'list_item',
|
||||
'message_area_region' => 'message_area_region',
|
||||
'message_area_region_content' => 'message_area_region_content',
|
||||
'question' => 'question',
|
||||
'region' => 'region',
|
||||
'section' => 'section',
|
||||
@ -85,6 +87,9 @@ class behat_partial_named_selector extends \Behat\Mink\Selector\PartialNamedSele
|
||||
'link' => 'link',
|
||||
'link_or_button' => 'link_or_button',
|
||||
'list_item' => 'list_item',
|
||||
'message_area_action' => 'message_area_action',
|
||||
'message_area_region' => 'message_area_region',
|
||||
'message_area_region_content' => 'message_area_region_content',
|
||||
'optgroup' => 'optgroup',
|
||||
'option' => 'option',
|
||||
'question' => 'question',
|
||||
@ -152,6 +157,15 @@ XPATH
|
||||
XPATH
|
||||
, 'form_row' => <<<XPATH
|
||||
.//*[self::label or self::div[contains(concat(' ', @class, ' '), ' fstaticlabel ')]][contains(., %locator%)]/ancestor::*[contains(concat(' ', @class, ' '), ' fitem ')]
|
||||
XPATH
|
||||
, 'message_area_region' => <<<XPATH
|
||||
.//div[@data-region='messaging-area']/descendant::*[@data-region = %locator%]
|
||||
XPATH
|
||||
, 'message_area_region_content' => <<<XPATH
|
||||
.//div[@data-region='messaging-area']/descendant::*[@data-region-content = %locator%]
|
||||
XPATH
|
||||
, 'message_area_action' => <<<XPATH
|
||||
.//div[@data-region='messaging-area']/descendant::*[@data-action = %locator%]
|
||||
XPATH
|
||||
);
|
||||
|
||||
|
@ -38,18 +38,18 @@ require_once(__DIR__ . '/../../../lib/behat/behat_base.php');
|
||||
class behat_message extends behat_base {
|
||||
|
||||
/**
|
||||
* Sends a message to the specified user from the logged user. The user full name should contain the first and last names.
|
||||
* View the contact information of a user in the messages ui.
|
||||
*
|
||||
* @Given /^I view the message profile for "(?P<user_full_name_string>(?:[^"]|\\")*)" user$/
|
||||
* @Given /^I view the "(?P<user_full_name_string>(?:[^"]|\\")*)" contact in the message area$/
|
||||
* @param string $userfullname
|
||||
*/
|
||||
public function i_view_users_message_profile($userfullname) {
|
||||
public function i_view_contact_in_messages($userfullname) {
|
||||
// Visit home page and follow messages.
|
||||
$this->execute("behat_general::i_am_on_homepage");
|
||||
|
||||
$this->execute("behat_navigation::i_follow_in_the_user_menu", get_string('messages', 'message'));
|
||||
|
||||
$this->execute('behat_general::i_click_on', array("[data-action='contacts-view']", 'css_element'));
|
||||
$this->execute('behat_general::i_click_on', array("contacts-view", 'message_area_action'));
|
||||
|
||||
$this->execute('behat_general::wait_until_the_page_is_ready');
|
||||
|
||||
@ -59,8 +59,17 @@ class behat_message extends behat_base {
|
||||
|
||||
$this->execute('behat_general::wait_until_the_page_is_ready');
|
||||
|
||||
$this->execute('behat_general::i_click_on', array("//div[@data-action='view-contact-profile']
|
||||
[./div[contains(normalize-space(.), '" . $this->escape($userfullname) . "')]]", 'xpath_element'));
|
||||
// Need to limit the click to the search results because the 'view-contact-profile' elements
|
||||
// can occur in two separate divs on the page.
|
||||
$this->execute('behat_general::i_click_on_in_the',
|
||||
array(
|
||||
"//div[@data-action='view-contact-profile']
|
||||
[./div[contains(normalize-space(.), '" . $this->escape($userfullname) . "')]]",
|
||||
'xpath_element',
|
||||
"[data-region='messaging-area'] [data-region='search-results-area']",
|
||||
"css_element",
|
||||
)
|
||||
);
|
||||
|
||||
$this->execute('behat_general::wait_until_the_page_is_ready');
|
||||
}
|
||||
@ -73,7 +82,7 @@ class behat_message extends behat_base {
|
||||
* @param string $userfullname
|
||||
*/
|
||||
public function i_send_message_to_user($messagecontent, $userfullname) {
|
||||
$this->i_view_users_message_profile($userfullname);
|
||||
$this->i_view_contact_in_messages($userfullname);
|
||||
|
||||
$this->execute("behat_general::i_click_on", array("[data-action='profile-send-message']", 'css_element'));
|
||||
|
||||
@ -85,4 +94,18 @@ class behat_message extends behat_base {
|
||||
|
||||
$this->execute("behat_forms::press_button", get_string('send', 'message'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Select messages from a user in the messaging ui.
|
||||
*
|
||||
* @Given /^I send "(?P<message_contents_string>(?:[^"]|\\")*)" message in the message area$/
|
||||
* @param string $messagecontent
|
||||
*/
|
||||
public function i_send_message_in_the_message_area($messagecontent) {
|
||||
$this->execute('behat_forms::i_set_the_field_with_xpath_to',
|
||||
array("//textarea[@data-region='send-message-txt']", $this->escape($messagecontent))
|
||||
);
|
||||
|
||||
$this->execute("behat_forms::press_button", get_string('send', 'message'));
|
||||
}
|
||||
}
|
||||
|
27
message/tests/behat/delete_all_messages.feature
Normal file
27
message/tests/behat/delete_all_messages.feature
Normal file
@ -0,0 +1,27 @@
|
||||
@core @message @javascript
|
||||
Feature: Delete all messages
|
||||
In order to communicate with fellow users
|
||||
As a user
|
||||
I need to be able to delete all messages
|
||||
|
||||
Scenario: Delete all messages
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| user1 | User | 1 | user1@example.com |
|
||||
| user2 | User | 2 | user2@example.com |
|
||||
And I log in as "user2"
|
||||
And I send "User 2 to User 1 message 1" message to "User 1" user
|
||||
And I send "User 2 to User 1 message 2" message in the message area
|
||||
And I send "User 2 to User 1 message 3" message in the message area
|
||||
And I log out
|
||||
When I log in as "user1"
|
||||
And I follow "Messages" in the user menu
|
||||
And I click on "start-delete-messages" "message_area_action"
|
||||
And I click on "Delete all" "button"
|
||||
# Confirm dialogue.
|
||||
And I click on "Yes" "button"
|
||||
# Confirm the interface is immediately updated.
|
||||
Then I should not see "User 2" in the "conversations" "message_area_region_content"
|
||||
# Confirm the changes are persisted.
|
||||
And I reload the page
|
||||
And I should not see "User 2" in the "conversations" "message_area_region_content"
|
31
message/tests/behat/delete_messages.feature
Normal file
31
message/tests/behat/delete_messages.feature
Normal file
@ -0,0 +1,31 @@
|
||||
@core @message @javascript
|
||||
Feature: Delete messages
|
||||
In order to communicate with fellow users
|
||||
As a user
|
||||
I need to be able to delete messages
|
||||
|
||||
Scenario: Delete messages
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| user1 | User | 1 | user1@example.com |
|
||||
| user2 | User | 2 | user2@example.com |
|
||||
And I log in as "user2"
|
||||
And I send "User 2 to User 1 message 1" message to "User 1" user
|
||||
And I send "User 2 to User 1 message 2" message in the message area
|
||||
And I send "User 2 to User 1 message 3" message in the message area
|
||||
And I log out
|
||||
When I log in as "user1"
|
||||
And I follow "Messages" in the user menu
|
||||
And I click on "start-delete-messages" "message_area_action"
|
||||
And I click on "User 2 to User 1 message 1" "text" in the "messages" "message_area_region"
|
||||
And I click on "User 2 to User 1 message 2" "text" in the "messages" "message_area_region"
|
||||
And I click on "Delete selected messages" "button"
|
||||
# Confirm the interface is immediately updated.
|
||||
Then I should see "User 2 to User 1 message 3" in the "messages" "message_area_region"
|
||||
And I should not see "User 2 to User 1 message 2" in the "messages" "message_area_region"
|
||||
And I should not see "User 2 to User 1 message 1" in the "messages" "message_area_region"
|
||||
# Confirm that the changes are persisted.
|
||||
And I reload the page
|
||||
And I should see "User 2 to User 1 message 3" in the "messages" "message_area_region"
|
||||
And I should not see "User 2 to User 1 message 2" in the "messages" "message_area_region"
|
||||
And I should not see "User 2 to User 1 message 1" in the "messages" "message_area_region"
|
34
message/tests/behat/manage_contacts.feature
Normal file
34
message/tests/behat/manage_contacts.feature
Normal file
@ -0,0 +1,34 @@
|
||||
@core @message @javascript
|
||||
Feature: Search users
|
||||
In order to communicate with fellow users
|
||||
As a user
|
||||
I need to be able to add and remove them from my contacts
|
||||
|
||||
Background:
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| user1 | User | 1 | user1@example.com |
|
||||
| user2 | User | 2 | user2@example.com |
|
||||
| user3 | User | 3 | user3@example.com |
|
||||
And I log in as "user1"
|
||||
And I view the "User 2" contact in the message area
|
||||
And I click on "Add contact" "link"
|
||||
And I view the "User 3" contact in the message area
|
||||
And I click on "Add contact" "link"
|
||||
And I log out
|
||||
|
||||
Scenario: Add contact shows in contacts tab
|
||||
When I log in as "user1"
|
||||
And I follow "Messages" in the user menu
|
||||
And I click on "contacts-view" "message_area_action"
|
||||
Then I should see "User 2" in the "contacts" "message_area_region_content"
|
||||
And I should see "User 3" in the "contacts" "message_area_region_content"
|
||||
|
||||
Scenario: Remove contact
|
||||
When I log in as "user1"
|
||||
And I view the "User 3" contact in the message area
|
||||
And I click on "Remove contact" "link"
|
||||
And I reload the page
|
||||
And I click on "contacts-view" "message_area_action"
|
||||
Then I should see "User 2" in the "contacts" "message_area_region_content"
|
||||
And I should not see "User 3" in the "contacts" "message_area_region_content"
|
22
message/tests/behat/reply_message.feature
Normal file
22
message/tests/behat/reply_message.feature
Normal file
@ -0,0 +1,22 @@
|
||||
@core @message @javascript
|
||||
Feature: Reply message
|
||||
In order to communicate with fellow users
|
||||
As a user
|
||||
I need to be able to reply to a message
|
||||
|
||||
Scenario: Reply to a message
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| user1 | User | 1 | user1@example.com |
|
||||
| user2 | User | 2 | user2@example.com |
|
||||
And I log in as "user2"
|
||||
And I send "User 2 to User 1" message to "User 1" user
|
||||
And I log out
|
||||
When I log in as "user1"
|
||||
And I follow "Messages" in the user menu
|
||||
And I click on "User 2" "text" in the "conversations" "message_area_region_content"
|
||||
And I send "Reply to User 2" message in the message area
|
||||
And I log out
|
||||
Then I log in as "user2"
|
||||
And I follow "Messages" in the user menu
|
||||
And I should see "Reply to User 2" in the "conversations" "message_area_region_content"
|
31
message/tests/behat/search_messages.feature
Normal file
31
message/tests/behat/search_messages.feature
Normal file
@ -0,0 +1,31 @@
|
||||
@core @message @javascript
|
||||
Feature: Search messages
|
||||
In order to communicate with fellow users
|
||||
As a user
|
||||
I need to be able to search my messages
|
||||
|
||||
Background:
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| user1 | User | 1 | user1@example.com |
|
||||
| user2 | User | 2 | user2@example.com |
|
||||
| user3 | User | 3 | user3@example.com |
|
||||
And I log in as "user2"
|
||||
And I send "User 2 to User 1" message to "User 1" user
|
||||
And I log out
|
||||
And I log in as "user3"
|
||||
And I send "User 3 to User 1" message to "User 1" user
|
||||
And I log out
|
||||
|
||||
Scenario: Search for messages
|
||||
When I log in as "user1"
|
||||
And I follow "Messages" in the user menu
|
||||
And I set the field "Search messages" to "User 2 to User 1"
|
||||
Then I should see "User 2" in the "search-results-area" "message_area_region"
|
||||
And I should not see "User 3" in the "search-results-area" "message_area_region"
|
||||
|
||||
Scenario: Search for messages no results
|
||||
When I log in as "user1"
|
||||
And I follow "Messages" in the user menu
|
||||
And I set the field "Search messages" to "No message"
|
||||
Then I should see "No results" in the "search-results-area" "message_area_region"
|
36
message/tests/behat/search_users.feature
Normal file
36
message/tests/behat/search_users.feature
Normal file
@ -0,0 +1,36 @@
|
||||
@core @message @javascript
|
||||
Feature: Search users
|
||||
In order to communicate with fellow users
|
||||
As a user
|
||||
I need to be able to search for them
|
||||
|
||||
Background:
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| user1 | User | 1 | user1@example.com |
|
||||
| user2 | User | 2 | user2@example.com |
|
||||
| user3 | User | 3 | user3@example.com |
|
||||
|
||||
Scenario: Search for single user
|
||||
When I log in as "user1"
|
||||
And I follow "Messages" in the user menu
|
||||
And I click on "contacts-view" "message_area_action"
|
||||
And I set the field "Search for a user or course" to "User 2"
|
||||
Then I should see "User 2" in the "search-results-area" "message_area_region"
|
||||
And I should not see "User 3" in the "search-results-area" "message_area_region"
|
||||
|
||||
Scenario: Search for multiple user
|
||||
When I log in as "user1"
|
||||
And I follow "Messages" in the user menu
|
||||
And I click on "contacts-view" "message_area_action"
|
||||
And I set the field "Search for a user or course" to "User"
|
||||
Then I should see "User 2" in the "search-results-area" "message_area_region"
|
||||
And I should see "User 3" in the "search-results-area" "message_area_region"
|
||||
And I should not see "User 1" in the "search-results-area" "message_area_region"
|
||||
|
||||
Scenario: Search for messages no results
|
||||
When I log in as "user1"
|
||||
And I follow "Messages" in the user menu
|
||||
And I click on "contacts-view" "message_area_action"
|
||||
And I set the field "Search for a user or course" to "No User"
|
||||
Then I should see "No results" in the "search-results-area" "message_area_region"
|
23
message/tests/behat/view_messages.feature
Normal file
23
message/tests/behat/view_messages.feature
Normal file
@ -0,0 +1,23 @@
|
||||
@core @message @javascript
|
||||
Feature: View messages
|
||||
In order to communicate with fellow users
|
||||
As a user
|
||||
I need to be able to view my messages
|
||||
|
||||
Scenario: View messages from multiple users
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| user1 | User | 1 | user1@example.com |
|
||||
| user2 | User | 2 | user2@example.com |
|
||||
| user3 | User | 3 | user3@example.com |
|
||||
And I log in as "user2"
|
||||
And I send "User 2 to User 1" message to "User 1" user
|
||||
And I log out
|
||||
And I log in as "user3"
|
||||
And I send "User 3 to User 1" message to "User 1" user
|
||||
And I log out
|
||||
And I log in as "user1"
|
||||
When I follow "Messages" in the user menu
|
||||
Then I should see "User 3 to User 1" in the "conversations" "message_area_region_content"
|
||||
And I click on "User 2" "text" in the "conversations" "message_area_region_content"
|
||||
And I should see "User 2 to User 1" in the "conversations" "message_area_region_content"
|
@ -83,7 +83,7 @@ Feature: Access to full profiles of users
|
||||
And I press "Add"
|
||||
And I log out
|
||||
When I log in as "student1"
|
||||
And I view the message profile for "Student 3" user
|
||||
And I view the "Student 3" contact in messages
|
||||
And I follow "View profile"
|
||||
Then I should see "First access to site"
|
||||
|
||||
@ -99,7 +99,7 @@ Feature: Access to full profiles of users
|
||||
And I press "Save and display"
|
||||
And I log out
|
||||
When I log in as "student1"
|
||||
And I view the message profile for "Student 2" user
|
||||
And I view the "Student 2" contact in messages
|
||||
And I follow "View profile"
|
||||
And I should not see "First access to site"
|
||||
And I should see "The details of this user are not available to you"
|
||||
@ -117,6 +117,6 @@ Feature: Access to full profiles of users
|
||||
And I add "Student 2 (student2@example.com)" user to "Group 1" group members
|
||||
And I log out
|
||||
And I log in as "student1"
|
||||
And I view the message profile for "Student 2" user
|
||||
And I view the "Student 2" contact in messages
|
||||
And I follow "View profile"
|
||||
Then I should see "First access to site"
|
||||
|
Loading…
x
Reference in New Issue
Block a user