diff --git a/tests/integration/features/bootstrap/FeatureContext.php b/tests/integration/features/bootstrap/FeatureContext.php index 800e993b830..b0ce34b4f75 100644 --- a/tests/integration/features/bootstrap/FeatureContext.php +++ b/tests/integration/features/bootstrap/FeatureContext.php @@ -3734,10 +3734,14 @@ private function assertReactionList(?TableNode $formData): void { $expected[$reaction][] = $row; } - $actual = array_map(static function ($reaction, $list) use ($expected): array { + $actual = array_map(function ($reaction, $list) use ($expected): array { $list = array_map(function ($reaction) { unset($reaction['timestamp']); $reaction['actorId'] = ($reaction['actorType'] === 'guests') ? self::$sessionIdToUser[$reaction['actorId']] : (string) $reaction['actorId']; + if ($reaction['actorType'] === 'federated_users') { + $reaction['actorId'] = str_replace(rtrim($this->baseUrl, '/'), '{$BASE_URL}', $reaction['actorId']); + $reaction['actorId'] = str_replace(rtrim($this->baseRemoteUrl, '/'), '{$REMOTE_URL}', $reaction['actorId']); + } return $reaction; }, $list); Assert::assertArrayHasKey($reaction, $expected, 'Not expected reaction: ' . $reaction); diff --git a/tests/integration/features/federation/chat.feature b/tests/integration/features/federation/chat.feature index c56f18ff243..6636b0ea863 100644 --- a/tests/integration/features/federation/chat.feature +++ b/tests/integration/features/federation/chat.feature @@ -179,3 +179,35 @@ Feature: federation/chat | spreed | chat | room/Hi @all bye | participant1-displayname mentioned everyone in conversation room | Hi room bye | | spreed | chat | room/Hi @"federated_user/participant2@{$REMOTE_URL}" bye | participant1-displayname mentioned you in conversation room | Hi @participant2-displayname bye | | spreed | chat | room/Message 1-1 | participant1-displayname replied to your message in conversation room | Message 1-1 | + + Scenario: Reaction on federated chat messages + Given the following "spreed" app config is set + | federation_enabled | yes | + Given user "participant1" creates room "room" (v4) + | roomType | 2 | + | roomName | room | + And user "participant1" adds federated_user "participant2" to room "room" with 200 (v4) + And user "participant2" has the following invitations (v1) + | remoteServerUrl | remoteToken | state | inviterCloudId | inviterDisplayName | + | LOCAL | room | 0 | participant1@http://localhost:8080 | participant1-displayname | + And user "participant2" accepts invite to room "room" of server "LOCAL" with 200 (v1) + | id | name | type | remoteServer | remoteToken | + | room | room | 2 | LOCAL | room | + Then user "participant2" is participant of the following rooms (v4) + | id | type | + | room | 2 | + # Join and leave to clear the invite notification + Given user "participant2" joins room "LOCAL::room" with 200 (v4) + Given user "participant2" leaves room "LOCAL::room" with 200 (v4) + And user "participant2" sends message "Message 1" to room "LOCAL::room" with 201 + And user "participant1" react with "🚀" on message "Message 1" to room "room" with 201 + | actorType | actorId | actorDisplayName | reaction | + | users | participant1 | participant1-displayname | 🚀 | + And user "participant2" react with "🚀" on message "Message 1" to room "LOCAL::room" with 201 + | actorType | actorId | actorDisplayName | reaction | + | federated_users | participant1@{$BASE_URL} | participant1-displayname | 🚀 | + | users | participant2 | participant2-displayname | 🚀 | + And user "participant1" retrieve reactions "all" of message "Message 1" in room "room" with 200 + | actorType | actorId | actorDisplayName | reaction | + | users | participant1 | participant1-displayname | 🚀 | + | federated_users | participant2@{$REMOTE_URL} | participant2-displayname | 🚀 |