diff options
author | Joas Schilling <coding@schilljs.com> | 2023-09-20 21:54:41 +0200 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2023-09-21 09:58:13 +0200 |
commit | 2e7b140d2e99ffe94120589a8428ab0cb968ac2b (patch) | |
tree | bf7e29efa57b5ddba8b95301ac8e27fa5fd40318 /tests | |
parent | d5be55a14c18e473f12781c7609d3c6c81763ff6 (diff) |
fix(notifications): Allow sessions to mark themselves as inactive
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/integration/features/bootstrap/FeatureContext.php | 17 | ||||
-rw-r--r-- | tests/integration/features/chat/notifications.feature | 16 | ||||
-rw-r--r-- | tests/php/CapabilitiesTest.php | 1 |
3 files changed, 34 insertions, 0 deletions
diff --git a/tests/integration/features/bootstrap/FeatureContext.php b/tests/integration/features/bootstrap/FeatureContext.php index 2881f3b9a..71f8b9226 100644 --- a/tests/integration/features/bootstrap/FeatureContext.php +++ b/tests/integration/features/bootstrap/FeatureContext.php @@ -1065,6 +1065,23 @@ class FeatureContext implements Context, SnippetAcceptingContext { } /** + * @Then /^user "([^"]*)" sets session state to (\d) in room "([^"]*)" with (\d+) \((v4)\)$/ + * + * @param string $user + * @param string $identifier + * @param int $statusCode + * @param string $apiVersion + */ + public function userSessionState(string $user, int $state, string $identifier, int $statusCode, string $apiVersion): void { + $this->setCurrentUser($user); + $this->sendRequest( + 'PUT', '/apps/spreed/api/' . $apiVersion . '/room/' . self::$identifierToToken[$identifier] . '/participants/state', + ['state' => $state] + ); + $this->assertStatusCode($this->response, $statusCode); + } + + /** * @Then /^user "([^"]*)" views call-URL of room "([^"]*)" with (\d+)$/ * * @param string $user diff --git a/tests/integration/features/chat/notifications.feature b/tests/integration/features/chat/notifications.feature index 527f6201d..d35fb2f2f 100644 --- a/tests/integration/features/chat/notifications.feature +++ b/tests/integration/features/chat/notifications.feature @@ -15,6 +15,22 @@ Feature: chat/notifications Then user "participant2" has the following notifications | app | object_type | object_id | subject | + Scenario: Normal message when recipient is online but inactive + When user "participant1" creates room "one-to-one room" (v4) + | roomType | 1 | + | invite | participant2 | + # Join and leave to clear the invite notification + Given user "participant2" joins room "one-to-one room" with 200 (v4) + Given user "participant2" sets session state to 2 in room "one-to-one room" with 400 (v4) + When user "participant1" sends message "Message 1" to room "one-to-one room" with 201 + Given user "participant2" sets session state to 0 in room "one-to-one room" with 200 (v4) + When user "participant1" sends message "Message 2" to room "one-to-one room" with 201 + Given user "participant2" sets session state to 1 in room "one-to-one room" with 200 (v4) + When user "participant1" sends message "Message 3" to room "one-to-one room" with 201 + Then user "participant2" has the following notifications + | app | object_type | object_id | subject | + | spreed | chat | one-to-one room/Message 2 | participant1-displayname sent you a private message | + Scenario: Normal message when recipient is offline in the one-to-one When user "participant1" creates room "one-to-one room" (v4) | roomType | 1 | diff --git a/tests/php/CapabilitiesTest.php b/tests/php/CapabilitiesTest.php index ccb457121..d168c0259 100644 --- a/tests/php/CapabilitiesTest.php +++ b/tests/php/CapabilitiesTest.php @@ -140,6 +140,7 @@ class CapabilitiesTest extends TestCase { 'remind-me-later', 'bots-v1', 'markdown-messages', + 'session-state', 'message-expiration', 'reactions', ]; |