Skip to content

Commit

Permalink
[Tests-Only] Access last created public link with OCIS
Browse files Browse the repository at this point in the history
  • Loading branch information
haribhandari07 committed Jul 21, 2020
1 parent 87d8e96 commit 4ea357e
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 19 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@mailhog @public_link_share-feature-required @skipOnOCIS @ocis-reva-issue-64
@mailhog @public_link_share-feature-required @ocis-reva-issue-64
Feature: Share by public link
As a user
I want to share files through a publicly accessible link
Expand All @@ -11,7 +11,7 @@ Feature: Share by public link
Background:
Given user "user1" has been created with default attributes

@smokeTest
@smokeTest @issue-ocis-reva-383 @skipOnOCIS
Scenario Outline: simple sharing by public link
Given user "user1" has logged in using the webUI
When the user creates a new public link for resource "<shared-resource>" using the webUI
Expand All @@ -30,6 +30,24 @@ Feature: Share by public link
| simple-folder |
| lorem.txt |

@skipOnOC10 @issue-ocis-reva-383
# When this issue is fixed delete this scenario and use the one above
Scenario Outline: simple sharing by public link
Given user "user1" has logged in using the webUI
When the user creates a new public link for resource "<shared-resource>" using the webUI
Then user "user1" should have a share with these details:
| field | value |
| share_type | public_link |
| uid_owner | user1 |
| permissions | read |
| path | /<shared-resource> |
When 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
Examples:
| shared-resource |
| simple-folder |
| lorem.txt |

Scenario: public link share shows up on shared-with-others page
Given user "user1" has logged in using the webUI
And user "user1" has shared folder "simple-folder" with link with "read" permissions
Expand All @@ -39,26 +57,27 @@ Feature: Share by public link
| simple-folder | Public |
But file "data.zip" should not be listed on the webUI

@issue-276
@issue-276 @skipOnOCIS
Scenario: Thumbnails are loaded for known file types in public link file list
Given user "user1" has shared folder "simple-folder" with link with "read,create" permissions
When the public uses the webUI to access the last public link created by user "user1"
And the user uploads file "new-lorem.txt" using the webUI
Then the file "new-lorem.txt" should have a thumbnail displayed on the webUI

@issue-276
@issue-276 @skipOnOCIS
Scenario: Thumbnails are not loaded for known file types in public link file list
Given user "user1" has shared folder "simple-folder" with link with "read,create" permissions
When the public uses the webUI to access the last public link created by user "user1"
And the user uploads file "new-data.zip" using the webUI
Then the file "new-data.zip" should have a file type icon displayed on the webUI

@skipOnOCIS
Scenario: opening public-link page of the files-drop link protected with password should redirect to files-drop page
Given user "user1" has shared folder "simple-folder" with link with "create" permissions and password "pass123"
When the public tries to open the public link page of the last public link created by user "user1" with password "pass123"
Then the user should be redirected to the files-drop page

@issue-2414
@issue-2414 @skipOnOCIS
Scenario: opening public-link page of the files-drop link without password set should redirect to files-drop page
Given user "user1" has shared folder "simple-folder" with link with "create" permissions
When the public tries to open the public link page of the last public link created by user "user1"
Expand Down Expand Up @@ -98,16 +117,19 @@ Feature: Share by public link
Then file "lorem.txt" should be listed on the webUI
And the content of "lorem.txt" on the remote server should be the same as the local "lorem.txt"

@skipOnOCIS
Scenario: public should be able to access a public link with correct password
Given user "user1" has shared folder "simple-folder" with link with "read, update, create, delete" permissions and password "pass123"
When 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

@skipOnOCIS
Scenario: public should not be able to access a public link with wrong password
Given user "user1" has shared folder "simple-folder" with link with "read" permissions and password "pass123"
When the public uses the webUI to access the last public link created by user "user1" with password "pass12"
Then the public should not get access to the publicly shared file

@skipOnOCIS
Scenario: user shares a public link with folder longer than 64 chars and shorter link name
Given user "user1" has renamed folder "simple-folder" to "aquickbrownfoxjumpsoveraverylazydogaquickbrownfoxjumpsoveralazydog"
And user "user1" has logged in using the webUI
Expand All @@ -116,6 +138,7 @@ Feature: Share by public link
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

@skipOnOCIS
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 created a public link with following settings
Expand All @@ -139,6 +162,7 @@ Feature: Share by public link
| read | Editor | shareapi_enforce_links_password_read_write_delete |
| read, create | Uploader | shareapi_enforce_links_password_write_only |

@skipOnOCIS
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 created a public link with following settings
Expand All @@ -163,6 +187,7 @@ Feature: Share by public link
| read, update, create, delete | shareapi_enforce_links_password_read_write_delete |
| create | shareapi_enforce_links_password_write_only |

@skipOnOCIS
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 created a public link with following settings
Expand All @@ -187,7 +212,7 @@ Feature: Share by public link
| read, update, create, delete | Uploader | shareapi_enforce_links_password_read_write_delete | create |
| create | Editor | shareapi_enforce_links_password_write_only | read, update, create, delete |

