summaryrefslogtreecommitdiffstats
path: root/tests/acceptance
diff options
context:
space:
mode:
authorDaniel Calviño Sánchez <danxuliu@gmail.com>2019-07-23 19:40:12 +0200
committerDaniel Calviño Sánchez <danxuliu@gmail.com>2019-08-28 00:49:55 +0200
commit8ab3c4d511bab18378f5cab998c6bbb8dee63f4d (patch)
tree483cb201eb5bb042b21a7fde9f37a6b8d56b5741 /tests/acceptance
parent27b8a1cf75eb1aa0e2d0c5217ba22319630fdfd7 (diff)
Add acceptance tests for mentions of all users of a public room
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Diffstat (limited to 'tests/acceptance')
-rw-r--r--tests/acceptance/features/bootstrap/ChatContext.php16
-rw-r--r--tests/acceptance/features/chat.feature21
2 files changed, 37 insertions, 0 deletions
diff --git a/tests/acceptance/features/bootstrap/ChatContext.php b/tests/acceptance/features/bootstrap/ChatContext.php
index 19b331204..9ad59d0ce 100644
--- a/tests/acceptance/features/bootstrap/ChatContext.php
+++ b/tests/acceptance/features/bootstrap/ChatContext.php
@@ -177,6 +177,15 @@ class ChatContext implements Context, ActorAwareInterface {
/**
* @return Locator
*/
+ public static function formattedMentionInChatMessageOfAllParticipantsOf($chatAncestor, $number, $roomName) {
+ return Locator::forThe()->xpath("span/span[contains(concat(' ', normalize-space(@class), ' '), ' mention-call ') and contains(concat(' ', normalize-space(@class), ' '), ' currentUser ') and normalize-space() = '$roomName']")->
+ descendantOf(self::textOfChatMessage($chatAncestor, $number))->
+ describedAs("Formatted mention of all participants of $roomName in chat message $number in the list of received messages");
+ }
+
+ /**
+ * @return Locator
+ */
public static function formattedLinkInChatMessageTo($chatAncestor, $number, $url) {
return Locator::forThe()->xpath("a[normalize-space(@href) = '$url']")->
descendantOf(self::textOfChatMessage($chatAncestor, $number))->
@@ -406,6 +415,13 @@ class ChatContext implements Context, ActorAwareInterface {
}
/**
+ * @Then I see that the message :number contains a formatted mention of all participants of :roomName
+ */
+ public function iSeeThatTheMessageContainsAFormattedMentionOfAllParticipantsOf($number, $roomName) {
+ PHPUnit_Framework_Assert::assertNotNull($this->actor->find(self::formattedMentionInChatMessageOfAllParticipantsOf($this->chatAncestor, $number, $roomName), 10));
+ }
+
+ /**
* @Then I see that the message :number contains a formatted link to :user
*/
public function iSeeThatTheMessageContainsAFormattedLinkTo($number, $url) {
diff --git a/tests/acceptance/features/chat.feature b/tests/acceptance/features/chat.feature
index 6f4500bd1..9ff0fa358 100644
--- a/tests/acceptance/features/chat.feature
+++ b/tests/acceptance/features/chat.feature
@@ -192,6 +192,27 @@ Feature: chat
And I see that the message 1 was sent by "user0" with the text "Hello RRob"
And I see that the message 1 contains a formatted mention of "Rob" as current user
+ Scenario: mention all users in a public room from the candidate mentions
+ Given I act as John
+ And I am logged in
+ And I have opened the Talk app
+ And I create a public conversation named "Public"
+ And I see that the chat is shown in the main view
+ And I write down the public conversation link
+ And I act as Jane
+ And I visit the public conversation link I wrote down
+ And I see that the current page is the public conversation link I wrote down
+ And I see that the chat is shown in the main view
+ When I act as John
+ And I type a new chat message with the text "Hello @"
+ And I choose the candidate mention for "Public"
+ And I send the current chat message
+ Then I see that the message 1 was sent by "user0" with the text "Hello Public"
+ And I see that the message 1 contains a formatted mention of all participants of "Public"
+ And I act as Jane
+ And I see that the message 1 was sent by "user0" with the text "Hello Public"
+ And I see that the message 1 contains a formatted mention of all participants of "Public"
+
Scenario: mention another user and a URL
Given I am logged in
And I have opened the Talk app