From 6cd4fffc83d7e048587e96e11f2a5ede9e642d63 Mon Sep 17 00:00:00 2001 From: Prarup Gurung Date: Fri, 3 May 2024 12:47:35 +0545 Subject: [PATCH] search.feature: Used sharingNG for sharing in given step --- .../features/apiSearch1/search.feature | 52 +++++++++++-------- .../features/bootstrap/SharingNgContext.php | 23 ++++++++ 2 files changed, 54 insertions(+), 21 deletions(-) diff --git a/tests/acceptance/features/apiSearch1/search.feature b/tests/acceptance/features/apiSearch1/search.feature index 92ffe3fbe..6d076aeb7 100644 --- a/tests/acceptance/features/apiSearch1/search.feature +++ b/tests/acceptance/features/apiSearch1/search.feature @@ -35,10 +35,12 @@ Feature: Search Scenario Outline: user can search items from the shares Given using DAV path - And user "Alice" has created a share inside of space "project101" with settings: - | path | folderMain | - | shareWith | Brian | - | role | viewer | + And user "Alice" has sent the following share invitation: + | resource | folderMain | + | space | project101 | + | sharee | Brian | + | shareType | user | + | permissionsRole | Viewer | When user "Brian" searches for "*folder*" using the WebDAV API Then the HTTP status code should be "207" And the search result should contain "4" entries @@ -72,10 +74,12 @@ Feature: Search Scenario Outline: user cannot search pending share Given user "Brian" has disabled auto-accepting And using DAV path - And user "Alice" has created a share inside of space "project101" with settings: - | path | folderMain | - | shareWith | Brian | - | role | viewer | + And user "Alice" has sent the following share invitation: + | resource | folderMain | + | space | project101 | + | sharee | Brian | + | shareType | user | + | permissionsRole | Viewer | When user "Brian" searches for "*folder*" using the WebDAV API Then the HTTP status code should be "207" And the search result should contain "0" entries @@ -92,11 +96,13 @@ Feature: Search Scenario Outline: user cannot search declined share Given using DAV path - And user "Alice" has created a share inside of space "project101" with settings: - | path | folderMain | - | shareWith | Brian | - | role | viewer | - And user "Brian" has declined share "/Shares/folderMain" offered by user "Alice" + And user "Alice" has sent the following share invitation: + | resource | folderMain | + | space | project101 | + | sharee | Brian | + | shareType | user | + | permissionsRole | Viewer | + And user "Brian" has disabled sync of last shared resource When user "Brian" searches for "*folder*" using the WebDAV API Then the HTTP status code should be "207" And the search result should contain "0" entries @@ -157,10 +163,12 @@ Feature: Search Scenario Outline: search inside folder in shares Given using DAV path - And user "Alice" has created a share inside of space "project101" with settings: - | path | folderMain | - | shareWith | Brian | - | role | viewer | + And user "Alice" has sent the following share invitation: + | resource | folderMain | + | space | project101 | + | sharee | Brian | + | shareType | user | + | permissionsRole | Viewer | When user "Brian" searches for "*folder*" inside folder "/folderMain" in space "Shares" using the WebDAV API Then the HTTP status code should be "207" And the search result of user "Brian" should contain only these entries: @@ -238,10 +246,12 @@ Feature: Search Given using DAV path And user "Alice" has created a folder "foo/sharedToBrian" in space "Alice Hansen" And user "Alice" has created a folder "sharedToCarol" in space "Alice Hansen" - And user "Alice" has created a share inside of space "Alice Hansen" with settings: - | path | foo | - | shareWith | Brian | - | role | viewer | + And user "Alice" has sent the following share invitation: + | resource | foo | + | space | Personal | + | sharee | Brian | + | shareType | user | + | permissionsRole | Viewer | When user "Brian" searches for "shared*" using the WebDAV API Then the HTTP status code should be "207" And the search result of user "Brian" should contain these entries: diff --git a/tests/acceptance/features/bootstrap/SharingNgContext.php b/tests/acceptance/features/bootstrap/SharingNgContext.php index 4acae4e6c..fe91c8ffb 100644 --- a/tests/acceptance/features/bootstrap/SharingNgContext.php +++ b/tests/acceptance/features/bootstrap/SharingNgContext.php @@ -727,6 +727,29 @@ class SharingNgContext implements Context { Assert::assertSame($should, $fileFound, $assertMessage); } + /** + * @Given user :user has disabled sync of last shared resource + * + * @param string $user + * + * @return void + * @throws Exception|GuzzleException + */ + public function userHasDisabledSyncOfLastSharedResource(string $user):void { + $shareItemId = $this->featureContext->shareNgGetLastCreatedUserGroupShareID(); + $shareSpaceId = FeatureContext::SHARES_SPACE_ID; + $itemId = $shareSpaceId . '!' . $shareItemId; + $response = GraphHelper::disableShareSync( + $this->featureContext->getBaseUrl(), + $this->featureContext->getStepLineRef(), + $this->featureContext->getActualUsername($user), + $this->featureContext->getPasswordForUser($user), + $itemId, + $shareSpaceId, + ); + $this->featureContext->theHTTPStatusCodeShouldBe(204, __METHOD__ . " could not disable sync of last share", $response); + } + /** * @When user :user disables sync of share :share using the Graph API *