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:
authorJoas Schilling <coding@schilljs.com>2020-05-15 10:15:54 +0300
committerJoas Schilling <coding@schilljs.com>2020-05-15 10:31:07 +0300
commitf8538f487b11af84bce33cb4b26b5c0efa80376a (patch)
tree07ec4ff58f209b909a4e02ebb6df5a1ddafb2ff3 /tests
parenteb9736a29fffdc3a546e7a843b8fd13ac9fa9eb0 (diff)
Correctly pick the parent if it is index 0 of the messages
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/integration/features/bootstrap/FeatureContext.php24
-rw-r--r--tests/integration/features/chat/reply.feature17
2 files changed, 41 insertions, 0 deletions
diff --git a/tests/integration/features/bootstrap/FeatureContext.php b/tests/integration/features/bootstrap/FeatureContext.php
index db78038ff..891f30d8e 100644
--- a/tests/integration/features/bootstrap/FeatureContext.php
+++ b/tests/integration/features/bootstrap/FeatureContext.php
@@ -774,6 +774,30 @@ class FeatureContext implements Context, SnippetAcceptingContext {
$this->sendRequest('GET', '/apps/spreed/api/v1/chat/' . self::$identifierToToken[$identifier] . '?lookIntoFuture=0');
$this->assertStatusCode($this->response, $statusCode);
+ $this->compareDataResponse($formData);
+ }
+
+ /**
+ * @Then /^user "([^"]*)" sees the following messages in room "([^"]*)" starting with "([^"]*)" with (\d+)$/
+ *
+ * @param string $user
+ * @param string $identifier
+ * @param string $knwonMessage
+ * @param string $statusCode
+ * @param TableNode|null $formData
+ */
+ public function userAwaitsTheFollowingMessagesInRoom($user, $identifier, $knwonMessage, $statusCode, TableNode $formData = null) {
+ $this->setCurrentUser($user);
+ $this->sendRequest('GET', '/apps/spreed/api/v1/chat/' . self::$identifierToToken[$identifier] . '?lookIntoFuture=1&includeLastKnown=1&lastKnownMessageId=' . self::$messages[$knwonMessage]);
+ $this->assertStatusCode($this->response, $statusCode);
+
+ $this->compareDataResponse($formData);
+ }
+
+ /**
+ * @param TableNode|null $formData
+ */
+ protected function compareDataResponse(TableNode $formData = null) {
$actual = $this->getDataFromResponse($this->response);
$messages = [];
array_map(function (array $message) use (&$messages) {
diff --git a/tests/integration/features/chat/reply.feature b/tests/integration/features/chat/reply.feature
index 4a8c9a56e..f2a2fcaf1 100644
--- a/tests/integration/features/chat/reply.feature
+++ b/tests/integration/features/chat/reply.feature
@@ -185,6 +185,23 @@ Feature: chat/reply
| group room | users | participant2 | participant2-displayname | Message 1-1 | [] | Message 1 |
| group room | users | participant1 | participant1-displayname | Message 1 | [] | |
+ Scenario: getting parent and quote works
+ Given user "participant1" creates room "group room"
+ | roomType | 2 |
+ | invite | attendees1 |
+ And user "participant1" sends message "Message 1" to room "group room" with 201
+ And user "participant1" sends message "Message 2" to room "group room" with 201
+ And user "participant2" sends reply "Message 2-1" on message "Message 2" to room "group room" with 201
+ Then user "participant1" sees the following messages in room "group room" starting with "Message 1" with 200
+ | room | actorType | actorId | actorDisplayName | message | messageParameters | parentMessage |
+ | group room | users | participant1 | participant1-displayname | Message 1 | [] | |
+ | group room | users | participant1 | participant1-displayname | Message 2 | [] | |
+ | group room | users | participant2 | participant2-displayname | Message 2-1 | [] | Message 2 |
+ Then user "participant1" sees the following messages in room "group room" starting with "Message 2" with 200
+ | room | actorType | actorId | actorDisplayName | message | messageParameters | parentMessage |
+ | group room | users | participant1 | participant1-displayname | Message 2 | [] | |
+ | group room | users | participant2 | participant2-displayname | Message 2-1 | [] | Message 2 |
+
Scenario: user can not reply when not in the room