summaryrefslogtreecommitdiffstats
path: root/tests/integration
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2024-02-14 12:44:27 +0100
committerJoas Schilling <coding@schilljs.com>2024-02-23 14:33:00 +0100
commit74e75417be28f0329ce98667ce4d84bd03e6441c (patch)
tree381bcdaee20bcc6fa3b7a23981c0250d955b910b /tests/integration
parent848fecf97d0e218c42fa6b31e93d140ab8ad7caa (diff)
feat(federation): Add TalkV1 federation proxy for mentions
Decision is to proxy the requests on the own server, so we can proxy other services (matrix coming to mind) in the future and the clients still have to only talk to their own server, to help with CSP and to reduce the efforts Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'tests/integration')
-rw-r--r--tests/integration/features/bootstrap/FeatureContext.php10
-rw-r--r--tests/integration/features/federation/chat.feature33
2 files changed, 43 insertions, 0 deletions
diff --git a/tests/integration/features/bootstrap/FeatureContext.php b/tests/integration/features/bootstrap/FeatureContext.php
index 6b6d5bcb0..c7fe82313 100644
--- a/tests/integration/features/bootstrap/FeatureContext.php
+++ b/tests/integration/features/bootstrap/FeatureContext.php
@@ -540,6 +540,10 @@ class FeatureContext implements Context, SnippetAcceptingContext {
if ($formData) {
if ($status === 200) {
+ if (!isset(self::$tokenToIdentifier[$response['token']])) {
+ self::$identifierToToken[$server . '::' . $roomName] = $response['token'];
+ }
+
$this->assertRooms([$response], $formData);
} else {
Assert::assertSame($formData->getRowsHash(), $response);
@@ -2845,6 +2849,12 @@ class FeatureContext implements Context, SnippetAcceptingContext {
Assert::assertRegExp('/^guest\/[0-9a-f]{40}$/', $mentions[$key]['id']);
$mentions[$key]['id'] = 'GUEST_ID';
}
+ if (str_ends_with($row['id'], '@{$BASE_URL}')) {
+ $row['id'] = str_replace('{$BASE_URL}', rtrim($this->baseUrl, '/'), $row['id']);
+ }
+ if (str_ends_with($row['id'], '@{$REMOTE_URL}')) {
+ $row['id'] = str_replace('{$REMOTE_URL}', rtrim($this->baseRemoteUrl, '/'), $row['id']);
+ }
if (array_key_exists('avatar', $row)) {
Assert::assertRegExp('/' . self::$identifierToToken[$row['avatar']] . '\/avatar/', $mentions[$key]['avatar']);
unset($row['avatar']);
diff --git a/tests/integration/features/federation/chat.feature b/tests/integration/features/federation/chat.feature
new file mode 100644
index 000000000..0227c2e27
--- /dev/null
+++ b/tests/integration/features/federation/chat.feature
@@ -0,0 +1,33 @@
+Feature: federation/chat
+ Background:
+ Given user "participant1" exists
+ Given user "participant2" exists
+ Given user "participant3" exists
+
+ Scenario: Get mention suggestions
+ 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 "participant1" adds user "participant3" 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 |
+ And user "participant1" gets the following candidate mentions in room "room" for "" with 200
+ | source | id | label |
+ | calls | all | room |
+ | federated_users | participant2@{$REMOTE_URL} | participant2@localhost:8180 |
+ | users | participant3 | participant3-displayname |
+ And user "participant2" gets the following candidate mentions in room "LOCAL::room" for "" with 200
+ | source | id | label |
+ | calls | all | room |
+ | federated_users | participant1@{$BASE_URL} | participant1-displayname |
+ | federated_users | participant3@{$BASE_URL} | participant3-displayname |