Skip to content

Commit

Permalink
test: add test for opening opendocument file with web using collabora…
Browse files Browse the repository at this point in the history
…tion app
  • Loading branch information
anon-pradip committed Aug 28, 2024
1 parent 43bc43b commit 10009fc
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tests/acceptance/TestHelpers/GraphHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,14 @@ public static function isUUIDv4(string $id): bool {
return (bool)preg_match($regex, $id);
}

/**
*
* @return string
*/
public static function getFileUUIDv4Regex(): string {
return self::getUUIDv4Regex() . '%24' . self::getUUIDv4Regex() . '%21' . self::getUUIDv4Regex();
}

/**
* @param string $spaceId
*
Expand Down
8 changes: 8 additions & 0 deletions tests/acceptance/bootstrap/FeatureContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -2317,6 +2317,14 @@ public function substituteInLineCodes(
"getUUIDv4Regex"
],
"parameter" => []
],
[
"code" => "%file_uuidv4_pattern%",
"function" => [
__NAMESPACE__ . '\TestHelpers\GraphHelper',
"getFileUUIDv4Regex"
],
"parameter" => []
]
];
if ($user !== null) {
Expand Down
27 changes: 27 additions & 0 deletions tests/acceptance/features/apiCollaboration/wopi.feature
Original file line number Diff line number Diff line change
Expand Up @@ -118,3 +118,30 @@ Feature: collaboration (wopi)
}
}
"""


Scenario Outline: open file with .odt extension in web
Given user "Alice" has uploaded file "filesForUpload/simple.odt" to "simple.odt"
And we save it into "FILEID"
When user "Alice" sends HTTP method "POST" to URL "<app-endpoint>"
Then the HTTP status code should be "200"
And the JSON data of the response should match
"""
{
"type": "object",
"required": [
"uri"
],
"properties": {
"uri": {
"type": "string",
"pattern": "^.*?contextRouteName=files-spaces-personal&fileId=%file_uuidv4_pattern%$"
}
}
}
"""

Examples:
| app-endpoint |
| /app/open-with-web?file_id=<<FILEID>>&app_name=FakeOffice |
| /app/open-with-web?file_id=<<FILEID>> |

0 comments on commit 10009fc

Please sign in to comment.