Skip to content

Commit

Permalink
fix acceptance tests with empty named public link
Browse files Browse the repository at this point in the history
  • Loading branch information
karakayasemi committed Apr 15, 2020
1 parent 674eb13 commit 0c7a017
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,12 @@ Feature: Share by public link

Scenario Outline: user tries to change the role of an existing public link role without entering share password while enforce password for that role is enforced
Given the setting "<setting-name>" of app "core" has been set to "yes"
And user "user1" has shared folder "simple-folder" with link with "<initial-permissions>" permissions
And user "user1" has created a public link with following settings
| path | simple-folder |
| name | Public-link |
| permissions | <initial-permissions> |
And user "user1" has logged in using the webUI
When the user edits the public link named "{}" of folder "simple-folder" changing following
When the user edits the public link named "Public-link" of folder "simple-folder" changing following
| role | <role> |
Then the user should see an error message on the public link share dialog saying "Passwords are enforced for link shares"
And user "user1" should have a share with these details:
Expand All @@ -138,9 +141,13 @@ Feature: Share by public link

Scenario Outline: user tries to delete the password of an existing public link role while enforce password for that role is enforced
Given the setting "<setting-name>" of app "core" has been set to "yes"
And user "user1" has shared folder "simple-folder" with link with "<initial-permissions>" permissions and password "123"
And user "user1" has created a public link with following settings
| path | simple-folder |
| name | Public-link |
| permissions | <initial-permissions> |
| password | 123 |
And user "user1" has logged in using the webUI
When the user edits the public link named "{}" of folder "simple-folder" changing following
When the user edits the public link named "Public-link" of folder "simple-folder" changing following
| password | |
Then the user should see an error message on the public link share dialog saying "Passwords are enforced for link shares"
And user "user1" should have a share with these details:
Expand All @@ -158,9 +165,13 @@ Feature: Share by public link

Scenario Outline: user changes the role of an existing public link role without entering share password while enforce password for the original role is enforced
Given the setting "<setting-name>" of app "core" has been set to "yes"
And user "user1" has shared folder "simple-folder" with link with "<initial-permissions>" permissions and password "123"
And user "user1" has created a public link with following settings
| path | simple-folder |
| name | Public-link |
| permissions | <initial-permissions> |
| password | 123 |
And user "user1" has logged in using the webUI
When the user edits the public link named "{}" of folder "simple-folder" changing following
When the user edits the public link named "Public-link" of folder "simple-folder" changing following
| role | <role> |
| password | |
Then user "user1" should have a share with these details:
Expand Down Expand Up @@ -315,8 +326,12 @@ Feature: Share by public link

Scenario: user edits a name of an already existing public link
Given user "user1" has logged in using the webUI
And user "user1" has shared folder "simple-folder" with link with "read" permissions and password "pass123"
When the user edits the public link named "{}" of folder "simple-folder" changing following
And user "user1" has created a public link with following settings
| path | simple-folder |
| name | Public-link |
| permissions | read |
| password | pass123 |
When the user edits the public link named "Public-link" of folder "simple-folder" changing following
| name | simple-folder Share |
And the public uses the webUI to access the last public link created by user "user1" with password "pass123"
Then file "lorem.txt" should be listed on the webUI
Expand All @@ -333,34 +348,49 @@ Feature: Share by public link
| simple-folder | Public |

Scenario: user edits the password of an already existing public link
Given user "user1" has shared folder "simple-folder" with link with "read, update, create, delete" permissions and password "pass123"
Given user "user1" has created a public link with following settings
| path | simple-folder |
| name | Public-link |
| permissions | read, update, create, delete |
| password | pass123 |
And user "user1" has logged in using the webUI
When the user edits the public link named "{}" of folder "simple-folder" changing following
When the user edits the public link named "Public-link" of folder "simple-folder" changing following
| password | qwertyui |
And the public uses the webUI to access the last public link created by user "user1" with password "qwertyui"
Then file "lorem.txt" should be listed on the webUI

Scenario: user edits the password of an already existing public link and tries to access with old password
Given user "user1" has shared folder "simple-folder" with link with "read, update, create, delete" permissions and password "pass123"
Given user "user1" has created a public link with following settings
| path | simple-folder |
| name | Public-link |
| permissions | read, update, create, delete |
| password | pass123 |
And user "user1" has logged in using the webUI
And the user edits the public link named "{}" of folder "simple-folder" changing following
And the user edits the public link named "Public-link" of folder "simple-folder" changing following
| password | qwertyui |
When the public uses the webUI to access the last public link created by user "user1" with password "pass123"
Then the public should not get access to the publicly shared file

