From 7d1d05ff1afb7facbaa2db8f52ea9cafeb8690d7 Mon Sep 17 00:00:00 2001 From: amrita-shrestha Date: Thu, 27 Mar 2025 12:17:50 +0545 Subject: [PATCH] combine inapp and mail --- docs/ocis/development/testing.md | 4 +- .../apiNotification/emailNotification.feature | 323 ------------ .../apiNotification/notification.feature | 387 ++++++++------- .../apiNotification/spaceNotification.feature | 463 ++++++------------ 4 files changed, 343 insertions(+), 834 deletions(-) delete mode 100644 tests/acceptance/features/apiNotification/emailNotification.feature diff --git a/docs/ocis/development/testing.md b/docs/ocis/development/testing.md index 0bf8c2cb77a..54ccab2c45e 100644 --- a/docs/ocis/development/testing.md +++ b/docs/ocis/development/testing.md @@ -75,7 +75,7 @@ To run the tests that require an email server (tests tagged with `@email`), you ```bash START_EMAIL=true \ OCIS_ADD_RUN_SERVICES=notifications \ -BEHAT_FEATURE='tests/acceptance/features/apiNotification/emailNotification.feature' \ +BEHAT_FEATURE='tests/acceptance/features/apiNotification/notification.feature' \ make -C tests/acceptance/docker test-ocis-feature-ocis-storage ``` @@ -373,7 +373,7 @@ Run the acceptance test with the following command: TEST_SERVER_URL="https://localhost:9200" \ EMAIL_HOST="localhost" \ EMAIL_PORT=8025 \ -BEHAT_FEATURE="tests/acceptance/features/apiNotification/emailNotification.feature" \ +BEHAT_FEATURE="tests/acceptance/features/apiNotification/notification.feature" \ make test-acceptance-api ``` diff --git a/tests/acceptance/features/apiNotification/emailNotification.feature b/tests/acceptance/features/apiNotification/emailNotification.feature deleted file mode 100644 index f411cd459b1..00000000000 --- a/tests/acceptance/features/apiNotification/emailNotification.feature +++ /dev/null @@ -1,323 +0,0 @@ -@email -Feature: Email notification - As a user - I want to get email notification of events related to me - So that I can stay updated about the events - - Background: - Given these users have been created with default attributes: - | username | - | Alice | - | Brian | - - - Scenario: user gets an email notification when someone shares a project space - Given the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API - And user "Alice" has created a space "new-space" with the default quota using the Graph API - When user "Alice" shares a space "new-space" with settings: - | shareWith | Brian | - | role | Editor | - Then the HTTP status code should be "200" - And user "Brian" should have received the following email from user "Alice" about the share of project space "new-space" - """ - Hello Brian Murphy, - - %displayname% has invited you to join "new-space". - - Click here to view it: %base_url%/f/%space_id% - """ - - - Scenario: user gets an email notification when someone shares a file - Given user "Alice" has uploaded file with content "sample text" to "lorem.txt" - When user "Alice" shares file "lorem.txt" with user "Brian" using the sharing API - Then the HTTP status code should be "200" - And the OCS status code should be "100" - And user "Brian" should have received the following email from user "Alice" - """ - Hello Brian Murphy - - %displayname% has shared "lorem.txt" with you. - - Click here to view it: %base_url%/files/shares/with-me - """ - - - Scenario: group members get an email notification when someone shares a project space with the group - Given the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API - And user "Carol" has been created with default attributes - And group "group1" has been created - And user "Brian" has been added to group "group1" - And user "Carol" has been added to group "group1" - And user "Alice" has created a space "new-space" with the default quota using the Graph API - When user "Alice" shares a space "new-space" with settings: - | shareWith | group1 | - | shareType | 8 | - | role | viewer | - Then the HTTP status code should be "200" - And user "Brian" should have received the following email from user "Alice" about the share of project space "new-space" - """ - Hello Brian Murphy, - - %displayname% has invited you to join "new-space". - - Click here to view it: %base_url%/f/%space_id% - """ - And user "Carol" should have received the following email from user "Alice" about the share of project space "new-space" - """ - Hello Carol King, - - %displayname% has invited you to join "new-space". - - Click here to view it: %base_url%/f/%space_id% - """ - - - Scenario: group members get an email notification in their respective languages when someone shares a folder with the group - Given user "Carol" has been created with default attributes - And group "group1" has been created - And user "Brian" has been added to group "group1" - And user "Carol" has been added to group "group1" - And user "Brian" has switched the system language to "es" using the Graph API - And user "Carol" has switched the system language to "de" using the Graph API - And user "Alice" has created folder "/HelloWorld" - When user "Alice" shares folder "HelloWorld" with group "group1" using the sharing API - Then the HTTP status code should be "200" - And the OCS status code should be "100" - And user "Brian" should have received the following email from user "Alice" - """ - Hola Brian Murphy - - %displayname% ha compartido "HelloWorld" contigo. - - Click aquí para verlo: %base_url%/files/shares/with-me - """ - And user "Carol" should have received the following email from user "Alice" - """ - Hallo Carol King - - %displayname% hat "HelloWorld" mit Ihnen geteilt. - - Zum Ansehen hier klicken: %base_url%/files/shares/with-me - """ - - - Scenario: group members get an email notification in their respective languages when someone shares a file with the group - Given user "Carol" has been created with default attributes - And group "group1" has been created - And user "Brian" has been added to group "group1" - And user "Carol" has been added to group "group1" - And user "Brian" has switched the system language to "es" using the Graph API - And user "Carol" has switched the system language to "de" using the Graph API - And user "Alice" has uploaded file with content "hello world" to "text.txt" - When user "Alice" shares file "text.txt" with group "group1" using the sharing API - Then the HTTP status code should be "200" - And the OCS status code should be "100" - And user "Brian" should have received the following email from user "Alice" - """ - Hola Brian Murphy - - %displayname% ha compartido "text.txt" contigo. - - Click aquí para verlo: %base_url%/files/shares/with-me - """ - And user "Carol" should have received the following email from user "Alice" - """ - Hallo Carol King - - %displayname% hat "text.txt" mit Ihnen geteilt. - - Zum Ansehen hier klicken: %base_url%/files/shares/with-me - """ - - - Scenario: group members get an email notification in their respective languages when someone shares a space with the group - Given the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API - And user "Carol" has been created with default attributes - And group "group1" has been created - And user "Brian" has been added to group "group1" - And user "Carol" has been added to group "group1" - And user "Brian" has switched the system language to "es" using the Graph API - And user "Carol" has switched the system language to "de" using the Graph API - And user "Alice" has created a space "new-space" with the default quota using the Graph API - When user "Alice" shares a space "new-space" with settings: - | shareWith | group1 | - | role | viewer | - Then the HTTP status code should be "200" - And user "Brian" should have received the following email from user "Alice" about the share of project space "new-space" - """ - Hola Brian Murphy, - - Alice Hansen te ha invitado a unirte a "new-space". - - Click aquí para verlo: %base_url%/f/%space_id% - """ - And user "Carol" should have received the following email from user "Alice" about the share of project space "new-space" - """ - Hallo Carol King, - - Alice Hansen hat Sie eingeladen, dem Space "new-space" beizutreten. - - Zum Ansehen hier klicken: %base_url%/f/%space_id% - """ - - - Scenario: user gets an email notification when space admin unshares a space - Given the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API - And user "Alice" has created a space "new-space" with the default quota using the Graph API - And user "Alice" has sent the following space share invitation: - | space | new-space | - | sharee | Brian | - | shareType | user | - | permissionsRole | Space Viewer | - When user "Alice" unshares a space "new-space" to user "Brian" - Then the HTTP status code should be "200" - And user "Brian" should have received the following email from user "Alice" about the share of project space "new-space" - """ - Hello Brian Murphy, - - %displayname% has removed you from "new-space". - - You might still have access through your other groups or direct membership. - - Click here to check it: %base_url%/f/%space_id% - """ - - @issue-10904 - Scenario: user gets an email notification when a folder is unshared (Personal Space) - Given user "Alice" has created folder "SHARED-FOLDER" - And user "Alice" has sent the following resource share invitation: - | resource | SHARED-FOLDER | - | space | Personal | - | sharee | Brian | - | shareType | user | - | permissionsRole | Viewer | - When user "Alice" removes the access of user "Brian" from resource "SHARED-FOLDER" of space "Personal" using the Graph API - Then the HTTP status code should be "204" - And user "Brian" should have received the following email from user "Alice" about the share of project space "SHARED-FOLDER" - """ - Hello Brian Murphy, - - %displayname% has unshared 'SHARED-FOLDER' with you. - - Even though this share has been revoked you still might have access through other shares and/or space memberships. - """ - - @issue-10904 - Scenario: user gets an email notification when a folder is unshared (Project Space) - 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 "shared-space" with the default quota using the Graph API - And user "Alice" has created a folder "SHARED-FOLDER" in space "shared-space" - And user "Alice" has sent the following resource share invitation: - | resource | SHARED-FOLDER | - | space | shared-space | - | sharee | Brian | - | shareType | user | - | permissionsRole | Viewer | - When user "Alice" removes the access of user "Brian" from resource "SHARED-FOLDER" of space "shared-space" using the Graph API - Then the HTTP status code should be "204" - And user "Brian" should have received the following email from user "Alice" about the share of project space "shared-space" - """ - Hello Brian Murphy, - - %displayname% has unshared 'SHARED-FOLDER' with you. - - Even though this share has been revoked you still might have access through other shares and/or space memberships. - """ - - @issue-10904 - Scenario: user gets an email notification when a file is unshared (Personal Space) - Given user "Alice" has uploaded file with content "Sample data" to "file-to-share.txt" - And user "Alice" has sent the following resource share invitation: - | resource | file-to-share.txt | - | space | Personal | - | sharee | Brian | - | shareType | user | - | permissionsRole | Viewer | - When user "Alice" removes the access of user "Brian" from resource "file-to-share.txt" of space "Personal" using the Graph API - Then the HTTP status code should be "204" - And user "Brian" should have received the following email from user "Alice" about the share of project space "file-to-share.txt" - """ - Hello Brian Murphy, - - %displayname% has unshared 'file-to-share.txt' with you. - - Even though this share has been revoked you still might have access through other shares and/or space memberships. - """ - - @issue-10904 - Scenario: user gets an email notification when a file is unshared (Project Space) - 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 "shared-space" with the default quota using the Graph API - And user "Alice" has uploaded a file inside space "shared-space" with content "Sample data" to "file-to-share.txt" - And user "Alice" has sent the following resource share invitation: - | resource | file-to-share.txt | - | space | shared-space | - | sharee | Brian | - | shareType | user | - | permissionsRole | Viewer | - When user "Alice" removes the access of user "Brian" from resource "file-to-share.txt" of space "shared-space" using the Graph API - Then the HTTP status code should be "204" - And user "Brian" should have received the following email from user "Alice" about the share of project space "file-to-share.txt" - """ - Hello Brian Murphy, - - %displayname% has unshared 'file-to-share.txt' with you. - - Even though this share has been revoked you still might have access through other shares and/or space memberships. - """ - - @env-config - Scenario: group members get an email notification in default language when someone shares a file with the group - Given the config "OCIS_DEFAULT_LANGUAGE" has been set to "de" - And user "Carol" has been created with default attributes - And group "group1" has been created - And user "Brian" has been added to group "group1" - And user "Carol" has been added to group "group1" - And user "Alice" has uploaded file with content "hello world" to "text.txt" - When user "Alice" shares file "text.txt" with group "group1" using the sharing API - Then the HTTP status code should be "200" - And the OCS status code should be "100" - And user "Brian" should have received the following email from user "Alice" - """ - Hallo Brian Murphy - - %displayname% hat "text.txt" mit Ihnen geteilt. - - Zum Ansehen hier klicken: %base_url%/files/shares/with-me - """ - And user "Carol" should have received the following email from user "Alice" - """ - Hallo Carol King - - %displayname% hat "text.txt" mit Ihnen geteilt. - - Zum Ansehen hier klicken: %base_url%/files/shares/with-me - """ - - @issue-9530 - Scenario: user gets an email notification when someone with comma in display name shares a file - Given the administrator has assigned the role "Admin" to user "Brian" using the Graph API - And the user "Brian" has created a new user with the following attributes: - | userName | Carol | - | displayName | Carol, King | - | email | carol@example.com | - | password | 1234 | - And user "Carol" has uploaded file with content "sample text" to "lorem.txt" - When user "Carol" sends the following resource share invitation using the Graph API: - | resource | lorem.txt | - | space | Personal | - | sharee | Brian | - | shareType | user | - | permissionsRole | Viewer | - Then the HTTP status code should be "200" - And user "Brian" should have received the following email from user "Carol" - """ - Hello Brian Murphy - - Carol, King has shared "lorem.txt" with you. - - Click here to view it: %base_url%/files/shares/with-me - """ diff --git a/tests/acceptance/features/apiNotification/notification.feature b/tests/acceptance/features/apiNotification/notification.feature index 2d0a1258aa0..ce46abe8f95 100644 --- a/tests/acceptance/features/apiNotification/notification.feature +++ b/tests/acceptance/features/apiNotification/notification.feature @@ -13,8 +13,8 @@ Feature: Notification And user "Alice" has uploaded file with content "other data" to "/textfile1.txt" And user "Alice" has created folder "my_data" - - Scenario Outline: user gets a notification of resource sharing + @email + Scenario Outline: user gets in-app and mail notifications of resource sharing Given user "Alice" has sent the following resource share invitation: | resource | | | space | Personal | @@ -41,209 +41,48 @@ Feature: Notification "user" ], "properties": { - "app": { - "type": "string", - "enum": ["userlog"] - }, - "message": { - "type": "string", - "enum": ["Alice Hansen shared with you"] - }, - "messageRich": { - "type": "string", - "enum": ["{user} shared {resource} with you"] - }, + "app": {"const": "userlog"}, + "message": {"const": "Alice Hansen shared with you"}, + "messageRich": {"const": "{user} shared {resource} with you"}, "messageRichParameters": { "type": "object", - "required": [ - "resource", - "user" - ], + "required": ["resource","user"], "properties": { "resource": { "type": "object", - "required": [ - "id", - "name" - ], + "required": ["id","name"], "properties": { - "id": { - "type": "string", - "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}\\$[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}![a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$" - }, - "name": { - "type": "string", - "enum": [""] - } + "id": {"pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}\\$[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}![a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"}, + "name": {"const": ""} } }, "user": { "type": "object", - "required": [ - "displayname", - "id", - "name" - ], + "required": ["displayname","id","name"], "properties": { - "displayname": { - "type": "string", - "enum": ["Alice Hansen"] - }, - "id": { - "type": "string", - "pattern": "^%user_id_pattern%$" - }, - "name": { - "type": "string", - "enum": ["Alice"] - } + "displayname": {"const": "Alice Hansen"}, + "id": {"pattern": "^%user_id_pattern%$"}, + "name": {"const": "Alice"} } } } }, - "notification_id": { - "type": "string" - }, - "object_id": { - "type": "string" - }, - "object_type": { - "type": "string", - "enum": ["share"] - }, - "subject": { - "type": "string", - "enum": ["Resource shared"] - }, - "subjectRich": { - "type": "string", - "enum": ["Resource shared"] - }, - "user": { - "type": "string", - "enum": ["Alice"] - } + "notification_id": {"type": "string"}, + "object_id": {"type": "string"}, + "object_type": {"const": "share"}, + "subject": {"const": "Resource shared"}, + "subjectRich": {"const": "Resource shared"}, + "user": {"const": "Alice"} } } """ - Examples: - | resource | - | textfile1.txt | - | my_data | - - - Scenario Outline: user gets a notification of unsharing resource - Given user "Alice" has sent the following resource share invitation: - | resource | | - | space | Personal | - | sharee | Brian | - | shareType | user | - | permissionsRole | Viewer | - And user "Alice" has removed the access of user "Brian" from resource "" of space "Personal" - When user "Brian" lists all notifications - Then the HTTP status code should be "200" - And the JSON response should contain a notification message with the subject "Resource unshared" and the message-details should match + And user "Brian" should have received the following email from user "Alice" """ - { - "type": "object", - "required": [ - "app", - "datetime", - "message", - "messageRich", - "messageRichParameters", - "notification_id", - "object_id", - "object_type", - "subject", - "subjectRich", - "user" - ], - "properties": { - "app": { - "type": "string", - "enum": ["userlog"] - }, - "message": { - "type": "string", - "enum": ["Alice Hansen unshared with you"] - }, - "messageRich": { - "type": "string", - "enum": ["{user} unshared {resource} with you"] - }, - "messageRichParameters": { - "type": "object", - "required": [ - "resource", - "user" - ], - "properties": { - "resource": { - "type": "object", - "required": [ - "id", - "name" - ], - "properties": { - "id": { - "type": "string", - "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}\\$[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}![a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$" - }, - "name": { - "type": "string", - "enum": [""] - } - } - }, - "user": { - "type": "object", - "required": [ - "displayname", - "id", - "name" - ], - "properties": { - "displayname": { - "type": "string", - "enum": ["Alice Hansen"] - }, - "id": { - "type": "string", - "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$" - }, - "name": { - "type": "string", - "enum": ["Alice"] - } - } - } - } - }, - "notification_id": { - "type": "string" - }, - "object_id": { - "type": "string" - }, - "object_type": { - "type": "string", - "enum": ["share"] - }, - "subject": { - "type": "string", - "enum": ["Resource unshared"] - }, - "subjectRich": { - "type": "string", - "enum": ["Resource unshared"] - }, - "user": { - "type": "string", - "enum": ["Alice"] - } - } - } + Hello Brian Murphy + + %displayname% has shared "" with you. + + Click here to view it: %base_url%/files/shares/with-me """ Examples: | resource | @@ -315,7 +154,7 @@ Feature: Notification """ - Scenario Outline: notifications related to a resource get deleted when the resource is deleted + Scenario Outline: in-app notifications related to a resource get deleted when the resource is deleted Given user "Alice" has sent the following resource share invitation: | resource | | | space | Personal | @@ -332,7 +171,7 @@ Feature: Notification | textfile1.txt | | my_data | - @issue-10966 + @issue-10966 @email Scenario: check share expired in-app and mail notifications for Personal space file Given using SharingNG And user "Alice" has uploaded file with content "hello world" to "testfile.txt" @@ -357,7 +196,7 @@ Feature: Notification Even though this share has been revoked you still might have access through other shares and/or space memberships. """ - @issue-10966 + @issue-10966 @email Scenario: check share expired in-app and mail notifications for Personal space folder Given using SharingNG And user "Alice" has created folder "folderToShare" @@ -381,3 +220,173 @@ Feature: Notification Even though this share has been revoked you still might have access through other shares and/or space memberships. """ + + @issue-10904 @email + Scenario Outline: user gets an in-app and mail notifications of unsharing resource + Given user "Alice" has sent the following resource share invitation: + | resource | | + | space | Personal | + | sharee | Brian | + | shareType | user | + | permissionsRole | Viewer | + When user "Alice" removes the access of user "Brian" from resource "" of space "Personal" using the Graph API + Then the HTTP status code should be "204" + And user "Brian" should get a notification with subject "Resource unshared" and message: + | message | + | Alice Hansen unshared with you | + And user "Brian" should have received the following email from user "Alice" about the share of project space "" + """ + Hello Brian Murphy, + + %displayname% has unshared '' with you. + + Even though this share has been revoked you still might have access through other shares and/or space memberships. + """ + Examples: + | resource | + | textfile1.txt | + | my_data | + + @issue-10904 @email + Scenario Outline: user gets in-app and mail notifications when a resource is unshared (Project Space) + 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 "shared-space" with the default quota using the Graph API + And user "Alice" has created a folder "SHARED-FOLDER" in space "shared-space" + And user "Alice" has uploaded a file inside space "shared-space" with content "Sample data" to "file-to-share.txt" + And user "Alice" has sent the following resource share invitation: + | resource | | + | space | shared-space | + | sharee | Brian | + | shareType | user | + | permissionsRole | Viewer | + When user "Alice" removes the access of user "Brian" from resource "" of space "shared-space" using the Graph API + Then the HTTP status code should be "204" + And user "Brian" should get a notification with subject "Resource unshared" and message: + | message | + | Alice Hansen unshared with you | + And user "Brian" should have received the following email from user "Alice" about the share of project space "" + """ + Hello Brian Murphy, + + %displayname% has unshared '' with you. + + Even though this share has been revoked you still might have access through other shares and/or space memberships. + """ + Examples: + | resource | + | file-to-share.txt | + | SHARED-FOLDER | + + @issue-9530 @email + Scenario: user gets an in-app and mail notifications when someone with comma in display name shares a file + Given the administrator has assigned the role "Admin" to user "Brian" using the Graph API + And the user "Brian" has created a new user with the following attributes: + | userName | David | + | displayName | David, Lopez | + | email | david@example.com | + | password | 1234 | + And user "David" has uploaded file with content "sample text" to "lorem.txt" + When user "David" sends the following resource share invitation using the Graph API: + | resource | lorem.txt | + | space | Personal | + | sharee | Brian | + | shareType | user | + | permissionsRole | Viewer | + Then the HTTP status code should be "200" + And user "Brian" should get a notification with subject "Resource shared" and message: + | message | + | David, Lopez shared lorem.txt with you | + And user "Brian" should have received the following email from user "David" + """ + Hello Brian Murphy + + David, Lopez has shared "lorem.txt" with you. + + Click here to view it: %base_url%/files/shares/with-me + """ + + @email + Scenario Outline: group members gets an in-app and mail notifications in their respective languages when someone shares resources with the group + Given group "group1" has been created + And user "Brian" has been added to group "group1" + And user "Carol" has been added to group "group1" + And user "Brian" has switched the system language to "es" using the Graph API + And user "Carol" has switched the system language to "de" using the Graph API + And user "Alice" has created folder "HelloWorld" + And user "Alice" has uploaded file with content "hello world" to "text.txt" + When user "Alice" sends the following resource share invitation using the Graph API: + | resource | | + | space | Personal | + | sharee | group1 | + | shareType | group | + | permissionsRole | Viewer | + Then the HTTP status code should be "200" + And user "Brian" should get a notification with subject "Recurso compartido" and message: + | message | + | Alice Hansen compartió contigo | + And user "Carol" should get a notification with subject "Neue Freigabe" and message: + | message | + | Alice Hansen hat mit Ihnen geteilt | + And user "Brian" should have received the following email from user "Alice" + """ + Hola Brian Murphy + + %displayname% ha compartido "" contigo. + + Click aquí para verlo: %base_url%/files/shares/with-me + """ + And user "Carol" should have received the following email from user "Alice" + """ + Hallo Carol King + + %displayname% hat "" mit Ihnen geteilt. + + Zum Ansehen hier klicken: %base_url%/files/shares/with-me + """ + Examples: + | resource | + | HelloWorld | + | text.txt | + + @env-config @email + Scenario Outline: group members gets an in-app and mail notifications in default language when someone shares a file with the group + Given the config "OCIS_DEFAULT_LANGUAGE" has been set to "de" + And group "group1" has been created + And user "Brian" has been added to group "group1" + And user "Carol" has been added to group "group1" + And user "Alice" has created folder "HelloWorld" + And user "Alice" has uploaded file with content "hello world" to "text.txt" + When user "Alice" sends the following resource share invitation using the Graph API: + | resource | | + | space | Personal | + | sharee | group1 | + | shareType | group | + | permissionsRole | Viewer | + Then the HTTP status code should be "200" + And user "Brian" should get a notification with subject "Neue Freigabe" and message: + | message | + | Alice Hansen hat mit Ihnen geteilt | + And user "Carol" should get a notification with subject "Neue Freigabe" and message: + | message | + | Alice Hansen hat mit Ihnen geteilt | + And user "Brian" should have received the following email from user "Alice" + """ + Hallo Brian Murphy + + %displayname% hat "" mit Ihnen geteilt. + + Zum Ansehen hier klicken: %base_url%/files/shares/with-me + """ + And user "Carol" should have received the following email from user "Alice" + """ + Hallo Carol King + + %displayname% hat "" mit Ihnen geteilt. + + Zum Ansehen hier klicken: %base_url%/files/shares/with-me + """ + Examples: + | resource | + | HelloWorld | + | text.txt | diff --git a/tests/acceptance/features/apiNotification/spaceNotification.feature b/tests/acceptance/features/apiNotification/spaceNotification.feature index 4d2f22ca760..487fc388269 100644 --- a/tests/acceptance/features/apiNotification/spaceNotification.feature +++ b/tests/acceptance/features/apiNotification/spaceNotification.feature @@ -18,8 +18,8 @@ Feature: Notification | shareType | user | | permissionsRole | Space Editor | - - Scenario: get a notification of space shared + @email + Scenario: user gets in-app and mail notifications of space shared When user "Brian" lists all notifications Then the HTTP status code should be "200" And the JSON response should contain a notification message with the subject "Space shared" and the message-details should match @@ -40,245 +40,70 @@ Feature: Notification "user" ], "properties": { - "app": { - "type": "string", - "enum": [ - "userlog" - ] - }, - "message": { - "type": "string", - "enum": [ - "Alice Hansen added you to Space notification checking" - ] - }, - "messageRich": { - "type": "string", - "enum": [ - "{user} added you to Space {space}" - ] - }, + "app": {"const": "userlog"}, + "message": {"const": "Alice Hansen added you to Space notification checking"}, + "messageRich": {"const": "{user} added you to Space {space}"}, "messageRichParameters": { "type": "object", - "required": [ - "space", - "user" - ], + "required": ["space","user"], "properties": { "space": { "type": "object", - "required": [ - "id", - "name" - ], + "required": ["id","name"], "properties": { - "id": { - "type": "string", - "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}\\$[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}![a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$" - }, - "name": { - "type": "string", - "enum": [ - "notification checking" - ] - } + "id": {"pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}\\$[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}![a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"}, + "name": {"const": "notification checking"} } }, "user": { "type": "object", - "required": [ - "displayname", - "id", - "name" - ], + "required": ["displayname","id","name"], "properties": { - "displayname": { - "type": "string", - "enum": [ - "Alice Hansen" - ] - }, - "id": { - "type": "string", - "pattern": "^%user_id_pattern%$" - }, - "name": { - "type": "string", - "enum": [ - "Alice" - ] - } + "displayname": {"const": "Alice Hansen"}, + "id": {"pattern": "^%user_id_pattern%$"}, + "name": {"const": "Alice"} } } } }, - "notification_id": { - "type": "string" - }, - "object_id": { - "type": "string", - "pattern": "^%space_id_pattern%$" - }, - "object_type": { - "type": "string", - "enum": [ - "storagespace" - ] - }, - "subject": { - "type": "string", - "enum": [ - "Space shared" - ] - }, - "subjectRich": { - "type": "string", - "enum": [ - "Space shared" - ] - }, - "user": { - "type": "string", - "enum": [ - "Alice" - ] - } + "notification_id": {"type": "string"}, + "object_id": {"pattern": "^%space_id_pattern%$"}, + "object_type": {"const": "storagespace"}, + "subject": {"const": "Space shared"}, + "subjectRich": {"const": "Space shared"}, + "user": {"const": "Alice"} } } """ - - - Scenario: get a notification of space unshared - Given user "Alice" has removed the access of user "Brian" from space "notification checking" - When user "Brian" lists all notifications - Then the HTTP status code should be "200" - And the JSON response should contain a notification message with the subject "Removed from Space" and the message-details should match + And user "Brian" should have received the following email from user "Alice" about the share of project space "notification checking" """ - { - "type": "object", - "required": [ - "app", - "datetime", - "message", - "messageRich", - "messageRichParameters", - "notification_id", - "object_id", - "object_type", - "subject", - "subjectRich", - "user" - ], - "properties": { - "app": { - "type": "string", - "enum": [ - "userlog" - ] - }, - "message": { - "type": "string", - "enum": [ - "Alice Hansen removed you from Space notification checking" - ] - }, - "messageRich": { - "type": "string", - "enum": [ - "{user} removed you from Space {space}" - ] - }, - "messageRichParameters": { - "type": "object", - "required": [ - "space", - "user" - ], - "properties": { - "space": { - "type": "object", - "required": [ - "id", - "name" - ], - "properties": { - "id": { - "type": "string", - "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}\\$[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}![a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$" - }, - "name": { - "type": "string", - "enum": [ - "notification checking" - ] - } - } - }, - "user": { - "type": "object", - "required": [ - "displayname", - "id", - "name" - ], - "properties": { - "displayname": { - "type": "string", - "enum": [ - "Alice Hansen" - ] - }, - "id": { - "type": "string", - "pattern": "^%user_id_pattern%$" - }, - "name": { - "type": "string", - "enum": [ - "Alice" - ] - } - } - } - } - }, - "notification_id": { - "type": "string" - }, - "object_id": { - "type": "string", - "pattern": "^%space_id_pattern%$" - }, - "object_type": { - "type": "string", - "enum": [ - "storagespace" - ] - }, - "subject": { - "type": "string", - "enum": [ - "Removed from Space" - ] - }, - "subjectRich": { - "type": "string", - "enum": [ - "Removed from Space" - ] - }, - "user": { - "type": "string", - "enum": [ - "Alice" - ] - } - } - } + Hello Brian Murphy, + + %displayname% has invited you to join "notification checking". + + Click here to view it: %base_url%/f/%space_id% + """ + + @email + Scenario: gets in-app and mail notification of space unshared + When user "Alice" removes the access of user "Brian" from space "notification checking" using root endpoint of the Graph API + Then the HTTP status code should be "204" + And user "Brian" should get a notification with subject "Removed from Space" and message: + | message | + | Alice Hansen removed you from Space notification checking | + And user "Brian" should have received the following email from user "Alice" about the share of project space "notification checking" + """ + Hello Brian Murphy, + + %displayname% has removed you from "notification checking". + + You might still have access through your other groups or direct membership. + + Click here to check it: %base_url%/f/%space_id% """ - Scenario: get a notification of space disabled + Scenario: user gets in-app notification of space disabled (note: no mail notification) Given user "Alice" has disabled a space "notification checking" When user "Brian" lists all notifications Then the HTTP status code should be "200" @@ -301,115 +126,44 @@ Feature: Notification "user" ], "properties": { - "app": { - "type": "string", - "enum": [ - "userlog" - ] - }, - "message": { - "type": "string", - "enum": [ - "Alice Hansen disabled Space notification checking" - ] - }, - "messageRich": { - "type": "string", - "enum": [ - "{user} disabled Space {space}" - ] - }, + "app": {"const": "userlog"}, + "message": {"const": "Alice Hansen disabled Space notification checking"}, + "messageRich": {"const": "{user} disabled Space {space}"}, "messageRichParameters": { "type": "object", - "required": [ - "space", - "user" - ], + "required": ["space","user"], "properties": { "space": { "type": "object", - "required": [ - "id", - "name" - ], + "required": ["id","name"], "properties": { - "id": { - "type": "string", - "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}\\$[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}![a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$" - }, - "name": { - "type": "string", - "enum": [ - "notification checking" - ] - } + "id": {"pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}\\$[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}![a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"}, + "name": {"const": "notification checking"} } }, "user": { "type": "object", - "required": [ - "displayname", - "id", - "name" - ], + "required": ["displayname","id","name"], "properties": { - "displayname": { - "type": "string", - "enum": [ - "Alice Hansen" - ] - }, - "id": { - "type": "string", - "pattern": "^%user_id_pattern%$" - }, - "name": { - "type": "string", - "enum": [ - "Alice" - ] - } + "displayname": {"const": "Alice Hansen"}, + "id": {"pattern": "^%user_id_pattern%$"}, + "name": {"const": "Alice"} } } } }, - "notification_id": { - "type": "string" - }, - "object_id": { - "type": "string", - "pattern": "^%space_id_pattern%$" - }, - "object_type": { - "type": "string", - "enum": [ - "storagespace" - ] - }, - "subject": { - "type": "string", - "enum": [ - "Space disabled" - ] - }, - "subjectRich": { - "type": "string", - "enum": [ - "Space disabled" - ] - }, - "user": { - "type": "string", - "enum": [ - "Alice" - ] - } + "notification_id": {"type": "string"}, + "object_id": {"pattern": "^%space_id_pattern%$"}, + "object_type": {"const": "storagespace"}, + "subject": {"const": "Space disabled"}, + "subjectRich": {"const": "Space disabled"}, + "user": {"const": "Alice"} } } """ - Scenario Outline: get a notification about a space share in various languages + Scenario Outline: get in-app notification about a space share in various languages Given user "Brian" has switched the system language to "" using the Graph API When user "Brian" lists all notifications Then the HTTP status code should be "200" @@ -417,16 +171,9 @@ Feature: Notification """ { "type": "object", - "required": [ - "message" - ], + "required": ["message"], "properties": { - "message": { - "type": "string", - "enum": [ - "" - ] - } + "message": {"const": ""} } } """ @@ -436,7 +183,7 @@ Feature: Notification | es | Space compartido | Alice Hansen te añadió al Space notification checking | - Scenario: all notification related to space get deleted when the sharer deletes that resource + Scenario: in-app notifications related to space get deleted when the sharer deletes that resource Given user "Alice" has removed the access of user "Brian" from space "notification checking" And user "Alice" has disabled a space "notification checking" And user "Alice" has deleted a space "notification checking" @@ -444,10 +191,86 @@ Feature: Notification Then the HTTP status code should be "200" And the notifications should be empty - - Scenario: user doesn't get any notification after being removed from space + @email + Scenario: user doesn't get any notification after being removed from space(note: no mail notification) Given user "Alice" has removed the access of user "Brian" from space "notification checking" And user "Alice" has disabled a space "notification checking" When user "Brian" lists all notifications Then the HTTP status code should be "200" And there should be "2" notifications + And user "Brian" should have "2" emails + But user "Brian" should not have a notification related to space "notification checking" with subject "Space disabled" + + @email + Scenario: group members get in-app and email notifications when someone shares a project space with the group + Given the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API + And user "David" has been created with default attributes + And group "group1" has been created + And user "David" has been added to group "group1" + And user "Carol" has been added to group "group1" + And user "Alice" has created a space "NewSpace" with the default quota using the Graph API + When user "Alice" sends the following space share invitation using permissions endpoint of the Graph API: + | space | NewSpace | + | sharee | group1 | + | shareType | group | + | permissionsRole | Manager | + Then the HTTP status code should be "200" + And user "David" should get a notification with subject "Space shared" and message: + | message | + | Alice Hansen added you to Space NewSpace | + And user "Carol" should get a notification with subject "Space shared" and message: + | message | + | Alice Hansen added you to Space NewSpace | + And user "David" should have received the following email from user "Alice" about the share of project space "NewSpace" + """ + Hello David Lopez, + + %displayname% has invited you to join "NewSpace". + + Click here to view it: %base_url%/f/%space_id% + """ + And user "Carol" should have received the following email from user "Alice" about the share of project space "NewSpace" + """ + Hello Carol King, + + %displayname% has invited you to join "NewSpace". + + Click here to view it: %base_url%/f/%space_id% + """ + + @email + Scenario: group members get in-app and email notifications in their respective languages when someone shares a space with the group + Given the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API + And user "David" has been created with default attributes + And group "group1" has been created + And user "David" has been added to group "group1" + And user "Carol" has been added to group "group1" + And user "David" has switched the system language to "es" using the Graph API + And user "Carol" has switched the system language to "de" using the Graph API + And user "Alice" has created a space "new-space" with the default quota using the Graph API + When user "Alice" shares a space "new-space" with settings: + | shareWith | group1 | + | role | viewer | + Then the HTTP status code should be "200" + And user "David" should get a notification with subject "Space compartido" and message: + | message | + | Alice Hansen te añadió al Space new-space| + And user "Carol" should get a notification with subject "Space freigegeben" and message: + | message | + | Alice Hansen hat Sie zu Space new-space hinzugefügt | + And user "David" should have received the following email from user "Alice" about the share of project space "new-space" + """ + Hola David Lopez, + + Alice Hansen te ha invitado a unirte a "new-space". + + Click aquí para verlo: %base_url%/f/%space_id% + """ + And user "Carol" should have received the following email from user "Alice" about the share of project space "new-space" + """ + Hallo Carol King, + + Alice Hansen hat Sie eingeladen, dem Space "new-space" beizutreten. + + Zum Ansehen hier klicken: %base_url%/f/%space_id% + """