From e607ed2b20f73a5e3a54fd7d9982d28590b3c7fc Mon Sep 17 00:00:00 2001 From: prashant-gurung899 Date: Tue, 21 Jan 2025 14:49:46 +0545 Subject: [PATCH] add test to disable notifications for space membership event Signed-off-by: prashant-gurung899 --- .../bootstrap/NotificationContext.php | 1 + .../apiSettings/notificationSetting.feature | 128 ++++++++++++++++++ 2 files changed, 129 insertions(+) diff --git a/tests/acceptance/bootstrap/NotificationContext.php b/tests/acceptance/bootstrap/NotificationContext.php index 58466c522d2..ef173f066b1 100644 --- a/tests/acceptance/bootstrap/NotificationContext.php +++ b/tests/acceptance/bootstrap/NotificationContext.php @@ -607,6 +607,7 @@ public function userShouldHaveEmail(string $user, int $count): void { $address = $this->featureContext->getEmailAddressForUser($user); $this->featureContext->pushEmailRecipientAsMailBox($address); $mailBox = EmailHelper::getMailBoxFromEmail($address); + sleep(5); $mailboxResponse = EmailHelper::getMailboxInformation($mailBox, $this->featureContext->getStepLineRef()); Assert::assertCount($count, $mailboxResponse); } diff --git a/tests/acceptance/features/apiSettings/notificationSetting.feature b/tests/acceptance/features/apiSettings/notificationSetting.feature index 6d7a077a313..675072e079e 100644 --- a/tests/acceptance/features/apiSettings/notificationSetting.feature +++ b/tests/acceptance/features/apiSettings/notificationSetting.feature @@ -607,3 +607,131 @@ Feature: Notification Settings | message | | Alice Hansen added you to Space new-space | But user "Brian" should not have a notification related to space "new-space" with subject "Space disabled" + + + Scenario: disable mail and in-app notification for Added as space member event + Given using spaces DAV path + And the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API + And user "Alice" has created a space "newSpace" with the default quota using the Graph API + When user "Brian" disables notification for the following events using the settings API: + | Added as space member | mail,in-app | + Then the HTTP status code should be "201" + And the JSON data of the response should match + """ + { + "type": "object", + "required": ["value"], + "properties": { + "value": { + "type": "object", + "required": ["identifier","value"], + "properties": { + "identifier":{ + "type": "object", + "required": ["extension","bundle","setting"], + "properties": { + "extension":{ + "const": "ocis-accounts" + }, + "bundle":{ + "const": "profile" + }, + "setting":{ + "const": "event-space-shared-options" + } + } + }, + "value":{ + "type": "object", + "required": [ + "id", + "bundleId", + "settingId", + "accountUuid", + "resource", + "collectionValue" + ], + "properties":{ + "id":{ + "pattern":"%user_id_pattern%" + }, + "bundleId":{ + "pattern":"%user_id_pattern%" + }, + "settingId":{ + "pattern":"%user_id_pattern%" + }, + "accountUuid":{ + "pattern":"%user_id_pattern%" + }, + "resource":{ + "type": "object", + "required":["type"], + "properties": { + "type":{ + "const": "TYPE_USER" + } + } + }, + "collectionValue":{ + "type": "object", + "required":["values"], + "properties": { + "values":{ + "type": "array", + "maxItems": 2, + "minItems": 2, + "uniqueItems": true, + "items": { + "oneOf": [ + { + "type": "object", + "required": [ + "key", + "boolValue" + ], + "properties": { + "key":{ + "const": "mail" + }, + "boolValue":{ + "const": false + } + } + }, + { + "type": "object", + "required": [ + "key", + "boolValue" + ], + "properties": { + "key":{ + "const": "in-app" + }, + "boolValue":{ + "const": false + } + } + } + ] + } + } + } + } + } + } + } + } + } + } + """ + And user "Alice" has sent the following space share invitation: + | space | newSpace | + | sharee | Brian | + | shareType | user | + | permissionsRole | Space Viewer | + And user "Brian" should have "0" emails + When user "Brian" lists all notifications + Then the HTTP status code should be "200" + And the notifications should be empty