Skip to content

Commit

Permalink
MDL-64993 core_message: Adding self-conversations to behat tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Amaia Anabitarte committed May 5, 2019
1 parent 888a467 commit 86463d5
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 16 deletions.
22 changes: 12 additions & 10 deletions message/tests/behat/favourite_conversations.feature
Original file line number Diff line number Diff line change
Expand Up @@ -29,34 +29,36 @@ Feature: Star and unstar conversations
Scenario: Star a group conversation
Given I log in as "student1"
Then I open messaging
And I open the "Group" conversations list
And "Group 1" "group_message" should exist
And I select "Group 1" conversation in messaging
And I open contact menu
And I click on "Star" "link" in the "//div[@data-region='header-container']" "xpath_element"
And I go back in "view-conversation" message drawer
And I open the "Starred" conversations list
And I should see "Group 1" in the "//div[@data-region='view-overview-favourites']" "xpath_element"
And I should see "Group 1" in the "favourites" "group_message_list_area"
And I open the "Group" conversations list
And I should not see "Group 1" in the "//div[@data-region='view-overview-group-messages']" "xpath_element"
And I should not see "Group 1" in the "group-messages" "group_message_list_area"

Scenario: Unstar a group conversation
Given I log in as "student1"
Then I open messaging
And I open the "Group" conversations list
And "Group 1" "group_message" should exist
And I select "Group 1" conversation in messaging
And I open contact menu
And I click on "Star" "link" in the "//div[@data-region='header-container']" "xpath_element"
And I go back in "view-conversation" message drawer
And I open the "Starred" conversations list
And I should see "Group 1" in the "//div[@data-region='view-overview-favourites']" "xpath_element"
And I should see "Group 1" in the "favourites" "group_message_list_area"
And I select "Group 1" conversation in messaging
And I open contact menu
And I click on "Unstar" "link" in the "//div[@data-region='header-container']" "xpath_element"
And I go back in "view-conversation" message drawer
And I open the "Starred" conversations list
And I should not see "Group 1" in the "//div[@data-region='view-overview-favourites']" "xpath_element"
And I should not see "Group 1" in the "favourites" "group_message_list_area"
And I open the "Group" conversations list
And I should see "Group 1" in the "//div[@data-region='view-overview-group-messages']" "xpath_element"
And I should see "Group 1" in the "group-messages" "group_message_list_area"

Scenario: Star a private conversation
Given the following "private messages" exist:
Expand All @@ -71,9 +73,9 @@ Feature: Star and unstar conversations
And I click on "Star" "link" in the "//div[@data-region='header-container']" "xpath_element"
And I go back in "view-conversation" message drawer
And I open the "Starred" conversations list
And I should see "Student 2" in the "//div[@data-region='view-overview-favourites']" "xpath_element"
And I should see "Student 2" in the "favourites" "group_message_list_area"
And I open the "Private" conversations list
And I should not see "Student 2" in the "//div[@data-region='view-overview-messages']" "xpath_element"
And I should not see "Student 2" in the "messages" "group_message_list_area"

Scenario: Unstar a private conversation
Given the following "private messages" exist:
Expand All @@ -84,12 +86,12 @@ Feature: Star and unstar conversations
| student1 | student2 |
Then I log in as "student1"
And I open messaging
And I should see "Student 2" in the "//div[@data-region='view-overview-favourites']" "xpath_element"
And I should see "Student 2" in the "favourites" "group_message_list_area"
And I select "Student 2" conversation in messaging
And I open contact menu
And I click on "Unstar" "link" in the "//div[@data-region='header-container']" "xpath_element"
And I go back in "view-conversation" message drawer
And I open the "Starred" conversations list
And I should not see "Group 1" in the "//div[@data-region='view-overview-favourites']" "xpath_element"
And I should not see "Group 1" in the "favourites" "group_message_list_area"
And I open the "Private" conversations list
And I should see "Student 2" in the "//div[@data-region='view-overview-messages']" "xpath_element"
And I should see "Student 2" in the "messages" "group_message_list_area"
13 changes: 9 additions & 4 deletions message/tests/behat/group_conversation.feature
Original file line number Diff line number Diff line change
Expand Up @@ -43,28 +43,32 @@ Feature: Create conversations for course's groups
Scenario: Group conversations are restricted to members
Given I log in as "teacher1"
Then I open messaging
And I open the "Group" conversations list
And "Group 1" "group_message" should exist
And "Group 2" "group_message" should exist
And "Group 3" "group_message" should not exist
And I log out
And I log in as "student1"
And I open messaging
And I open the "Group" conversations list
And "Group 1" "group_message" should exist
And "Group 2" "group_message" should not exist
And "Group 3" "group_message" should not exist

