address review

This commit is contained in:
amrita
2024-09-23 11:19:06 +05:45
parent 0568224192
commit 16db9dd5cf
2 changed files with 41 additions and 41 deletions

View File

@@ -34,7 +34,7 @@ use TestHelpers\CollaborationHelper;
class CollaborationContext implements Context {
private FeatureContext $featureContext;
private SpacesContext $spacesContext;
private string $storeLastAppEndpointResponse;
private string $lastAppOpenData;
/**
* This will run before EVERY scenario.
@@ -55,19 +55,19 @@ class CollaborationContext implements Context {
}
/**
* @param string $appData
* @param string $data
*
* @return void
*/
public function storeLastAppEndpointResponse(string $appData): void {
$this->storeLastAppEndpointResponse = $appData;
public function setLastAppOpenData(string $data): void {
$this->lastAppOpenData = $data;
}
/**
* @return string
*/
public function getLastAppEndpointResponse(): string {
return $this->storeLastAppEndpointResponse;
public function getLastAppOpenData(): string {
return $this->lastAppOpenData;
}
/**
@@ -275,39 +275,39 @@ class CollaborationContext implements Context {
}
/**
* @Given user :user has sent POST request on app endpoint:
* @Given user :user has sent the following app-open request:
*
* @param string $user
* @param TableNode $items
* @param TableNode $properties
*
* @return void
* @throws GuzzleException
*/
public function userHasSentPostRequestOnAppEndpoint(string $user, TableNode $items): void {
$rows = $items->getRowsHash();
public function userHasSentTheFollowingAppOpenRequest(string $user, TableNode $properties): void {
$rows = $properties->getRowsHash();
$appResponse = CollaborationHelper::sendPOSTRequestToAppOpen(
$this->spacesContext->getFileId($user, $rows['space'], $rows['resource']),
$rows['suites'],
$rows['app'],
$this->featureContext->getActualUsername($user),
$this->featureContext->getPasswordForUser($user),
$this->featureContext->getBaseUrl(),
$this->featureContext->getStepLineRef()
);
$this->featureContext->theHTTPStatusCodeShouldBe(200, '', $appResponse);
$this->storeLastAppEndpointResponse($appResponse->getBody()->getContents());
$this->setLastAppOpenData($appResponse->getBody()->getContents());
}
/**
* @When user :user tries to get the file information of file using wopi endpoint
* @When user :user gets the file information of file using wopi endpoint
* @When user :user tries to get the information of the last opened file using wopi endpoint
* @When user :user gets the information of the last opened file using wopi endpoint
*
* @param string $user
*
* @return void
* @throws GuzzleException
*/
public function userTriesToCheckTheInformationOfDeletedFileUsingWopiEndpoint(string $user):void {
$response = json_decode($this->getLastAppEndpointResponse());
public function userGetsTheInformationOfTheLastOpenedFileUsingWopiEndpoint(string $user): void {
$response = json_decode($this->getLastAppOpenData());
$accessToken = $response->form_parameters->access_token;
// Extract the WOPISrc from the app_url

View File

@@ -600,16 +600,16 @@ Feature: check file info with different wopi apps
| FakeOffice |
| OnlyOffice |
@issue-10097
Scenario Outline: try to get file info of deleted file with office suites
Given user "Alice" has uploaded file with content "hello world" to "/textfile0.txt"
And user "Alice" has sent POST request on app endpoint:
| resource | textfile0.txt |
| space | Personal |
| suites | <office-suites> |
And user "Alice" has sent the following app-open request:
| resource | textfile0.txt |
| space | Personal |
| app | <office-suites> |
And user "Alice" has deleted file "/textfile0.txt"
When user "Alice" tries to get the file information of file using wopi endpoint
Then the HTTP status code should be "500"
When user "Alice" tries to get the information of the last opened file using wopi endpoint
Then the HTTP status code should be "404"
Examples:
| office-suites |
| Collabora |
@@ -619,13 +619,13 @@ Feature: check file info with different wopi apps
Scenario: get file info of restored file from trashbin (collabora)
Given user "Alice" has uploaded file with content "hello world" to "/textfile0.txt"
And user "Alice" has sent POST request on app endpoint:
And user "Alice" has sent the following app-open request:
| resource | textfile0.txt |
| space | Personal |
| suites | Collabora |
| app | Collabora |
And user "Alice" has deleted file "/textfile0.txt"
And user "Alice" has restored the file with original path "/textfile0.txt"
When user "Alice" gets the file information of file using wopi endpoint
When user "Alice" gets the information of the last opened file using wopi endpoint
Then the HTTP status code should be "200"
And the JSON data of the response should match
"""
@@ -697,13 +697,13 @@ Feature: check file info with different wopi apps
Scenario: get file info of restored file from trashbin (fakeOffice)
Given user "Alice" has uploaded file with content "hello world" to "/textfile0.txt"
And user "Alice" has sent POST request on app endpoint:
And user "Alice" has sent the following app-open request:
| resource | textfile0.txt |
| space | Personal |
| suites | FakeOffice |
| app | FakeOffice |
And user "Alice" has deleted file "/textfile0.txt"
And user "Alice" has restored the file with original path "/textfile0.txt"
When user "Alice" gets the file information of file using wopi endpoint
When user "Alice" gets the information of the last opened file using wopi endpoint
Then the HTTP status code should be "200"
And the JSON data of the response should match
"""
@@ -835,13 +835,13 @@ Feature: check file info with different wopi apps
Scenario: get file info of restored file from trashbin (onlyOffice)
Given user "Alice" has uploaded file with content "hello world" to "/textfile0.txt"
And user "Alice" has sent POST request on app endpoint:
And user "Alice" has sent the following app-open request:
| resource | textfile0.txt |
| space | Personal |
| suites | OnlyOffice |
| app | OnlyOffice |
And user "Alice" has deleted file "/textfile0.txt"
And user "Alice" has restored the file with original path "/textfile0.txt"
When user "Alice" gets the file information of file using wopi endpoint
When user "Alice" gets the information of the last opened file using wopi endpoint
Then the HTTP status code should be "200"
And the JSON data of the response should match
"""
@@ -921,12 +921,12 @@ Feature: check file info with different wopi apps
Scenario: get file info after renaming file (onlyOffice)
Given user "Alice" has uploaded file with content "hello world" to "/textfile0.txt"
And user "Alice" has sent POST request on app endpoint:
And user "Alice" has sent the following app-open request:
| resource | textfile0.txt |
| space | Personal |
| suites | OnlyOffice |
| app | OnlyOffice |
And user "Alice" has moved file "textfile0.txt" to "renamedfile.txt"
When user "Alice" gets the file information of file using wopi endpoint
When user "Alice" gets the information of the last opened file using wopi endpoint
Then the HTTP status code should be "200"
And the JSON data of the response should match
"""
@@ -1006,12 +1006,12 @@ Feature: check file info with different wopi apps
Scenario: get file info after renaming file (collabora)
Given user "Alice" has uploaded file with content "hello world" to "/textfile0.txt"
And user "Alice" has sent POST request on app endpoint:
And user "Alice" has sent the following app-open request:
| resource | textfile0.txt |
| space | Personal |
| suites | Collabora |
| app | Collabora |
And user "Alice" has moved file "textfile0.txt" to "renamedfile.txt"
When user "Alice" gets the file information of file using wopi endpoint
When user "Alice" gets the information of the last opened file using wopi endpoint
Then the HTTP status code should be "200"
And the JSON data of the response should match
"""
@@ -1083,12 +1083,12 @@ Feature: check file info with different wopi apps
Scenario: get file info after renaming file with (fakeOffice)
Given user "Alice" has uploaded file with content "hello world" to "/textfile0.txt"
And user "Alice" has sent POST request on app endpoint:
And user "Alice" has sent the following app-open request:
| resource | textfile0.txt |
| space | Personal |
| suites | FakeOffice |
| app | FakeOffice |
And user "Alice" has moved file "textfile0.txt" to "renamedfile.txt"
When user "Alice" gets the file information of file using wopi endpoint
When user "Alice" gets the information of the last opened file using wopi endpoint
Then the HTTP status code should be "200"
And the JSON data of the response should match
"""