search.feature: Used sharingNG for sharing in given step

This commit is contained in:
Prarup Gurung
2024-05-03 12:47:35 +05:45
parent 1f114d66a6
commit 6cd4fffc83
2 changed files with 54 additions and 21 deletions
@@ -35,10 +35,12 @@ Feature: Search
Scenario Outline: user can search items from the shares Scenario Outline: user can search items from the shares
Given using <dav-path-version> DAV path Given using <dav-path-version> DAV path
And user "Alice" has created a share inside of space "project101" with settings: And user "Alice" has sent the following share invitation:
| path | folderMain | | resource | folderMain |
| shareWith | Brian | | space | project101 |
| role | viewer | | sharee | Brian |
| shareType | user |
| permissionsRole | Viewer |
When user "Brian" searches for "*folder*" using the WebDAV API When user "Brian" searches for "*folder*" using the WebDAV API
Then the HTTP status code should be "207" Then the HTTP status code should be "207"
And the search result should contain "4" entries And the search result should contain "4" entries
@@ -72,10 +74,12 @@ Feature: Search
Scenario Outline: user cannot search pending share Scenario Outline: user cannot search pending share
Given user "Brian" has disabled auto-accepting Given user "Brian" has disabled auto-accepting
And using <dav-path-version> DAV path And using <dav-path-version> DAV path
And user "Alice" has created a share inside of space "project101" with settings: And user "Alice" has sent the following share invitation:
| path | folderMain | | resource | folderMain |
| shareWith | Brian | | space | project101 |
| role | viewer | | sharee | Brian |
| shareType | user |
| permissionsRole | Viewer |
When user "Brian" searches for "*folder*" using the WebDAV API When user "Brian" searches for "*folder*" using the WebDAV API
Then the HTTP status code should be "207" Then the HTTP status code should be "207"
And the search result should contain "0" entries And the search result should contain "0" entries
@@ -92,11 +96,13 @@ Feature: Search
Scenario Outline: user cannot search declined share Scenario Outline: user cannot search declined share
Given using <dav-path-version> DAV path Given using <dav-path-version> DAV path
And user "Alice" has created a share inside of space "project101" with settings: And user "Alice" has sent the following share invitation:
| path | folderMain | | resource | folderMain |
| shareWith | Brian | | space | project101 |
| role | viewer | | sharee | Brian |
And user "Brian" has declined share "/Shares/folderMain" offered by user "Alice" | shareType | user |
| permissionsRole | Viewer |
And user "Brian" has disabled sync of last shared resource
When user "Brian" searches for "*folder*" using the WebDAV API When user "Brian" searches for "*folder*" using the WebDAV API
Then the HTTP status code should be "207" Then the HTTP status code should be "207"
And the search result should contain "0" entries And the search result should contain "0" entries
@@ -157,10 +163,12 @@ Feature: Search
Scenario Outline: search inside folder in shares Scenario Outline: search inside folder in shares
Given using <dav-path-version> DAV path Given using <dav-path-version> DAV path
And user "Alice" has created a share inside of space "project101" with settings: And user "Alice" has sent the following share invitation:
| path | folderMain | | resource | folderMain |
| shareWith | Brian | | space | project101 |
| role | viewer | | sharee | Brian |
| shareType | user |
| permissionsRole | Viewer |
When user "Brian" searches for "*folder*" inside folder "/folderMain" in space "Shares" using the WebDAV API When user "Brian" searches for "*folder*" inside folder "/folderMain" in space "Shares" using the WebDAV API
Then the HTTP status code should be "207" Then the HTTP status code should be "207"
And the search result of user "Brian" should contain only these entries: And the search result of user "Brian" should contain only these entries:
@@ -238,10 +246,12 @@ Feature: Search
Given using <dav-path-version> DAV path Given using <dav-path-version> DAV path
And user "Alice" has created a folder "foo/sharedToBrian" in space "Alice Hansen" 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 folder "sharedToCarol" in space "Alice Hansen"
And user "Alice" has created a share inside of space "Alice Hansen" with settings: And user "Alice" has sent the following share invitation:
| path | foo | | resource | foo |
| shareWith | Brian | | space | Personal |
| role | viewer | | sharee | Brian |
| shareType | user |
| permissionsRole | Viewer |
When user "Brian" searches for "shared*" using the WebDAV API When user "Brian" searches for "shared*" using the WebDAV API
Then the HTTP status code should be "207" Then the HTTP status code should be "207"
And the search result of user "Brian" should contain these entries: And the search result of user "Brian" should contain these entries:
@@ -727,6 +727,29 @@ class SharingNgContext implements Context {
Assert::assertSame($should, $fileFound, $assertMessage); 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 * @When user :user disables sync of share :share using the Graph API
* *