diff --git a/tests/acceptance/bootstrap/GraphContext.php b/tests/acceptance/bootstrap/GraphContext.php index 0eb0dde09..e6db73a4b 100644 --- a/tests/acceptance/bootstrap/GraphContext.php +++ b/tests/acceptance/bootstrap/GraphContext.php @@ -2805,7 +2805,7 @@ class GraphContext implements Context { } /** - * @When /^user "([^"]*)" lists the activities of (?:folder|file) "([^"]*)" from space "([^"]*)" using the Graph API/ + * @When /^user "([^"]*)" lists the activities of (?:folder|file) "([^"]*)" from space "([^"]*)" using the Graph API$/ * * @param string $user * @param string $resource @@ -2936,7 +2936,7 @@ class GraphContext implements Context { } /** - * @When /^user "([^"]*)" lists the activities of (?:folder|file) "([^"]*)" from space "([^"]*)" with (depth|limit|sort) "([^"]*)" using the Graph API/ + * @When /^user "([^"]*)" lists the activities of (?:folder|file) "([^"]*)" from space "([^"]*)" with (depth|limit|sort) "([^"]*)" using the Graph API$/ * * @param string $user * @param string $resource @@ -2979,6 +2979,39 @@ class GraphContext implements Context { } } + /** + * @When /^user "([^"]*)" lists the activities of (?:folder|file) "([^"]*)" from space "([^"]*)" with (depth|limit) "([^"]*)" and sort "(asc|desc)" using the Graph API$/ + * + * @param string $user + * @param string $resource + * @param string $spaceName + * @param string $filterType + * @param string $filterValue + * @param string $sortType + * + * @return void + * @throws GuzzleException + */ + public function userListsTheActivitiesOfResourceFromSpaceWithDepthOrLimitAndSortUsingTheGraphApi( + string $user, + string $resource, + string $spaceName, + string $filterType, + string $filterValue, + string $sortType + ): void { + $resourceId = $this->spacesContext->getResourceId($user, $spaceName, $resource); + $response = GraphHelper::getActivities( + $this->featureContext->getBaseUrl(), + $this->featureContext->getStepLineRef(), + $user, + $this->featureContext->getPasswordForUser($user), + $resourceId, + [$filterType => $filterValue, 'sort' => $sortType], + ); + $this->featureContext->setResponse($response); + } + /** * @When the administrator gets federated users using the Graph API * @When user :user tries to get federated users using the Graph API diff --git a/tests/acceptance/features/apiActivities/activities.feature b/tests/acceptance/features/apiActivities/activities.feature index c1066229a..2bb5a1eb4 100644 --- a/tests/acceptance/features/apiActivities/activities.feature +++ b/tests/acceptance/features/apiActivities/activities.feature @@ -2154,6 +2154,25 @@ Feature: check activities | textfile.txt | {user} added {resource} to {folder} | | New Folder | {user} added {resource} to {folder} | + @issue-10150 + Scenario: check activities with limit and sort filters (asc/desc) + Given user "Alice" has created folder "/New Folder" + And user "Alice" has created folder "/New Folder/Sub Folder" + And user "Alice" has uploaded file with content "ownCloud test text file 0" to "/New Folder/Sub Folder/textfile.txt" + And user "Alice" has uploaded file with content "updated ownCloud test text file 0" to "/New Folder/Sub Folder/textfile.txt" + When user "Alice" lists the activities of folder "New Folder" from space "Personal" with limit "2" and sort "asc" using the Graph API + Then the HTTP status code should be "200" + And the activities should be in the following order: + | resource | message | + | New Folder | {user} added {resource} to {folder} | + | Sub Folder | {user} added {resource} to {folder} | + When user "Alice" lists the activities of folder "New Folder" from space "Personal" with limit "2" and sort "desc" using the Graph API + Then the HTTP status code should be "200" + And the activities should be in the following order: + | resource | message | + | textfile.txt | {user} updated {resource} in {folder} | + | textfile.txt | {user} added {resource} to {folder} | + @issue-9860 Scenario: user tries to check activities of another user's file Given user "Brian" has been created with default attributes and without skeleton files