Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[tests-only][full-ci] add test to check api activities with sort filter #10235

Merged
merged 1 commit into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion tests/acceptance/bootstrap/GraphContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -2935,7 +2935,7 @@ public function thePublicTriesToCheckTheActivitiesOfResourceFromSpaceOwnedByUser
}

/**
* @When /^user "([^"]*)" lists the activities of (?:folder|file) "([^"]*)" from space "([^"]*)" with (depth|limit) "([^"]*)" 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
Expand All @@ -2958,6 +2958,26 @@ public function userListsTheActivitiesForFolderOfSpaceWithDepthOrLimitUsingTheGr
$this->featureContext->setResponse($response);
}

/**
* @Then the activities should be in the following order:
*
* @param TableNode $table
*
* @return void
* @throws Exception
*/
public function theActivitiesShouldBeInTheFollowingOrder(TableNode $table): void {
$responseBody = $this->featureContext->getJsonDecodedResponseBodyContent();
$activities = $responseBody->value;

foreach ($table->getHash() as $index => $expectedValue) {
$actualActivity = $activities[$index];
$expectedActivity = $expectedValue['resource'] . ":" . $expectedValue['message'];
$actualActivity = $actualActivity->template->variables->resource->name . ":" . $actualActivity->template->message;
Assert::assertEquals($expectedActivity, $actualActivity, "Activity didn't match");
}
}

/**
* @When the administrator gets federated users using the Graph API
* @When user :user tries to get federated users using the Graph API
Expand Down
20 changes: 20 additions & 0 deletions tests/acceptance/features/apiActivities/activities.feature
Original file line number Diff line number Diff line change
Expand Up @@ -2134,6 +2134,26 @@ Feature: check activities
}
"""


Scenario: check activity with sort filter
Given user "Alice" has created folder "/New Folder"
And user "Alice" has uploaded file with content "ownCloud test text file 0" to "/New Folder/textfile.txt"
And user "Alice" has uploaded file with content "updated ownCloud test text file" to "/New Folder/textfile.txt"
When user "Alice" lists the activities of folder "New Folder" from space "Personal" with 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} |
| textfile.txt | {user} added {resource} to {folder} |
| textfile.txt | {user} updated {resource} in {folder} |
When user "Alice" lists the activities of folder "New Folder" from space "Personal" with 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} |
| New Folder | {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
Expand Down