summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2022-04-25 17:25:19 +0200
committerJoas Schilling <coding@schilljs.com>2022-04-25 17:25:19 +0200
commitb73eb9fb0497718cc46dbe10674da58aa1bbf8f3 (patch)
treef7739ba258e7652fc1f195f0df70e1ea7d65247c /tests
parente13ad504caf5cca24775ae9b015823282d0cd9b3 (diff)
Add integration tests for guest reactions
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/integration/features/bootstrap/FeatureContext.php1
-rw-r--r--tests/integration/features/reaction/react.feature16
2 files changed, 14 insertions, 3 deletions
diff --git a/tests/integration/features/bootstrap/FeatureContext.php b/tests/integration/features/bootstrap/FeatureContext.php
index fd722589a..23a22880b 100644
--- a/tests/integration/features/bootstrap/FeatureContext.php
+++ b/tests/integration/features/bootstrap/FeatureContext.php
@@ -2300,6 +2300,7 @@ class FeatureContext implements Context, SnippetAcceptingContext {
$result = array_map(static 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'];
return $reaction;
}, $list);
Assert::assertArrayHasKey($reaction, $expected, 'Not expected reaction: ' . $reaction);
diff --git a/tests/integration/features/reaction/react.feature b/tests/integration/features/reaction/react.feature
index 7c9613e8b..d53b044e0 100644
--- a/tests/integration/features/reaction/react.feature
+++ b/tests/integration/features/reaction/react.feature
@@ -25,11 +25,14 @@ Feature: reaction/react
| users | participant1 | participant1-displayname | 👍 |
| users | participant2 | participant2-displayname | 👍 |
And user "participant1" react with "🚀" on message "Message 1" to room "room" with 201
+ Then user "guest" joins room "room" with 200 (v4)
+ And user "guest" react with "👤" on message "Message 1" to room "room" with 201
Then user "participant1" sees the following messages in room "room" with 200
- | room | actorType | actorId | actorDisplayName | message | messageParameters | reactions | reactionsSelf |
- | room | users | participant1 | participant1-displayname | Message 1 | [] | {"👍":2,"🚀":1} | ["👍","🚀"] |
+ | room | actorType | actorId | actorDisplayName | message | messageParameters | reactions | reactionsSelf |
+ | room | users | participant1 | participant1-displayname | Message 1 | [] | {"👍":2,"👤":1,"🚀":1} | ["👍","🚀"] |
Then user "participant1" sees the following system messages in room "room" with 200
| room | actorType | actorId | actorDisplayName | systemMessage |
+ | room | guests | guest | | reaction |
| room | users | participant1 | participant1-displayname | reaction |
| room | users | participant1 | participant1-displayname | reaction |
| room | users | participant2 | participant2-displayname | reaction |
@@ -66,17 +69,24 @@ Feature: reaction/react
And user "participant2" react with "👍" on message "Message 1" to room "room" with 201
| actorType | actorId | actorDisplayName | reaction |
| users | participant2 | participant2-displayname | 👍 |
+ Then user "guest" joins room "room" with 200 (v4)
+ And user "guest" react with "👤" on message "Message 1" to room "room" with 201
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} |
+ | room | users | participant1 | participant1-displayname | Message 1 | [] | {"👤":1,"👍":1} |
And user "participant2" delete react with "👍" on message "Message 1" to room "room" with 200
| actorType | actorId | actorDisplayName | reaction |
+ | guests | guest | | 👤 |
+ And user "guest" 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 | [] | [] |
Then user "participant1" sees the following system messages in room "room" with 200
| room | actorType | actorId | actorDisplayName | systemMessage |
+ | room | guests | guest | | reaction_revoked |
| room | users | participant2 | participant2-displayname | reaction_revoked |
+ | room | guests | guest | | reaction_deleted |
| room | users | participant2 | participant2-displayname | reaction_deleted |
| room | users | participant1 | participant1-displayname | user_added |
| room | users | participant1 | participant1-displayname | conversation_created |