Scenario: user edits the permission of an already existing public link from read-write to read
Given user "user1" has shared folder "simple-folder" with link with "read, update, create, delete" permissions
Given user "user1" has created a public link with following settings
| path | simple-folder |
| name | Public-link |
| permissions | read, update, create, delete |
And user "user1" has logged in using the webUI
When the user edits the public link named "{}" of folder "simple-folder" changing following
When the user edits the public link named "Public-link" of folder "simple-folder" changing following
| role | Viewer |
And the public uses the webUI to access the last public link created by user "user1"
Then file "lorem.txt" should be listed on the webUI
And it should not be possible to delete file "lorem.txt" using the webUI

Scenario: user edits the permission of an already existing public link from read to read-write
Given user "user1" has shared folder "simple-folder" with link with "read" permissions
Given user "user1" has created a public link with following settings
| path | simple-folder |
| name | Public-link |
| permissions | read |
And user "user1" has logged in using the webUI
When the user edits the public link named "{}" of folder "simple-folder" changing following
When the user edits the public link named "Public-link" of folder "simple-folder" changing following
| role | Editor |
And the public uses the webUI to access the last public link created by user "user1"
And the user deletes the following elements using the webUI
Expand Down Expand Up @@ -474,7 +504,7 @@ Feature: Share by public link
| path | /lorem.txt |
| name | Public link |
| expiration | +16 |

Scenario: user can set an expiry date when creating a public link to a date that is before the enforced max expiry date
Given the setting "shareapi_default_expire_date" of app "core" has been set to "yes"
And the setting "shareapi_enforce_expire_date" of app "core" has been set to "yes"
Expand Down Expand Up @@ -521,8 +551,11 @@ Feature: Share by public link

Scenario: user removes the public link of a file using webUI
Given user "user1" has logged in using the webUI
And user "user1" has shared file "lorem.txt" with link with "read" permissions
When the user removes the public link named "{}" of file "lorem.txt" using the webUI
And user "user1" has created a public link with following settings
| path | lorem.txt |
| name | Public-link |
| permissions | read |
When the user removes the public link named "Public-link" of file "lorem.txt" using the webUI
Then user "user1" should not have any public link

@skip @yetToImplement
Expand Down Expand Up @@ -597,9 +630,12 @@ Feature: Share by public link
And file "lorem (2).txt" should be listed on the webUI

Scenario: user browses to public link share using copy link button
Given user "user1" has shared folder "simple-folder" with link with "read" permissions
Given user "user1" has created a public link with following settings
| path | simple-folder |
| name | Public-link |
| permissions | read |
And user "user1" has logged in using the webUI
When the user copies the url of public link named "{}" of folder "simple-folder" using the webUI
When the user copies the url of public link named "Public-link" of folder "simple-folder" using the webUI
And the user navigates to the copied public link using the webUI
Then file "lorem.txt" should be listed on the webUI

Expand Down Expand Up @@ -815,3 +851,9 @@ Feature: Share by public link
And a link named "Public Link Sub" should be listed with role "Viewer" in the public link list of resource "simple-empty-folder" on the webUI
When the user browses to the favorites page using the webUI
Then a link named "Public Link" should be listed with role "Viewer" in the public link list of resource "simple-folder/simple-empty-folder" via "simple-folder" on the webUI

Scenario: token is shown for links without a name
Given user "user1" has shared folder "simple-folder" with link with "<initial-permissions>" permissions
| path | /simple-folder |
And user "user1" has logged in using the webUI
Then a public link with the token as name should be listed for resource "simple-folder" on the webUI
10 changes: 10 additions & 0 deletions tests/acceptance/stepDefinitions/publicLinkContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,3 +253,13 @@ Then('the tokens should be unique for each public links on the webUI', async fun
const isUnique = publicLinkUrls.length === new Set(publicLinkUrls).size
return assert.ok(isUnique)
})

Then('a public link with the token as name should be listed for resource {string} on the webUII',
async function (resource) {
const lastShare = await sharingHelper.fetchLastPublicLinkShare(client.global.currentUser)
const isPresent = await client.page
.FilesPageElement
.publicLinksDialog()
.isPublicLinkPresent(lastShare.token)
return assert.ok(isPresent)
})

0 comments on commit 0c7a017

Please sign in to comment.