Skip to content

Commit

Permalink
MDL-49412 messages: Fix behat failures
Browse files Browse the repository at this point in the history
  • Loading branch information
ankitagarwal authored and abgreeve committed Apr 10, 2015
1 parent feaa97a commit 2547fea
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 20 deletions.
7 changes: 5 additions & 2 deletions message/tests/behat/behat_message.php
Expand Up @@ -51,8 +51,11 @@ public function i_send_message_to_user($messagecontent, $userfullname) {

$steps = array();
$steps[] = new Given('I am on homepage');

$steps[] = new Given('I navigate to "' . get_string('messages', 'message') . '" node in "' . get_string('myprofile') . '"');
if ($this->running_javascript()) {
$steps[] = new Given('I follow "' . get_string('messages', 'message') . '" in the user menu');
} else {
$steps[] = new Given('I follow "' . get_string('messages', 'message') . '"');
}
$steps[] = new Given('I set the field "' . get_string('searchcombined', 'message') .
'" to "' . $this->escape($userfullname) . '"');
$steps[] = new Given('I press "' . get_string('searchcombined', 'message') . '"');
Expand Down
4 changes: 2 additions & 2 deletions message/tests/behat/block_users.feature
Expand Up @@ -11,7 +11,7 @@ Feature: Block users from contacting me
| user1 | User | One | one@asd.com |
| user2 | User | Two | two@asd.com |
And I log in as "user1"
And I navigate to "Messages" node in "My profile"
And I follow "Messages" in the user menu
And I set the field "Search people and messages" to "User Two"
And I press "Search people and messages"
When I click on "Block contact" "link" in the "User Two" "table_row"
Expand All @@ -20,7 +20,7 @@ Feature: Block users from contacting me
And I should see "User Two"
And I log out
And I log in as "user2"
And I navigate to "Messages" node in "My profile"
And I follow "Messages" in the user menu
And I set the field "Search people and messages" to "User One"
And I press "Search people and messages"
And I follow "Send message to User One"
Expand Down
6 changes: 3 additions & 3 deletions message/tests/behat/display_history.feature
@@ -1,4 +1,4 @@
@core @core_message
@core @core_message @javascript
Feature: Message history displays correctly
In order to read messages between two users
As a user
Expand All @@ -22,7 +22,7 @@ Feature: Message history displays correctly
And I send "Message 10 from user1 to user2" message to "User Two" user

Scenario: View sent messages
When I navigate to "Messages" node in "My profile"
When I follow "Messages" in the user menu
And I set the field "Search people and messages" to "User Two"
And I press "Search people and messages"
And I click on "Message history" "link" in the "User Two" "table_row"
Expand All @@ -37,7 +37,7 @@ Feature: Message history displays correctly
Scenario: View received messages
When I log out
And I log in as "user2"
And I navigate to "Messages" node in "My profile"
And I follow "Messages" in the user menu
And I follow "User One (10)"
# Should show all of the user's unread messages.
Then I should see "Message 1 from user1 to user2"
Expand Down
6 changes: 3 additions & 3 deletions message/tests/behat/manage_contacts.feature
@@ -1,4 +1,4 @@
@core @core_message
@core @core_message @javascrript
Feature: Manage contacts
In order to easily access the users I interact more with
As a user
Expand All @@ -12,7 +12,7 @@ Feature: Manage contacts
And I log in as "user1"
And I send "Message 1 from user1 to user2" message to "User Two" user
And I send "Message 2 from user1 to user2" message to "User Two" user
And I navigate to "Messages" node in "My profile"
And I follow "Messages" in the user menu
And I set the field "Search people and messages" to "User Two"
And I press "Search people and messages"
When I click on "Add contact" "link" in the "User Two" "table_row"
Expand All @@ -29,4 +29,4 @@ Feature: Manage contacts
@javascript
Scenario: Adding and removing contacts with Javascript enabled

Scenario: Adding and removing contacts with Javascript disabled
# Scenario: Adding and removing contacts with Javascript disabled
3 changes: 1 addition & 2 deletions message/tests/behat/message_participants.feature
Expand Up @@ -29,8 +29,7 @@ Feature: An user can message course participants
| messagebody | Here it is, the message content |
And I press "Preview"
And I press "Send message"
And I follow "Home"
And I navigate to "Messages" node in "My profile"
And I follow "Messages" in the user menu
And I set the field "Message navigation:" to "Recent conversations"
Then I should see "Here it is, the message content"
And I should see "Student 1"
Expand Down
4 changes: 2 additions & 2 deletions message/tests/behat/search_history.feature
@@ -1,4 +1,4 @@
@core @core_message
@core @core_message @javascript
Feature: Users can search their message history
In order to read old messages
As a user
Expand All @@ -11,7 +11,7 @@ Feature: Users can search their message history
| user2 | User | Two | two@asd.com |
And I log in as "user1"
When I send "Give me your biscuits" message to "User Two" user
And I navigate to "Messages" node in "My profile"
And I follow "Messages" in the user menu
And I set the field "Search people and messages" to "your biscuits"
And I press "Search people and messages"
Then I should see "User Two"
Expand Down
11 changes: 5 additions & 6 deletions message/tests/behat/send_message.feature
Expand Up @@ -15,15 +15,15 @@ Feature: Users can send messages to each other
Given the following config values are set as admin:
| forceloginforprofiles | 0 |
And I log in as "user1"
And I navigate to "Messages" node in "My profile"
And I follow "Messages" in the user menu
And I set the field "Search people and messages" to "User Two"
And I press "Search people and messages"
And I follow "Picture of User Two"
When I follow "Send a message"
When I press "Message"
And I set the field "Message to send" to "Lorem ipsum sa messagus textus"
And I press "Send message"
And I am on homepage
And I navigate to "Messages" node in "My profile"
And I follow "Messages" in the user menu
And I set the field "Search people and messages" to "User Two"
And I press "Search people and messages"
And I follow "Send message to User Two"
Expand All @@ -42,11 +42,10 @@ Feature: Users can send messages to each other
And I follow "Course 1"
And I follow "Participants"
And I follow "User Two"
When I follow "Send a message"
When I press "Message"
And I set the field "Message to send" to "Lorem ipsum sa messagus textus"
And I press "Send message"
And I am on homepage
And I navigate to "Messages" node in "My profile"
And I follow "Messages" in the user menu
And I set the field "Search people and messages" to "User Two"
And I press "Search people and messages"
And I follow "Send message to User Two"
Expand Down

0 comments on commit 2547fea

Please sign in to comment.