@yetToImplement
@yetToImplement @skipOnOCIS
Scenario: public should be able to access the shared file through public link
Given user "user1" has logged in using the webUI
And user "user1" has created a public link with following settings
Expand Down Expand Up @@ -293,7 +318,7 @@ Feature: Share by public link
But the email address "foo1234@bar.co" should not have received an email
And the email address "foo5678@barr.co" should not have received an email

@yetToImplement
@yetToImplement @skipOnOCIS
Scenario: user edits a public link and does not save the changes
Given the setting "shareapi_allow_public_notification" of app "core" has been set to "yes"
And user "user1" has logged in using the webUI
Expand Down Expand Up @@ -324,6 +349,7 @@ Feature: Share by public link
"""
And the email address "foo@bar.co" should have received an email containing the last shared public link

@skipOnOCIS
Scenario: user edits a name of an already existing public link
Given user "user1" has logged in using the webUI
And user "user1" has created a public link with following settings
Expand All @@ -336,6 +362,7 @@ Feature: Share by public link
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

@skipOnOCIS
Scenario: user shares a file through public link and then it appears in a shared-with-others page
Given the setting "shareapi_allow_public_notification" of app "core" has been set to "yes"
And user "user1" has shared folder "simple-folder" with link with "read, update, create, delete" permissions
Expand All @@ -347,6 +374,7 @@ Feature: Share by public link
| fileName | expectedCollaborators |
| simple-folder | Public |

@skipOnOCIS
Scenario: user edits the password of an already existing public link
Given user "user1" has created a public link with following settings
| path | simple-folder |
Expand All @@ -359,9 +387,10 @@ Feature: Share by public link
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

@skipOnOCIS
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
And user "user1" has created a public link with following settings
| path | simple-folder |
| name | Public-link |
| permissions | read, update, create, delete |
Expand All @@ -372,6 +401,7 @@ Feature: Share by public link
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

@skipOnOCIS
Scenario: user edits the permission of an already existing public link from read-write to read
Given user "user1" has created a public link with following settings
| path | simple-folder |
Expand All @@ -384,6 +414,7 @@ Feature: Share by public link
Then file "lorem.txt" should be listed on the webUI
And it should not be possible to delete file "lorem.txt" using the webUI

@skipOnOCIS
Scenario: user edits the permission of an already existing public link from read to read-write
Given user "user1" has created a public link with following settings
| path | simple-folder |
Expand All @@ -400,6 +431,7 @@ Feature: Share by public link
Then the deleted elements should not be listed on the webUI
And the deleted elements should not be listed on the webUI after a page reload

@skipOnOCIS
Scenario: user changes the expiration date of an already existing public link using webUI
Given user "user1" has created a public link with following settings
| path | lorem.txt |
Expand All @@ -411,6 +443,7 @@ Feature: Share by public link
Then the fields of the last public link share response of user "user1" should include
| expireDate | 2038-07-21 |

@skipOnOCIS
Scenario: user tries to change the expiration date of the public link to past date using webUI
Given user "user1" has created a public link with following settings
| path | lorem.txt |
Expand All @@ -421,6 +454,7 @@ Feature: Share by public link
Then the fields of the last public link share response of user "user1" should include
| expireDate | 2038-10-14 |

@skipOnOCIS
Scenario Outline: auto set expiration date on public link (with default amount of expiry days)
Given the setting "shareapi_default_expire_date" of app "core" has been set to "yes"
And user "user1" has logged in using the webUI
Expand All @@ -438,6 +472,7 @@ Feature: Share by public link
| lorem.txt |
| simple-folder |

@skipOnOCIS
Scenario Outline: auto set expiration date on public link (with set amount expiry days)
Given the setting "shareapi_default_expire_date" of app "core" has been set to "yes"
And the setting "shareapi_expire_after_n_days" of app "core" has been set to "42"
Expand All @@ -456,6 +491,7 @@ Feature: Share by public link
| lorem.txt |
| simple-folder |

@skipOnOCIS
Scenario: expiry date is set to enforced max expiry date when creating a public link to a date that is past the enforced max expiry date
Given the setting "shareapi_default_expire_date" of app "core" has been set to "yes"
And the setting "shareapi_expire_after_n_days" of app "core" has been set to "7"
Expand All @@ -465,6 +501,7 @@ Feature: Share by public link
Then the expiration date shown on the webUI should be "+7" days
And user "user1" should not have created any shares

@skipOnOCIS
Scenario: user cannot change the expiry date of an existing public link to a date that is past 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 All @@ -483,6 +520,7 @@ Feature: Share by public link
| name | Public link |
| expiration | +6 |

@skipOnOCIS
Scenario: user cannot change the expiry date of an existing public link to a date that is past the enforced max expiry date
Given the setting "shareapi_default_expire_date" of app "core" has been set to "yes"
And the setting "shareapi_expire_after_n_days" of app "core" has been set to "16"
Expand All @@ -505,6 +543,7 @@ Feature: Share by public link
| name | Public link |
| expiration | +16 |

@skipOnOCIS
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 All @@ -520,6 +559,7 @@ Feature: Share by public link
| name | Public link |
| expiration | +7 |

@skipOnOCIS
Scenario: user can change the expiry date of an existing 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 @@ -549,6 +589,7 @@ Feature: Share by public link
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

@skipOnOCIS
Scenario: user removes the public link of a file using webUI
Given user "user1" has logged in using the webUI
And user "user1" has created a public link with following settings
Expand Down Expand Up @@ -668,7 +709,7 @@ Feature: Share by public link
# | links |
# | collaborators |

@issue-2060
@issue-2060 @skipOnOCIS
Scenario: sharing indicator inside a shared folder
Given user "user1" has created folder "/simple-folder/sub-folder"
And user "user1" has uploaded file with content "test" to "/simple-folder/textfile.txt"
Expand All @@ -683,7 +724,7 @@ Feature: Share by public link
| sub-folder | link-indirect |
| textfile.txt | link-indirect |

@issue-2060
@issue-2060 @skipOnOCIS
Scenario: sharing indicator for file uploaded inside a shared folder
Given user "user1" has shared folder "simple-folder" with link with "read" permissions
And user "user1" has logged in using the webUI
Expand All @@ -703,7 +744,7 @@ Feature: Share by public link
| fileName | expectedIndicators |
| sub-folder | link-indirect |

@issue-2060
@issue-2060 @skipOnOCIS
Scenario: sharing indicators public link and collaborators inside a shared folder
Given user "user2" has been created with default attributes
And user "user1" has created folder "/simple-folder/sub-folder"
Expand All @@ -720,7 +761,7 @@ Feature: Share by public link
| sub-folder | link-indirect,user-indirect |
| textfile.txt | link-indirect,user-indirect |

@issue-2060
@issue-2060 @skipOnOCIS
Scenario: sharing indicators public link from reshare
Given user "user2" has been created with default attributes
And user "user1" has created folder "/simple-folder/sub-folder"
Expand All @@ -737,7 +778,7 @@ Feature: Share by public link
| sub-folder | link-indirect,user-indirect |
| textfile.txt | link-indirect,user-indirect |

@issue-2060
@issue-2060 @skipOnOCIS
Scenario: sharing indicators public link from child of reshare
Given user "user2" has been created with default attributes
And user "user1" has created folder "/simple-folder/sub-folder"
Expand All @@ -754,7 +795,7 @@ Feature: Share by public link
| sub-folder | link-direct,user-indirect |
| textfile.txt | user-indirect |

@issue-2060
@issue-2060 @skipOnOCIS
Scenario: no sharing indicator visible in file list from public link
Given user "user2" has been created with default attributes
And user "user3" has been created with default attributes
Expand All @@ -765,7 +806,7 @@ Feature: Share by public link
Then the following resources should not have share indicators on the webUI
| simple-empty-folder |

@issue-2939
@issue-2939 @skipOnOCIS
Scenario: sharing indicator for link shares stays up to date
Given user "user2" has been created with default attributes
When user "user1" has logged in using the webUI
Expand Down Expand Up @@ -835,7 +876,7 @@ Feature: Share by public link
Then a link named "Public Link" should be listed with role "Viewer" in the public link list of resource "textfile.txt" via "simple-folder" on the webUI
And a link named "strängé लिंक नाम (#2 &).नेपाली" should be listed with role "Viewer" in the public link list of resource "textfile.txt" via "sub-folder" on the webUI

@issue-3040
@issue-3040 @skipOnOCIS
Scenario: sharing details of indirect link share in "favorites" file lists
Given user "user1" has created a public link with following settings
| path | /simple-folder |
Expand All @@ -852,12 +893,14 @@ Feature: Share by public link
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

@skipOnOCIS
Scenario: token is shown for links without a name
When user "user1" has created a public link with following settings
| path | /simple-folder |
And user "user1" logs in using the webUI
Then a public link with the last created link share token as name should be listed for resource "simple-folder" on the webUI

@skipOnOCIS
Scenario: User can create a public link via quick action
Given user "user1" has logged in using the webUI
When the user creates a public link via quick action for resource "simple-folder" using the webUI
Expand Down
5 changes: 2 additions & 3 deletions tests/acceptance/helpers/sharingHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,9 @@ module.exports = {
'Could not get shares. Message: ' + sharesResult.ocs.meta.message
)
const shares = sharesResult.ocs.data
let lastFoundShareId = 0
const lastShareSTime = 0
for (const share of shares) {
if (share.share_type === self.SHARE_TYPES.public_link && share.id >= lastFoundShareId) {
lastFoundShareId = share.id
if (share.share_type === self.SHARE_TYPES.public_link && share.stime > lastShareSTime) {
lastShareToken = share.token
lastShare = share
}
Expand Down

0 comments on commit 4ea357e

Please sign in to comment.