review addressed
This commit is contained in:
@@ -357,19 +357,17 @@ class CollaborationContext implements Context {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Then the app list response should contain the following information:
|
* @Then the app list response should contain the following template information for office :app:
|
||||||
*
|
*
|
||||||
|
* @param string $app
|
||||||
* @param TableNode $table
|
* @param TableNode $table
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
* @throws Exception
|
|
||||||
*/
|
*/
|
||||||
public function theAppListResponseShouldContainTheFollowingInformation(TableNode $table): void {
|
public function theAppListResponseShouldContainTheFollowingTemplateInformationForOffice(string $app, TableNode $table): void {
|
||||||
$responseArray = $this->featureContext->getJsonDecodedResponse($this->featureContext->getResponse());
|
$responseArray = $this->featureContext->getJsonDecodedResponse($this->featureContext->getResponse());
|
||||||
|
|
||||||
if (!isset($responseArray['mime-types'])) {
|
Assert::assertArrayHasKey("mime-types", $responseArray, "Expected 'mime-types' in the response but not found.\n" . print_r($responseArray, true));
|
||||||
throw new Exception(__METHOD__ . "The response does not contain a 'mime-types' key.");
|
|
||||||
}
|
|
||||||
|
|
||||||
$mimeTypes = $responseArray['mime-types'];
|
$mimeTypes = $responseArray['mime-types'];
|
||||||
|
|
||||||
@@ -379,44 +377,43 @@ class CollaborationContext implements Context {
|
|||||||
}
|
}
|
||||||
|
|
||||||
foreach ($table->getColumnsHash() as $row) {
|
foreach ($table->getColumnsHash() as $row) {
|
||||||
if (!isset($mimeTypeMap[$row['mimeType']])) {
|
Assert::assertArrayHasKey($row['mime-type'], $mimeTypeMap, "Expected mime-type '{$row['mime-type']}' to exist in the response but it doesn't.\n" . print_r($mimeTypeMap, true));
|
||||||
throw new Exception("Mime type '{$row['mimeType']}' not found in the response.");
|
|
||||||
|
$mimeType = $mimeTypeMap[$row['mime-type']];
|
||||||
|
$found = false;
|
||||||
|
|
||||||
|
foreach ($mimeType['app_providers'] as $provider) {
|
||||||
|
if ($provider['name'] === $app && isset($row['target-extension'])) {
|
||||||
|
Assert::assertSame(
|
||||||
|
$row['target-extension'],
|
||||||
|
$provider['target_ext'],
|
||||||
|
"Expected 'target_ext' for $app to be '{$row['target-extension']}' but found '{$provider['target_ext']}'"
|
||||||
|
);
|
||||||
|
$found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$mimeType = $mimeTypeMap[$row['mimeType']];
|
if (!$found) {
|
||||||
foreach ($mimeType['app_providers'] as $provider) {
|
Assert::fail(
|
||||||
if ($provider['name'] === 'OnlyOffice' && $row['onlyOffice']) {
|
"Expected response to contain app-provider '$app' with target-extension '{$row['target-extension']}' for mime-type '{$row['mime-type']}', but no matching provider was found.\n" .
|
||||||
Assert::assertSame(
|
"App Providers Found: " . print_r($mimeType['app_providers'], true)
|
||||||
$row['onlyOffice'],
|
);
|
||||||
$provider['target_ext'],
|
|
||||||
"Expected target_ext for OnlyOffice in mimeType '{$row['onlyOffice']} but found '{$provider['target_ext']}"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if ($provider['name'] === 'Collabora' && $row['collabora']) {
|
|
||||||
Assert::assertSame(
|
|
||||||
$row['collabora'],
|
|
||||||
$provider['target_ext'],
|
|
||||||
"Expected target_ext for Collabora in mimeType '{$row['collabora']} but found '{$provider['target_ext']}"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @When user :user has created a file :file in space :space using wopi endpoint
|
* @When user :user has created a file :file using wopi endpoint
|
||||||
*
|
*
|
||||||
* @param string $user
|
* @param string $user
|
||||||
* @param string $file
|
* @param string $file
|
||||||
* @param string $space
|
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
* @throws GuzzleException
|
* @throws GuzzleException
|
||||||
*/
|
*/
|
||||||
public function userHasCreatedAFileInSpaceUsingWopiEndpoint(string $user, string $file, string $space):string {
|
public function userHasCreatedAFileInSpaceUsingWopiEndpoint(string $user, string $file):string {
|
||||||
$spaceId = $this->spacesContext->getSpaceIdByName($user, $space);
|
$parentContainerId = $this->featureContext->getFileIdForPath($user, "/");
|
||||||
$splitSpaceId = explode('$', $spaceId);
|
|
||||||
$parentContainerId = $splitSpaceId[0] . '$' . $splitSpaceId[1] . '!' . $splitSpaceId[1];
|
|
||||||
$response = CollaborationHelper::createFile(
|
$response = CollaborationHelper::createFile(
|
||||||
$this->featureContext->getBaseUrl(),
|
$this->featureContext->getBaseUrl(),
|
||||||
$this->featureContext->getStepLineRef(),
|
$this->featureContext->getStepLineRef(),
|
||||||
@@ -426,8 +423,7 @@ class CollaborationContext implements Context {
|
|||||||
$file
|
$file
|
||||||
);
|
);
|
||||||
$this->featureContext->theHTTPStatusCodeShouldBe(200, "", $response);
|
$this->featureContext->theHTTPStatusCodeShouldBe(200, "", $response);
|
||||||
$decodedResponse = json_decode($response->getBody()->getContents(), true);
|
$decodedResponse[] = $this->featureContext->getJsonDecodedResponseBodyContent($response);
|
||||||
return $decodedResponse['file_id'];
|
return $decodedResponse[0]->file_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1864,17 +1864,22 @@ Feature: check file info with different wopi apps
|
|||||||
| application/octet-stream |
|
| application/octet-stream |
|
||||||
|
|
||||||
|
|
||||||
Scenario: check that '/app/list' contain WebOffice template
|
Scenario: check target extensions for template mime types
|
||||||
When user "Alice" sends HTTP method "GET" to URL "/app/list"
|
When user "Alice" sends HTTP method "GET" to URL "/app/list"
|
||||||
Then the HTTP status code should be "200"
|
Then the HTTP status code should be "200"
|
||||||
And the app list response should contain the following information:
|
And the app list response should contain the following template information for office "OnlyOffice":
|
||||||
| mimeType | onlyOffice | collabora |
|
| mime-type | target-extension |
|
||||||
| application/vnd.ms-powerpoint.template.macroenabled.12 | pptx | |
|
| application/vnd.oasis.opendocument.spreadsheet-template | xlsx |
|
||||||
| application/vnd.oasis.opendocument.presentation-template | pptx | odp |
|
| application/vnd.oasis.opendocument.text-template | docx |
|
||||||
| application/vnd.openxmlformats-officedocument.spreadsheetml.template | xlsx | |
|
| application/vnd.oasis.opendocument.presentation-template | pptx |
|
||||||
| application/vnd.oasis.opendocument.spreadsheet-template | xlsx | ods |
|
| application/vnd.openxmlformats-officedocument.spreadsheetml.template | xlsx |
|
||||||
| application/vnd.openxmlformats-officedocument.presentationml.template | pptx | |
|
| application/vnd.openxmlformats-officedocument.presentationml.template | pptx |
|
||||||
| application/vnd.openxmlformats-officedocument.wordprocessingml.template | docx | |
|
| application/vnd.openxmlformats-officedocument.wordprocessingml.template | docx |
|
||||||
| application/vnd.ms-word.template.macroenabled.12 | docx | |
|
| application/vnd.ms-word.template.macroenabled.12 | docx |
|
||||||
| application/vnd.oasis.opendocument.text-template | docx | odt |
|
| application/vnd.ms-powerpoint.template.macroenabled.12 | pptx |
|
||||||
| application/vnd.ms-excel.template.macroenabled.12 | xlsx | |
|
| application/vnd.ms-excel.template.macroenabled.12 | xlsx |
|
||||||
|
And the app list response should contain the following template information for office "Collabora":
|
||||||
|
| mime-type | target-extension |
|
||||||
|
| application/vnd.oasis.opendocument.spreadsheet-template | ods |
|
||||||
|
| application/vnd.oasis.opendocument.text-template | odt |
|
||||||
|
| application/vnd.oasis.opendocument.presentation-template | odp |
|
||||||
|
|||||||
@@ -1082,10 +1082,11 @@ Feature: collaboration (wopi)
|
|||||||
| simple.odt |
|
| simple.odt |
|
||||||
|
|
||||||
|
|
||||||
Scenario Outline: open file with .potx extension and template
|
Scenario Outline: create a file using a template
|
||||||
Given user "Alice" has uploaded file "filesForUpload/template.xltx" to "template.xltx"
|
Given using spaces DAV path
|
||||||
|
And user "Alice" has uploaded file "filesForUpload/<template>" to "<template>"
|
||||||
And we save it into "TEMPLATEID"
|
And we save it into "TEMPLATEID"
|
||||||
And user "Alice" has created a file "template.pptx" in space "Personal" using wopi endpoint
|
And user "Alice" has created a file "<target>" using wopi endpoint
|
||||||
And we save it into "FILEID"
|
And we save it into "FILEID"
|
||||||
When user "Alice" sends HTTP method "POST" to URL "<app-endpoint>"
|
When user "Alice" sends HTTP method "POST" to URL "<app-endpoint>"
|
||||||
Then the HTTP status code should be "200"
|
Then the HTTP status code should be "200"
|
||||||
@@ -1125,6 +1126,6 @@ Feature: collaboration (wopi)
|
|||||||
}
|
}
|
||||||
"""
|
"""
|
||||||
Examples:
|
Examples:
|
||||||
| app-endpoint |
|
| app-endpoint | template | target |
|
||||||
| /app/open?file_id=<<FILEID>>&app_name=Collabora&view_mode=write&template_id=<<TEMPLATEID>> |
|
| /app/open?file_id=<<FILEID>>&app_name=Collabora&view_mode=write&template_id=<<TEMPLATEID>> | template.ott | template.odt |
|
||||||
| /app/open?file_id=<<FILEID>>&app_name=OnlyOffice&view_mode=write&template_id=<<TEMPLATEID>> |
|
| /app/open?file_id=<<FILEID>>&app_name=OnlyOffice&view_mode=write&template_id=<<TEMPLATEID>> | template.dotx | template.docx |
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user