diff options
author | Joas Schilling <coding@schilljs.com> | 2021-09-01 18:28:19 +0300 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2021-09-20 13:51:19 +0300 |
commit | bf6150be9549813459f26a92cfafaa114331cebe (patch) | |
tree | 68ec559bba93f0198cfc79fdb19111ab435f268d /tests | |
parent | 9aff2302dfc1f94c607e0296ca14a620c2758cdb (diff) |
Add a counter for the direct mentions
This allows the UI can show the user bubble depending on user vs. all mentions
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/integration/features/bootstrap/FeatureContext.php | 6 | ||||
-rw-r--r-- | tests/integration/features/chat/mentions.feature | 89 | ||||
-rw-r--r-- | tests/php/CapabilitiesTest.php | 1 |
3 files changed, 96 insertions, 0 deletions
diff --git a/tests/integration/features/bootstrap/FeatureContext.php b/tests/integration/features/bootstrap/FeatureContext.php index 16160049c..fc1519365 100644 --- a/tests/integration/features/bootstrap/FeatureContext.php +++ b/tests/integration/features/bootstrap/FeatureContext.php @@ -302,6 +302,12 @@ class FeatureContext implements Context, SnippetAcceptingContext { if (isset($expectedRoom['lastMessage'])) { $data['lastMessage'] = $room['lastMessage'] ? $room['lastMessage']['message'] : ''; } + if (isset($expectedRoom['unreadMention'])) { + $data['unreadMention'] = (int) $room['unreadMention']; + } + if (isset($expectedRoom['unreadMentionDirect'])) { + $data['unreadMentionDirect'] = (int) $room['unreadMentionDirect']; + } if (isset($expectedRoom['participants'])) { throw new \Exception('participants key needs to be checked via participants endpoint'); } diff --git a/tests/integration/features/chat/mentions.feature b/tests/integration/features/chat/mentions.feature index 3e9c3306b..2c039f95c 100644 --- a/tests/integration/features/chat/mentions.feature +++ b/tests/integration/features/chat/mentions.feature @@ -534,3 +534,92 @@ Feature: chat/mentions When user "participant1" sends message "hi @participant3" to room "file last share room" with 201 And user "participant3" leaves room "file last share room" with 200 (v4) Then user "participant3" is not participant of room "file last share room" (v4) + + Scenario: check direct mention marker after room mention + When user "participant1" creates room "group room" (v4) + | roomType | 2 | + | roomName | room | + And user "participant1" adds user "participant2" to room "group room" with 200 (v4) + And user "participant1" adds user "participant3" to room "group room" with 200 (v4) + And user "participant1" sends message "Room mention @all no direct mention" to room "group room" with 201 + And user "participant2" is participant of the following rooms (v4) + | id | unreadMention | unreadMentionDirect | + | group room | 1 | 0 | + And user "participant3" is participant of the following rooms (v4) + | id | unreadMention | unreadMentionDirect | + | group room | 1 | 0 | + + Scenario: check direct mention marker after user mention + When user "participant1" creates room "group room" (v4) + | roomType | 2 | + | roomName | room | + And user "participant1" adds user "participant2" to room "group room" with 200 (v4) + And user "participant1" adds user "participant3" to room "group room" with 200 (v4) + And user "participant1" sends message "Direction mention for @participant3 only" to room "group room" with 201 + And user "participant2" is participant of the following rooms (v4) + | id | unreadMention | unreadMentionDirect | + | group room | 0 | 0 | + And user "participant3" is participant of the following rooms (v4) + | id | unreadMention | unreadMentionDirect | + | group room | 1 | 1 | + + Scenario: check direct mention marker after mixed mention + When user "participant1" creates room "group room" (v4) + | roomType | 2 | + | roomName | room | + And user "participant1" adds user "participant2" to room "group room" with 200 (v4) + And user "participant1" adds user "participant3" to room "group room" with 200 (v4) + And user "participant1" sends message "Direction mention for @participant3 and @all for participant2" to room "group room" with 201 + And user "participant2" is participant of the following rooms (v4) + | id | unreadMention | unreadMentionDirect | + | group room | 1 | 0 | + And user "participant3" is participant of the following rooms (v4) + | id | unreadMention | unreadMentionDirect | + | group room | 1 | 1 | + When user "participant3" reads message "Direction mention for @participant3 and @all for participant2" in room "group room" with 200 + And user "participant2" is participant of the following rooms (v4) + | id | unreadMention | unreadMentionDirect | + | group room | 1 | 0 | + And user "participant3" is participant of the following rooms (v4) + | id | unreadMention | unreadMentionDirect | + | group room | 0 | 0 | + + Scenario: check direct mention marker after reading partly + When user "participant1" creates room "group room" (v4) + | roomType | 2 | + | roomName | room | + And user "participant1" adds user "participant2" to room "group room" with 200 (v4) + And user "participant1" adds user "participant3" to room "group room" with 200 (v4) + And user "participant1" sends message "Test @participant3 #1" to room "group room" with 201 + And user "participant1" sends message "Test @participant3 #2" to room "group room" with 201 + And user "participant3" is participant of the following rooms (v4) + | id | unreadMention | unreadMentionDirect | + | group room | 1 | 1 | + When user "participant3" reads message "Test @participant3 #1" in room "group room" with 200 + And user "participant3" is participant of the following rooms (v4) + | id | unreadMention | unreadMentionDirect | + | group room | 1 | 1 | + When user "participant3" reads message "Test @participant3 #2" in room "group room" with 200 + And user "participant3" is participant of the following rooms (v4) + | id | unreadMention | unreadMentionDirect | + | group room | 0 | 0 | + + Scenario: check direct mention marker after reading partly with mixed mention + When user "participant1" creates room "group room" (v4) + | roomType | 2 | + | roomName | room | + And user "participant1" adds user "participant2" to room "group room" with 200 (v4) + And user "participant1" adds user "participant3" to room "group room" with 200 (v4) + And user "participant1" sends message "Test @participant3 #1" to room "group room" with 201 + And user "participant1" sends message "Test @all" to room "group room" with 201 + And user "participant3" is participant of the following rooms (v4) + | id | unreadMention | unreadMentionDirect | + | group room | 1 | 1 | + When user "participant3" reads message "Test @participant3 #1" in room "group room" with 200 + And user "participant3" is participant of the following rooms (v4) + | id | unreadMention | unreadMentionDirect | + | group room | 1 | 0 | + When user "participant3" reads message "Test @all" in room "group room" with 200 + And user "participant3" is participant of the following rooms (v4) + | id | unreadMention | unreadMentionDirect | + | group room | 0 | 0 | diff --git a/tests/php/CapabilitiesTest.php b/tests/php/CapabilitiesTest.php index 77e4fcb1c..a8bc06174 100644 --- a/tests/php/CapabilitiesTest.php +++ b/tests/php/CapabilitiesTest.php @@ -92,6 +92,7 @@ class CapabilitiesTest extends TestCase { 'signaling-v3', 'publishing-permissions', 'clear-history', + 'direct-mention-flag', ]; } |