diff options
Diffstat (limited to 'tests/integration')
-rw-r--r-- | tests/integration/features/bootstrap/FeatureContext.php | 21 | ||||
-rw-r--r-- | tests/integration/features/chat-1/edit-message.feature | 5 |
2 files changed, 23 insertions, 3 deletions
diff --git a/tests/integration/features/bootstrap/FeatureContext.php b/tests/integration/features/bootstrap/FeatureContext.php index c90a9711b..8d1a25907 100644 --- a/tests/integration/features/bootstrap/FeatureContext.php +++ b/tests/integration/features/bootstrap/FeatureContext.php @@ -2004,7 +2004,7 @@ class FeatureContext implements Context, SnippetAcceptingContext { * @param string $statusCode * @param string $apiVersion */ - public function userEditsMessageToRoom(string $user, string $oldMessage, string $identifier, string $newMessage, string $statusCode, string $apiVersion = 'v1') { + public function userEditsMessageToRoom(string $user, string $oldMessage, string $identifier, string $newMessage, int $statusCode, string $apiVersion = 'v1', ?TableNode $formData = null) { $oldMessage = substr($oldMessage, 1, -1); $oldMessage = str_replace('\n', "\n", $oldMessage); $messageId = self::$textToMessageId[$oldMessage]; @@ -2020,8 +2020,15 @@ class FeatureContext implements Context, SnippetAcceptingContext { $this->assertStatusCode($this->response, $statusCode); sleep(1); // make sure Postgres manages the order of the messages - self::$textToMessageId[$newMessage] = $messageId; - self::$messageIdToText[$messageId] = $newMessage; + if ($statusCode === 200 || $statusCode === 202) { + self::$textToMessageId[$newMessage] = $messageId; + self::$messageIdToText[$messageId] = $newMessage; + } elseif ($formData instanceof TableNode) { + Assert::assertEquals( + $formData->getRowsHash(), + $this->getDataFromResponse($this->response), + ); + } } /** @@ -3877,6 +3884,14 @@ class FeatureContext implements Context, SnippetAcceptingContext { } /** + * @Given /^aging messages (\d+) hours in room "([^"]*)"$/ + */ + public function occAgeChatMessages(int $hours, string $identifier): void { + $this->runOcc(['talk:developer:age-chat-messages', '--hours', $hours, self::$identifierToToken[$identifier]]); + $this->theCommandWasSuccessful(); + } + + /** * @Given /^the following recording consent is recorded for (room|user) "([^"]*)"$/ */ public function occRecordingConsentLists(string $filterType, string $identifier, TableNode $tableNode): void { diff --git a/tests/integration/features/chat-1/edit-message.feature b/tests/integration/features/chat-1/edit-message.feature index 8d54e8a05..c6a1a7955 100644 --- a/tests/integration/features/chat-1/edit-message.feature +++ b/tests/integration/features/chat-1/edit-message.feature @@ -58,6 +58,11 @@ Feature: chat-1/edit-message Then user "participant1" sees the following messages in room "room" with 200 | room | actorType | actorId | actorDisplayName | message | messageParameters | parentMessage | lastEditActorType | lastEditActorId | lastEditActorDisplayName | | room | deleted_users | deleted_users | | Message 1 - Edit 2 | [] | | deleted_users | deleted_users | | + When aging messages 6 hours in room "room" + And user "participant1" edits message "Message 1 - Edit 1" in room "room" to "Message 1 - Edit 2" with 200 + When aging messages 24 hours in room "room" + And user "participant1" edits message "Message 1 - Edit 2" in room "room" to "Message 1 - Edit Too old" with 400 + | error | age | Scenario: Editing a caption Given user "participant1" creates room "room" (v4) |