Scenario: View group conversation's participants numbers
Given I log in as "teacher1"
Then I open messaging
And I open the "Group" conversations list
And I select "Group 1" conversation in messaging
And "5 participants" "group_message_header" should exist
And I should see "5 participants" in the "Group 1" "group_message_header"
And I go back in "view-conversation" message drawer
And I select "Group 2" conversation in messaging
And "1 participants" "group_message_header" should exist
And I should see "1 participants" in the "Group 2" "group_message_header"

Scenario: View group conversation's participants list
Given I log in as "teacher1"
Then I open messaging
And I open the "Group" conversations list
# Check Group 1 participants list.
And I select "Group 1" conversation in messaging
And I open messaging information
Expand All @@ -90,14 +94,15 @@ Feature: Create conversations for course's groups
And I add "Student 4 ([email protected])" user to "Group 1" group members
And I add "Student 4 ([email protected])" user to "Group 2" group members
And I open messaging
And I open the "Group" conversations list
And I select "Group 1" conversation in messaging
And "6 participants" "group_message_header" should exist
And I should see "6 participants" in the "Group 1" "group_message_header"
And I open messaging information
And "Student 4" "group_message_member" should exist
And I go back in "group-info-content-container" message drawer
And I go back in "view-conversation" message drawer
And I select "Group 2" conversation in messaging
And "2 participants" "group_message_header" should exist
And I should see "2 participants" in the "Group 2" "group_message_header"
And I open messaging information
And "No participants" "group_message_member" should not exist
And "Student 4" "group_message_member" should exist
4 changes: 2 additions & 2 deletions message/tests/behat/message_delete_conversation.feature
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ Feature: Message delete conversations
And I should not see "Delete"
And I should not see "Hi!" in the "Student 2" "group_message_conversation"
And I go back in "view-conversation" message drawer
And I should not see "Student 2" in the "//*[@data-region='message-drawer']//div[@data-region='view-overview-favourites']" "xpath_element"
And I should not see "Student 2" in the "favourites" "group_message_list_area"
And I send "Hi!" message to "Student 2" user
And I go back in "view-conversation" message drawer
And I go back in "view-search" message drawer
And I should see "Student 2" in the "//*[@data-region='message-drawer']//div[@data-region='view-overview-favourites']" "xpath_element"
And I should see "Student 2" in the "favourites" "group_message_list_area"
2 changes: 2 additions & 0 deletions message/tests/behat/message_send_messages.feature
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Feature: Message send messages
Scenario: Send a message to a group conversation
Given I log in as "student1"
And I open messaging
And I open the "Group" conversations list
And "Group 1" "group_message" should exist
And I select "Group 1" conversation in messaging
When I send "Hi!" message in the message area
Expand All @@ -44,6 +45,7 @@ Feature: Message send messages
Scenario: Send a message to a starred conversation
Given I log in as "student1"
When I open messaging
And I open the "Group" conversations list
Then "Group 1" "group_message" should exist
And I select "Group 1" conversation in the "group-messages" conversations list
And I open contact menu
Expand Down
1 change: 1 addition & 0 deletions message/tests/behat/unread_messages.feature
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Feature: Unread messages
Scenario: Unread messages for group conversation
Given I log in as "student1"
When I open messaging
And I open the "Group" conversations list
Then "New group" "group_message" should exist
And I select "New group" conversation in messaging
And I send "Hi!" message in the message area
Expand Down

0 comments on commit 86463d5

Please sign in to comment.