diff --git a/docs/ocis/development/testing.md b/docs/ocis/development/testing.md index 4fe6737d8..163b3c606 100644 --- a/docs/ocis/development/testing.md +++ b/docs/ocis/development/testing.md @@ -362,6 +362,7 @@ PROXY_ENABLE_BASIC_AUTH=true \ NOTIFICATIONS_SMTP_HOST=localhost \ NOTIFICATIONS_SMTP_PORT=2500 \ NOTIFICATIONS_SMTP_INSECURE=true \ +NOTIFICATIONS_SMTP_SENDER="owncloud " \ ocis/bin/ocis server ``` diff --git a/tests/acceptance/config/behat.yml b/tests/acceptance/config/behat.yml index 0edd5481d..51822ada3 100644 --- a/tests/acceptance/config/behat.yml +++ b/tests/acceptance/config/behat.yml @@ -198,6 +198,7 @@ default: - FilesVersionsContext: - SettingsContext: - OcisConfigContext: + - SharingNgContext: apiAntivirus: paths: diff --git a/tests/acceptance/docker/src/ocis-base.yml b/tests/acceptance/docker/src/ocis-base.yml index 7c4f08930..0407639b4 100644 --- a/tests/acceptance/docker/src/ocis-base.yml +++ b/tests/acceptance/docker/src/ocis-base.yml @@ -35,6 +35,7 @@ services: NOTIFICATIONS_SMTP_HOST: email NOTIFICATIONS_SMTP_PORT: 2500 NOTIFICATIONS_SMTP_INSECURE: "true" + NOTIFICATIONS_SMTP_SENDER: "owncloud " # antivirus ANTIVIRUS_SCANNER_TYPE: "clamav" diff --git a/tests/acceptance/features/apiNotification/deleteNotification.feature b/tests/acceptance/features/apiNotification/deleteNotification.feature index de7268e61..eb63e1a3e 100644 --- a/tests/acceptance/features/apiNotification/deleteNotification.feature +++ b/tests/acceptance/features/apiNotification/deleteNotification.feature @@ -10,8 +10,18 @@ Feature: Delete notification | Brian | And user "Alice" has uploaded file with content "other data" to "/textfile1.txt" And user "Alice" has created folder "my_data" - And user "Alice" has shared folder "my_data" with user "Brian" - And user "Alice" has shared file "/textfile1.txt" with user "Brian" + And user "Alice" has sent the following resource share invitation: + | resource | my_data | + | space | Personal | + | sharee | Brian | + | shareType | user | + | permissionsRole | Viewer | + And user "Alice" has sent the following resource share invitation: + | resource | textfile1.txt | + | space | Personal | + | sharee | Brian | + | shareType | user | + | permissionsRole | Viewer | Scenario: delete a notification diff --git a/tests/acceptance/features/apiNotification/emailNotification.feature b/tests/acceptance/features/apiNotification/emailNotification.feature index b8c1bf5a7..586f0abc9 100644 --- a/tests/acceptance/features/apiNotification/emailNotification.feature +++ b/tests/acceptance/features/apiNotification/emailNotification.feature @@ -165,9 +165,11 @@ Feature: Email notification 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 shared a space "new-space" with settings: - | shareWith | Brian | - | role | editor | + 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" diff --git a/tests/acceptance/features/apiNotification/notification.feature b/tests/acceptance/features/apiNotification/notification.feature index 087bf0d35..eeb736303 100644 --- a/tests/acceptance/features/apiNotification/notification.feature +++ b/tests/acceptance/features/apiNotification/notification.feature @@ -14,7 +14,12 @@ Feature: Notification Scenario Outline: user gets a notification of resource sharing - Given user "Alice" has shared entry "" with user "Brian" + Given user "Alice" has sent the following resource share invitation: + | resource | | + | space | Personal | + | sharee | Brian | + | shareType | user | + | permissionsRole | Viewer | 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 shared" and the message-details should match @@ -127,8 +132,13 @@ Feature: Notification Scenario Outline: user gets a notification of unsharing resource - Given user "Alice" has shared entry "" with user "Brian" - And user "Alice" has unshared entity "" shared to "Brian" + 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 @@ -242,7 +252,12 @@ Feature: Notification Scenario Outline: get a notification about a file share in various languages Given user "Brian" has switched the system language to "" using the API - And user "Alice" has shared entry "textfile1.txt" with user "Brian" + And user "Alice" has sent the following resource share invitation: + | resource | textfile1.txt | + | space | Personal | + | sharee | Brian | + | shareType | user | + | permissionsRole | Viewer | 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 "" and the message-details should match @@ -272,7 +287,12 @@ Feature: Notification @env-config Scenario: get a notification about a file share in default languages Given the config "OCIS_DEFAULT_LANGUAGE" has been set to "de" - And user "Alice" has shared entry "textfile1.txt" with user "Brian" + And user "Alice" has sent the following resource share invitation: + | resource | textfile1.txt | + | space | Personal | + | sharee | Brian | + | shareType | user | + | permissionsRole | Viewer | 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 "Neue Freigabe" and the message-details should match @@ -295,8 +315,13 @@ Feature: Notification Scenario Outline: notifications related to a resource get deleted when the resource is deleted - Given user "Alice" has shared entry "" with user "Brian" - And user "Alice" has unshared entity "" shared to "Brian" + 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" And user "Alice" has deleted entity "/" When user "Brian" lists all notifications Then the HTTP status code should be "200" diff --git a/tests/acceptance/features/apiNotification/spaceNotification.feature b/tests/acceptance/features/apiNotification/spaceNotification.feature index b9de72f40..7383ae850 100644 --- a/tests/acceptance/features/apiNotification/spaceNotification.feature +++ b/tests/acceptance/features/apiNotification/spaceNotification.feature @@ -11,12 +11,14 @@ Feature: Notification | Carol | And the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API And user "Alice" has created a space "notification checking" with the default quota using the Graph API + And user "Alice" has sent the following space share invitation: + | space | notification checking | + | sharee | Brian | + | shareType | user | + | permissionsRole | Space Editor | Scenario: get a notification of space shared - Given user "Alice" has shared a space "notification checking" with settings: - | shareWith | Brian | - | role | editor | 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 @@ -146,10 +148,7 @@ Feature: Notification Scenario: get a notification of space unshared - Given user "Alice" has shared a space "notification checking" with settings: - | shareWith | Brian | - | role | editor | - And user "Alice" has unshared a space "notification checking" shared with "Brian" + 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 @@ -279,10 +278,7 @@ Feature: Notification Scenario: get a notification of space disabled - Given user "Alice" has shared a space "notification checking" with settings: - | shareWith | Brian | - | role | editor | - And user "Alice" has disabled a space "notification checking" + Given 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 @@ -414,9 +410,6 @@ Feature: Notification Scenario Outline: get a notification about a space share in various languages Given user "Brian" has switched the system language to "" using the Graph API - And user "Alice" has shared a space "notification checking" with settings: - | shareWith | Brian | - | role | editor | 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 "" and the message-details should match @@ -443,10 +436,7 @@ Feature: Notification Scenario: all notification related to space get deleted when the sharer deletes that resource - Given user "Alice" has shared a space "notification checking" with settings: - | shareWith | Brian | - | role | editor | - And user "Alice" has unshared a space "notification checking" shared with "Brian" + 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" When user "Brian" lists all notifications @@ -455,10 +445,7 @@ Feature: Notification Scenario: user doesn't get any notification after being removed from space - Given user "Alice" has shared a space "notification checking" with settings: - | shareWith | Brian | - | role | editor | - And user "Alice" has unshared a space "notification checking" shared with "Brian" + 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" diff --git a/tests/acceptance/features/bootstrap/SharingNgContext.php b/tests/acceptance/features/bootstrap/SharingNgContext.php index 1fc329166..b375f7eb6 100644 --- a/tests/acceptance/features/bootstrap/SharingNgContext.php +++ b/tests/acceptance/features/bootstrap/SharingNgContext.php @@ -765,6 +765,30 @@ class SharingNgContext implements Context { ); } + /** + * @Given /^user "([^"]*)" has removed the access of (user|group) "([^"]*)" from (?:file|folder|resource) "([^"]*)" of space "([^"]*)"$/ + * + * @param string $sharer + * @param string $recipientType (user|group) + * @param string $recipient can be both user or group + * @param string $resource + * @param string $space + * + * @return void + * @throws JsonException + * @throws GuzzleException + */ + public function userHasRemovedAccessOfUserOrGroupFromResourceOfSpace( + string $sharer, + string $recipientType, + string $recipient, + string $resource, + string $space + ): void { + $response = $this->removeAccessToSpaceItem($sharer, $recipientType, $space, $resource); + $this->featureContext->theHTTPStatusCodeShouldBe(204, "", $response); + } + /** * @When /^user "([^"]*)" removes the access of (user|group) "([^"]*)" from (?:file|folder|resource) "([^"]*)" of space "([^"]*)" using the Graph API$/ *