Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/spreed.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDaniel Calviño Sánchez <danxuliu@gmail.com>2019-07-26 13:29:23 +0300
committerJoas Schilling <coding@schilljs.com>2019-07-30 10:33:42 +0300
commit1005aaab4932c4f32f85d7ad9bca6e30cba80293 (patch)
tree47433fd7c0699ce07aed1facdbced7bb90602d49 /tests
parentb14e63db1846a8c0a8b917850e02422681c73d9c (diff)
Add integration test for replies to shared file messages
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/integration/features/bootstrap/FeatureContext.php12
-rw-r--r--tests/integration/features/chat/reply.feature28
2 files changed, 40 insertions, 0 deletions
diff --git a/tests/integration/features/bootstrap/FeatureContext.php b/tests/integration/features/bootstrap/FeatureContext.php
index 1b39994ff..ec4a08f97 100644
--- a/tests/integration/features/bootstrap/FeatureContext.php
+++ b/tests/integration/features/bootstrap/FeatureContext.php
@@ -639,6 +639,13 @@ class FeatureContext implements Context, SnippetAcceptingContext {
}
}, $actual);
+ foreach ($messages as $message) {
+ // Include the received messages in the list of messages used for
+ // replies; this is needed to get special messages not explicitly
+ // sent like those for shared files.
+ self::$messages[$message['message']] = $message['id'];
+ }
+
if ($formData === null) {
PHPUnit_Framework_Assert::assertEmpty($messages);
return;
@@ -646,6 +653,11 @@ class FeatureContext implements Context, SnippetAcceptingContext {
$includeParents = in_array('parentMessage', $formData->getRow(0), true);
PHPUnit_Framework_Assert::assertCount(count($formData->getHash()), $messages, 'Message count does not match');
+ for ($i = 0; $i < count($formData->getHash()); $i++) {
+ if ($formData->getHash()[$i]['messageParameters'] === '"IGNORE"') {
+ $messages[$i]['messageParameters'] = 'IGNORE';
+ }
+ }
PHPUnit_Framework_Assert::assertEquals($formData->getHash(), array_map(function($message) use($includeParents) {
$data = [
'room' => self::$tokenToIdentifier[$message['token']],
diff --git a/tests/integration/features/chat/reply.feature b/tests/integration/features/chat/reply.feature
index f5efe0f98..4a8c9a56e 100644
--- a/tests/integration/features/chat/reply.feature
+++ b/tests/integration/features/chat/reply.feature
@@ -62,6 +62,34 @@ Feature: chat/reply
+ Scenario: user can reply to shared file messages
+ Given user "participant1" creates room "group room"
+ | roomType | 2 |
+ | invite | attendees1 |
+ And user "participant1" shares "welcome.txt" with room "group room"
+ # The messages need to be got so the file message is added to the list of
+ # known messages to reply to.
+ # The file message parameters are not relevant for this test and are quite
+ # large, so they are simply ignored.
+ And user "participant1" sees the following messages in room "group room" with 200
+ | room | actorType | actorId | actorDisplayName | message | messageParameters | parentMessage |
+ | group room | users | participant1 | participant1-displayname | {file} | "IGNORE" | |
+ And user "participant2" sees the following messages in room "group room" with 200
+ | room | actorType | actorId | actorDisplayName | message | messageParameters | parentMessage |
+ | group room | users | participant1 | participant1-displayname | {file} | "IGNORE" | |
+ When user "participant1" sends reply "Message X-1" on message "{file}" to room "group room" with 201
+ And user "participant2" sends reply "Message X-2" on message "{file}" to room "group room" with 201
+ Then user "participant1" sees the following messages in room "group room" with 200
+ | room | actorType | actorId | actorDisplayName | message | messageParameters | parentMessage |
+ | group room | users | participant2 | participant2-displayname | Message X-2 | [] | {file} |
+ | group room | users | participant1 | participant1-displayname | Message X-1 | [] | {file} |
+ | group room | users | participant1 | participant1-displayname | {file} | "IGNORE" | |
+ And user "participant2" sees the following messages in room "group room" with 200
+ | room | actorType | actorId | actorDisplayName | message | messageParameters | parentMessage |
+ | group room | users | participant2 | participant2-displayname | Message X-2 | [] | {file} |
+ | group room | users | participant1 | participant1-displayname | Message X-1 | [] | {file} |
+ | group room | users | participant1 | participant1-displayname | {file} | "IGNORE" | |
+
Scenario: user can not reply to commands
Given user "participant1" creates room "group room"
| roomType | 2 |