diff options
author | Julius Härtl <jus@bitgrid.net> | 2020-03-03 17:24:40 +0300 |
---|---|---|
committer | Julius Härtl <jus@bitgrid.net> | 2020-03-03 17:24:40 +0300 |
commit | 30354129e9f1ac716a987a8d29d3fe08ed346874 (patch) | |
tree | f2d3fff33593b276444ab7bd556064a15b485536 /tests | |
parent | 047642a2bdbaf9f6a3b65b3148cf544cce70eecd (diff) |
Adjust integration tests to missing wopi token without guest name being set
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/features/bootstrap/FeatureContext.php | 33 | ||||
-rw-r--r-- | tests/features/wopi.feature | 36 |
2 files changed, 51 insertions, 18 deletions
diff --git a/tests/features/bootstrap/FeatureContext.php b/tests/features/bootstrap/FeatureContext.php index e27726b1..6d408245 100644 --- a/tests/features/bootstrap/FeatureContext.php +++ b/tests/features/bootstrap/FeatureContext.php @@ -82,6 +82,39 @@ class FeatureContext implements Context } /** + * @Then a guest opens the share link as :user + */ + public function aGuestOpensTheShareLinkAs($user) + { + if (count($this->lastShareData->data->element) > 0){ + $token = $this->lastShareData->data[0]->token; + } else { + $token = $this->lastShareData->data->token; + } + + $cookieJar = \GuzzleHttp\Cookie\CookieJar::fromArray([ + 'guestUser' => $user + ], 'localhost'); + + + // public function publicPage($shareToken, $fileName, $fileId) { + $client = new Client(); + $result = $client->get($this->baseUrl . 'index.php/apps/richdocuments/public?shareToken=' . $token, array_merge($this->getWebOptions(), [ + 'cookies' => $cookieJar + ])); + $contents = $result->getBody()->getContents(); + $re = '/var richdocuments_([A-z]+) = (.*);/m'; + preg_match_all($re, $contents, $matches, PREG_SET_ORDER, 0); + $result = []; + foreach ($matches as $match) { + $result[$match[1]] = str_replace("'", "", $match[2]); + } + + $this->fileId = $result['fileId']; + $this->wopiToken = $result['token']; + } + + /** * @Then Collabora fetches checkFileInfo */ public function collaboraFetchesCheckfileinfo() { diff --git a/tests/features/wopi.feature b/tests/features/wopi.feature index 917c8721..7a2a54fb 100644 --- a/tests/features/wopi.feature +++ b/tests/features/wopi.feature @@ -40,7 +40,7 @@ Scenario: Fetch checkFileInfo for public share link And Updating last share with | permissions | 3 | Then Using web as guest - And a guest opens the share link + And a guest opens the share link as "Anonymous" And Collabora fetches checkFileInfo And checkFileInfo "BaseFileName" is "file.odt" And checkFileInfo "UserId" matches "/Guest-/" @@ -57,20 +57,20 @@ Scenario: Save a file as the owner And Collabora puts "./../assets/template.odt" - Scenario: Save a file as guest with write permissions - Given as user "user1" - And User "user1" uploads file "./../assets/template.odt" to "/file.odt" - And as "user1" create a share with - | path | /file.odt | - | shareType | 3 | - And Updating last share with - | permissions | 3 | - And the HTTP status code should be "200" - Then Using web as guest - And a guest opens the share link - And Collabora fetches checkFileInfo - And checkFileInfo "BaseFileName" is "file.odt" - And checkFileInfo "UserId" matches "/Guest-/" - And checkFileInfo "OwnerId" is "user1" - And checkFileInfo "UserCanWrite" is true - And Collabora puts "./../assets/template.odt" +Scenario: Save a file as guest with write permissions + Given as user "user1" + And User "user1" uploads file "./../assets/template.odt" to "/file.odt" + And as "user1" create a share with + | path | /file.odt | + | shareType | 3 | + And Updating last share with + | permissions | 3 | + And the HTTP status code should be "200" + Then Using web as guest + And a guest opens the share link as "Anonymous" + And Collabora fetches checkFileInfo + And checkFileInfo "BaseFileName" is "file.odt" + And checkFileInfo "UserId" matches "/Guest-/" + And checkFileInfo "OwnerId" is "user1" + And checkFileInfo "UserCanWrite" is true + And Collabora puts "./../assets/template.odt" |