add test to open file with collaboration app

This commit is contained in:
Prajwol Amatya
2024-08-23 11:36:51 +05:45
parent 330952733b
commit c0173c3ebf
3 changed files with 13 additions and 25 deletions
@@ -1,10 +1,14 @@
Feature: App Provider
As a user
I want to access files with collaboration service apps
So that I can get the content of the file
Scenario: open file with Collabora
Scenario Outline: open file with .odt extension with collaboration app
Given user "Alice" has been created with default attributes and without skeleton files
And user "Alice" has uploaded file "filesForUpload/simple.odt" to "simple.odt"
When user "Alice" opens file "simple.odt" with collaboration service
And we save it into "FILEID"
When user "Alice" sends HTTP method "POST" to URL "<endpoint>"
Then the HTTP status code should be "200"
And the JSON data of the response should match
"""
@@ -18,7 +22,7 @@ Feature: App Provider
"properties": {
"app_url": {
"type": "string",
"pattern": "^https:\\/\\/host\\.docker\\.internal:9980\\/browser\\/8ec5fda\\/cool\\.html\\?WOPISrc=https%3A%2F%2Fhost\\.docker\\.internal%3A9300%2Fwopi%2Ffiles%2F[a-fA-F0-9]{64}$"
"pattern": "^https:\\/\\/fakeoffice\\.owncloud\\.test\\/not\\/relevant\\?WOPISrc=http%3A%2F%2Fwopiserver%3A9300%2Fwopi%2Ffiles%2F[a-fA-F0-9]{64}$"
},
"method": {
"const": "POST"
@@ -41,3 +45,7 @@ Feature: App Provider
}
}
"""
Examples:
| endpoint |
| /app/open?file_id=<<FILEID>>&app_name=FakeOffice |
| /app/open?file_id=<<FILEID>> |
@@ -4131,25 +4131,4 @@ class SpacesContext implements Context {
)
);
}
/**
* @When user :user opens file :filename with collaboration service
*
* @param string $user
* @param string $filename
*
* @return void
*/
public function userOpensFileWithCollaborationService(string $user, string $filename): void {
$fileId = $this->getFileId($user, "Personal", $filename);
$url = $this->featureContext->getBaseUrl() . "/app/open?file_id=$fileId&app_name=FakeOffice";
$this->featureContext->setResponse(
HttpRequestHelper::post(
$url,
$this->featureContext->getStepLineRef(),
$user,
$this->featureContext->getPasswordForUser($user)
)
);
}
}
@@ -1745,13 +1745,14 @@ trait WebDav {
*
* @return void
*/
public function userHasUploadedAFileTo(string $user, string $source, string $destination):void {
public function userHasUploadedAFileTo(string $user, string $source, string $destination):array {
$response = $this->uploadFile($user, $source, $destination, true);
$this->theHTTPStatusCodeShouldBe(
["201", "204"],
"HTTP status code was not 201 or 204 while trying to upload file '$source' to '$destination' for user '$user'",
$response
);
return $response->getHeader('oc-fileid');
}
/**