Skip to content

Commit

Permalink
Refactor public link tests for webUI
Browse files Browse the repository at this point in the history
  • Loading branch information
phil-davis committed May 30, 2022
1 parent 43a39a1 commit cd6102e
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 10 deletions.
21 changes: 20 additions & 1 deletion tests/acceptance/features/bootstrap/WebUISharingContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -772,6 +772,10 @@ public function theUserCreatesAReadOnlyPublicLinkForFolderUsingTheQuickActionBut
* @When the user creates a new public link for file/folder :name using the webUI with
* @Given the user has created a new public link for file/folder :name using the webUI with
*
* The name can be a whole path to the file/folder. The test step will open each folder
* to reach the final list of resources, and then create the public link for the final
* resource.
*
* @param string $name
* @param TableNode|null $settings table with the settings and no header
* possible settings: name, permission,
Expand All @@ -787,7 +791,22 @@ public function theUserCreatesANewPublicLinkForFileFolderUsingTheWebUIWith(
string $name,
?TableNode $settings = null
):void {
$linkName = $this->createPublicShareLink($name, $settings);
$nameParts = \explode("/", $name);
$numberOfNameParts = \count($nameParts);
foreach ($nameParts as $key => $namePart) {
// open each folder in the path, so that the last item should be listed
if ($key === ($numberOfNameParts - 1)) {
$finalName = $namePart;
} else {
$this->webUIFilesContext->theUserOpensFolderNamedUsingTheWebUI(
"",
"folder",
"'$namePart'",
""
);
}
}
$linkName = $this->createPublicShareLink($finalName, $settings);
$linkUrl = $this->publicShareTab->getLinkUrl($linkName);
$urlParts = \explode("/", $linkUrl);
$shareToken = \end($urlParts);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ Feature: Reshare by public link
And user "Alice" has uploaded file with content "some content" to "/simple-folder/sub-folder/randomfile.txt"
And user "Alice" has shared folder "/simple-folder" with user "Brian" with permissions "share,read"
And user "Brian" has logged in using the webUI
When the user opens folder "simple-folder" using the webUI
And the user creates a new public link for folder "sub-folder" using the webUI
When the user creates a new public link for folder "simple-folder/sub-folder" using the webUI
And the public accesses the last created public link using the webUI
Then file "randomfile.txt" should be listed on the webUI

Expand All @@ -42,8 +41,7 @@ Feature: Reshare by public link
And user "Alice" has uploaded file with content "some content" to "/simple-folder/randomfile.txt"
And user "Alice" has shared folder "/simple-folder" with user "Brian" with permissions "share,read"
And user "Brian" has logged in using the webUI
When the user opens folder "simple-folder" using the webUI
And the user creates a new public link for file "randomfile.txt" using the webUI
When the user creates a new public link for file "simple-folder/randomfile.txt" using the webUI
And the public accesses the last created public link using the webUI
Then the text preview of the public link should contain "some content"

Expand All @@ -68,8 +66,7 @@ Feature: Reshare by public link
And user "Alice" has shared folder "/simple-folder" with user "Brian" with permissions "share,read"
And parameter "shareapi_allow_public_notification" of app "core" has been set to "yes"
And user "Brian" has logged in using the webUI
When the user opens folder "simple-folder" using the webUI
And the user creates a new public link for file "randomfile.txt" using the webUI with
When the user creates a new public link for file "simple-folder/randomfile.txt" using the webUI with
| email | foo@bar.co |
Then the email address "[email protected]" should have received an email from user "Brian" with the body containing
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,15 +156,14 @@ Feature: Share by public link
And the fields of the last response to user "Alice" should include
| expiration | 14-10-2038 |

Scenario: share two file with same name but different paths by public link
Scenario: share two files with the same name but different paths by public link
Given user "Alice" has uploaded file "filesForUpload/lorem.txt" to "/lorem.txt"
And user "Alice" has created folder "/simple-folder"
And user "Alice" has uploaded file "filesForUpload/lorem.txt" to "/simple-folder/lorem.txt"
And user "Alice" has logged in using the webUI
When the user creates a new public link for file "lorem.txt" using the webUI
And the user closes the details dialog
And the user opens folder "simple-folder" using the webUI
And the user creates a new public link for file "lorem.txt" using the webUI
And the user creates a new public link for file "simple-folder/lorem.txt" using the webUI
And the user browses to the shared-by-link page
Then file "lorem.txt" with path "" should be listed in the shared with others page on the webUI
And file "lorem.txt" with path "/simple-folder" should be listed in the shared with others page on the webUI
Expand Down

0 comments on commit cd6102e

Please sign in to comment.