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
diff options
context:
space:
mode:
authorVitor Mattos <vitor@php.rio>2022-03-10 16:20:45 +0300
committerVitor Mattos <vitor@php.rio>2022-03-10 16:20:45 +0300
commit23270be26a0e0e0cbfc6ab9c84d0ea1e34ccbdec (patch)
treeac3cea0174e7f6a58bf65a46d0d37666c3a9f8fb
parentea063e10663b51a9676947c4f20f8ffacbaa4b18 (diff)
Fix tests
Signed-off-by: Vitor Mattos <vitor@php.rio>
-rw-r--r--tests/integration/features/bootstrap/FeatureContext.php9
-rw-r--r--tests/integration/features/reaction/react.feature21
2 files changed, 28 insertions, 2 deletions
diff --git a/tests/integration/features/bootstrap/FeatureContext.php b/tests/integration/features/bootstrap/FeatureContext.php
index ecaa3692b..8eef8944f 100644
--- a/tests/integration/features/bootstrap/FeatureContext.php
+++ b/tests/integration/features/bootstrap/FeatureContext.php
@@ -2149,7 +2149,7 @@ class FeatureContext implements Context, SnippetAcceptingContext {
/**
* @Given /^user "([^"]*)" (delete react|react) with "([^"]*)" on message "([^"]*)" to room "([^"]*)" with (\d+)(?: \((v1)\))?$/
*/
- public function userReactWithOnMessageToRoomWith(string $user, string $action, string $reaction, string $message, string $identifier, int $statusCode, string $apiVersion = 'v1'): void {
+ public function userReactWithOnMessageToRoomWith(string $user, string $action, string $reaction, string $message, string $identifier, int $statusCode, string $apiVersion = 'v1', TableNode $formData = null): void {
$token = self::$identifierToToken[$identifier];
$messageId = self::$messages[$message];
$this->setCurrentUser($user);
@@ -2158,6 +2158,7 @@ class FeatureContext implements Context, SnippetAcceptingContext {
'reaction' => $reaction
]);
$this->assertStatusCode($this->response, $statusCode);
+ $this->assertReactionList($formData);
}
/**
@@ -2173,8 +2174,11 @@ class FeatureContext implements Context, SnippetAcceptingContext {
$this->assertReactionList($formData);
}
- private function assertReactionList(TableNode $formData): void {
+ private function assertReactionList(?TableNode $formData): void {
$expected = [];
+ if (!$formData instanceof TableNode) {
+ return;
+ }
foreach ($formData->getHash() as $row) {
$reaction = $row['reaction'];
unset($row['reaction']);
@@ -2187,6 +2191,7 @@ class FeatureContext implements Context, SnippetAcceptingContext {
unset($reaction['timestamp']);
return $reaction;
}, $list);
+ Assert::assertArrayHasKey($reaction, $expected, 'Not expected reaction: ' . $reaction);
Assert::assertCount(count($list), $expected[$reaction], 'Reaction count by type does not match');
usort($expected[$reaction], [self::class, 'sortAttendees']);
diff --git a/tests/integration/features/reaction/react.feature b/tests/integration/features/reaction/react.feature
index 432990640..15a970708 100644
--- a/tests/integration/features/reaction/react.feature
+++ b/tests/integration/features/reaction/react.feature
@@ -10,10 +10,15 @@ Feature: reaction/react
And user "participant1" adds user "participant2" to room "room" with 200 (v4)
And user "participant1" sends message "Message 1" to room "room" with 201
And user "participant2" react with "👍" on message "Message 1" to room "room" with 201
+ | actorType | actorId | actorDisplayName | reaction |
+ | users | participant2 | participant2-displayname | 👍 |
Then user "participant1" sees the following messages in room "room" with 200
| room | actorType | actorId | actorDisplayName | message | messageParameters | reactions |
| room | users | participant1 | participant1-displayname | Message 1 | [] | {"👍":1} |
And user "participant1" react with "👍" on message "Message 1" to room "room" with 201
+ | actorType | actorId | actorDisplayName | reaction |
+ | users | participant1 | participant1-displayname | 👍 |
+ | users | participant2 | participant2-displayname | 👍 |
Then user "participant1" sees the following messages in room "room" with 200
| room | actorType | actorId | actorDisplayName | message | messageParameters | reactions |
| room | users | participant1 | participant1-displayname | Message 1 | [] | {"👍":2} |
@@ -25,7 +30,11 @@ Feature: reaction/react
And user "participant1" adds user "participant2" to room "room" with 200 (v4)
And user "participant1" sends message "Message 1" to room "room" with 201
And user "participant2" react with "👍" on message "Message 1" to room "room" with 201
+ | actorType | actorId | actorDisplayName | reaction |
+ | users | participant2 | participant2-displayname | 👍 |
And user "participant2" react with "👍" on message "Message 1" to room "room" with 200
+ | actorType | actorId | actorDisplayName | reaction |
+ | users | participant2 | participant2-displayname | 👍 |
Then user "participant1" sees the following messages in room "room" with 200
| room | actorType | actorId | actorDisplayName | message | messageParameters | reactions |
| room | users | participant1 | participant1-displayname | Message 1 | [] | {"👍":1} |
@@ -37,10 +46,13 @@ Feature: reaction/react
And user "participant1" adds user "participant2" to room "room" with 200 (v4)
And user "participant1" sends message "Message 1" to room "room" with 201
And user "participant2" react with "👍" on message "Message 1" to room "room" with 201
+ | actorType | actorId | actorDisplayName | reaction |
+ | users | participant2 | participant2-displayname | 👍 |
Then user "participant1" sees the following messages in room "room" with 200
| room | actorType | actorId | actorDisplayName | message | messageParameters | reactions |
| room | users | participant1 | participant1-displayname | Message 1 | [] | {"👍":1} |
And user "participant2" delete react with "👍" on message "Message 1" to room "room" with 200
+ | actorType | actorId | actorDisplayName | reaction |
Then user "participant1" sees the following messages in room "room" with 200
| room | actorType | actorId | actorDisplayName | message | messageParameters | reactions |
| room | users | participant1 | participant1-displayname | Message 1 | [] | [] |
@@ -54,12 +66,21 @@ Feature: reaction/react
Then user "participant1" retrieve reactions "👍" of message "Message 1" in room "room" with 200
| actorType | actorId | actorDisplayName | reaction |
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 "room" with 201
+ | actorType | actorId | actorDisplayName | reaction |
+ | users | participant1 | participant1-displayname | 👍 |
+ | users | participant2 | participant2-displayname | 👍 |
Then user "participant1" retrieve reactions "👍" of message "Message 1" in room "room" with 200
| actorType | actorId | actorDisplayName | reaction |
| users | participant1 | participant1-displayname | 👍 |
| users | participant2 | participant2-displayname | 👍 |
And user "participant2" react with "👎" on message "Message 1" to room "room" with 201
+ | actorType | actorId | actorDisplayName | reaction |
+ | users | participant1 | participant1-displayname | 👍 |
+ | users | participant2 | participant2-displayname | 👎 |
+ | users | participant2 | participant2-displayname | 👍 |
And user "participant1" retrieve reactions "👎" of message "Message 1" in room "room" with 200
| actorType | actorId | actorDisplayName | reaction |
| users | participant2 | participant2-displayname | 👎 |