summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2023-04-24 12:14:21 +0200
committerJoas Schilling <coding@schilljs.com>2023-04-24 12:14:21 +0200
commit8f4542216e5eab38ca8157765c1960fb16ad1b6e (patch)
treefacacb436478320db78a86a189d8a8eaa34c2d1b
parent46251c9042141ae41cac02988f3233564abef733 (diff)
fix(tests): Explicitly replace only the desired room token
Signed-off-by: Joas Schilling <coding@schilljs.com>
-rw-r--r--tests/integration/features/bootstrap/FeatureContext.php5
-rw-r--r--tests/integration/features/bootstrap/SharingContext.php13
-rw-r--r--tests/integration/features/callapi/recording.feature14
3 files changed, 10 insertions, 22 deletions
diff --git a/tests/integration/features/bootstrap/FeatureContext.php b/tests/integration/features/bootstrap/FeatureContext.php
index d0635aa66..98a1fe5d9 100644
--- a/tests/integration/features/bootstrap/FeatureContext.php
+++ b/tests/integration/features/bootstrap/FeatureContext.php
@@ -2793,8 +2793,9 @@ class FeatureContext implements Context, SnippetAcceptingContext {
}
if (isset($expectedNotification['message'])) {
$data['message'] = (string) $notification['message'];
- if (str_contains($expectedNotification['message'], '{{TOKEN}}')) {
- $data['message'] = str_replace($notification['object_id'], '{{TOKEN}}', $data['message']);
+ $result = preg_match('/ROOM\(([^)]+)\)/', $expectedNotification['message'], $matches);
+ if ($result && isset(self::$identifierToToken[$matches[1]])) {
+ $data['message'] = str_replace(self::$identifierToToken[$matches[1]], $matches[0], $data['message']);
}
}
if (isset($expectedNotification['object_type'])) {
diff --git a/tests/integration/features/bootstrap/SharingContext.php b/tests/integration/features/bootstrap/SharingContext.php
index 9e3cbf571..a45c86dbd 100644
--- a/tests/integration/features/bootstrap/SharingContext.php
+++ b/tests/integration/features/bootstrap/SharingContext.php
@@ -55,15 +55,6 @@ class SharingContext implements Context {
}
}
- private \FeatureContext $featureContext;
-
- /** @BeforeScenario */
- public function gatherContexts(\Behat\Behat\Hook\Scope\BeforeScenarioScope $scope) {
- $environment = $scope->getEnvironment();
-
- $this->featureContext = $environment->getContext('FeatureContext');
- }
-
/**
* @Given user :user creates folder :destination
*
@@ -186,10 +177,6 @@ class SharingContext implements Context {
* @param TableNode|null $body
*/
public function userSharesWithRoom(string $user, string $path, string $room, TableNode $body = null) {
- if (str_contains($path, '{{TOKEN}}')) {
- $path = str_replace('{{TOKEN}}', $this->featureContext->getLastConversationToken(), $path);
- }
-
$this->userSharesWith($user, $path, 10 /*IShare::TYPE_ROOM*/, FeatureContext::getTokenForIdentifier($room), $body);
}
diff --git a/tests/integration/features/callapi/recording.feature b/tests/integration/features/callapi/recording.feature
index a8c853ee8..d9b0b1ec2 100644
--- a/tests/integration/features/callapi/recording.feature
+++ b/tests/integration/features/callapi/recording.feature
@@ -440,19 +440,19 @@ Feature: callapi/recording
When user "participant1" store recording file "/img/join_call.ogg" in room "room1" with 200 (v1)
Then user "participant1" has the following notifications
| app | object_type | object_id | subject | message |
- | spreed | recording | room1 | Call recording now available | The recording for the call in room1 was uploaded to /Talk/Recording/{{TOKEN}}/join_call.ogg. |
+ | spreed | recording | room1 | Call recording now available | The recording for the call in room1 was uploaded to /Talk/Recording/ROOM(room1)/join_call.ogg. |
And user "participant1" is participant of the following unordered rooms (v4)
| type | name | callRecording |
| 2 | room1 | 0 |
When run transcript background jobs
Then user "participant1" has the following notifications
| app | object_type | object_id | subject | message |
- | spreed | recording | room1 | Transcript now available | The transcript for the call in room1 was uploaded to /Talk/Recording/{{TOKEN}}/join_call.txt. |
- | spreed | recording | room1 | Call recording now available | The recording for the call in room1 was uploaded to /Talk/Recording/{{TOKEN}}/join_call.ogg. |
+ | spreed | recording | room1 | Transcript now available | The transcript for the call in room1 was uploaded to /Talk/Recording/ROOM(room1)/join_call.txt. |
+ | spreed | recording | room1 | Call recording now available | The recording for the call in room1 was uploaded to /Talk/Recording/ROOM(room1)/join_call.ogg. |
When user "participant1" shares file from the last notification to room "room1" with 200 (v1)
Then user "participant1" has the following notifications
| app | object_type | object_id | subject | message |
- | spreed | recording | room1 | Transcript now available | The transcript for the call in room1 was uploaded to /Talk/Recording/{{TOKEN}}/join_call.txt. |
+ | spreed | recording | room1 | Transcript now available | The transcript for the call in room1 was uploaded to /Talk/Recording/ROOM(room1)/join_call.txt. |
When user "participant1" shares file from the first notification to room "room1" with 200 (v1)
Then user "participant1" has the following notifications
| app | object_type | object_id | subject | message |
@@ -466,15 +466,15 @@ Feature: callapi/recording
When user "participant1" store recording file "/img/leave_call.ogg" in room "room1" with 200 (v1)
Then user "participant1" has the following notifications
| app | object_type | object_id | subject | message |
- | spreed | recording | room1 | Call recording now available | The recording for the call in room1 was uploaded to /Talk/Recording/{{TOKEN}}/leave_call.ogg. |
+ | spreed | recording | room1 | Call recording now available | The recording for the call in room1 was uploaded to /Talk/Recording/ROOM(room1)/leave_call.ogg. |
And user "participant1" is participant of the following unordered rooms (v4)
| type | name | callRecording |
| 2 | room1 | 0 |
When run transcript background jobs
Then user "participant1" has the following notifications
| app | object_type | object_id | subject | message |
- | spreed | recording | room1 | Failed to transcript call recording | The server failed to transcript the recording at /Talk/Recording/{{TOKEN}}/leave_call.ogg for the call in room1. Please reach out to the administration. |
- | spreed | recording | room1 | Call recording now available | The recording for the call in room1 was uploaded to /Talk/Recording/{{TOKEN}}/leave_call.ogg. |
+ | spreed | recording | room1 | Failed to transcript call recording | The server failed to transcript the recording at /Talk/Recording/ROOM(room1)/leave_call.ogg for the call in room1. Please reach out to the administration. |
+ | spreed | recording | room1 | Call recording now available | The recording for the call in room1 was uploaded to /Talk/Recording/ROOM(room1)/leave_call.ogg. |
Scenario: Store recording with failure
Given user "participant1" creates room "room1" (v4)