From 88928b75295fb055afd8806bfc4d470202d84683 Mon Sep 17 00:00:00 2001 From: saw-jan Date: Wed, 29 Dec 2021 15:00:36 +0545 Subject: [PATCH] add remaining sharing GUI tests fix code formats fix rename tests fix edit files tests reduce aync timeout to 10 sec fix edit files tests combine test scenarios skip expiration date tests reuse steps revert source code changes --- test/gui/shared/scripts/bdd_hooks.py | 2 +- .../scripts/pageObjects/PublicLinkDialog.py | 87 +++-- test/gui/shared/steps/steps.py | 128 +++++-- test/gui/tst_sharing/test.feature | 332 +++++++++++++----- 4 files changed, 404 insertions(+), 145 deletions(-) diff --git a/test/gui/shared/scripts/bdd_hooks.py b/test/gui/shared/scripts/bdd_hooks.py index e5eb6dd134f..56cf0459c26 100644 --- a/test/gui/shared/scripts/bdd_hooks.py +++ b/test/gui/shared/scripts/bdd_hooks.py @@ -37,7 +37,7 @@ def hook(context): DEFAULT_CONFIG = { 'localBackendUrl': 'https://localhost:9200/', 'secureLocalBackendUrl': 'https://localhost:9200/', - 'clientSyncTimeout': 60, + 'clientSyncTimeout': 10, 'middlewareUrl': 'http://localhost:3000/', 'clientConfigFile': '-', 'clientRootSyncPath': '/tmp/client-bdd/', diff --git a/test/gui/shared/scripts/pageObjects/PublicLinkDialog.py b/test/gui/shared/scripts/pageObjects/PublicLinkDialog.py index 6b6196e65d1..b085aca73b5 100644 --- a/test/gui/shared/scripts/pageObjects/PublicLinkDialog.py +++ b/test/gui/shared/scripts/pageObjects/PublicLinkDialog.py @@ -1,7 +1,7 @@ import names import squish import test -import datetime +from datetime import datetime class PublicLinkDialog: @@ -72,6 +72,9 @@ class PublicLinkDialog: "visible": 1, } + # to store current default public link expiry date + defaultExpiryDate = '' + def openPublicLinkDialog(self): squish.mouseClick( squish.waitForObject(self.PUBLIC_LINKS_TAB), @@ -139,40 +142,57 @@ def setPassword(self, password): def toggleExpirationDate(self): squish.clickButton(squish.waitForObject(self.EXPIRYDATE_CHECKBOX)) + @staticmethod + def setDefaultExpiryDate(defaultDate): + defaultDate = datetime.strptime(defaultDate, '%m/%d/%y') + PublicLinkDialog.defaultExpiryDate = ( + f"{defaultDate.year}-{defaultDate.month}-{defaultDate.day}" + ) + + @staticmethod + def getDefaultExpiryDate(): + return PublicLinkDialog.defaultExpiryDate + def setExpirationDate(self, expireDate): enabled = squish.waitForObjectExists(self.EXPIRYDATE_CHECKBOX).checked if not enabled: self.toggleExpirationDate() - expDate = datetime.datetime.strptime(expireDate, '%Y-%m-%d') - expYear = expDate.year - 2000 - squish.mouseClick( - squish.waitForObject(self.EXPIRATION_DATE_FIELD), - 0, - 0, - squish.Qt.NoModifier, - squish.Qt.LeftButton, - ) - squish.nativeType("") - squish.nativeType("") - squish.nativeType(expDate.month) - squish.nativeType(expDate.day) - squish.nativeType(expYear) - squish.nativeType("") + if not expireDate == "default": + expDate = datetime.strptime(expireDate, '%Y-%m-%d') + expYear = expDate.year - 2000 + squish.mouseClick( + squish.waitForObject(self.EXPIRATION_DATE_FIELD), + 0, + 0, + squish.Qt.NoModifier, + squish.Qt.LeftButton, + ) + squish.nativeType("") + squish.nativeType("") + squish.nativeType(expDate.month) + squish.nativeType(expDate.day) + squish.nativeType(expYear) + squish.nativeType("") - actualDate = squish.waitForObjectExists(self.EXPIRATION_DATE_FIELD).displayText - expectedDate = f"{expDate.month}/{expDate.day}/{expYear}" - if not actualDate == expectedDate: - # retry with workaround - self.setExpirationDateWithWorkaround(expYear, expDate.month, expDate.day) + actualDate = str( + squish.waitForObjectExists(self.EXPIRATION_DATE_FIELD).displayText + ) + expectedDate = f"{expDate.month}/{expDate.day}/{expYear}" + if not actualDate == expectedDate: + # retry with workaround + self.setExpirationDateWithWorkaround( + expYear, expDate.month, expDate.day + ) - squish.waitFor( - lambda: (test.vp("publicLinkExpirationProgressIndicatorInvisible")) - ) - test.compare( - str(squish.waitForObjectExists(self.EXPIRATION_DATE_FIELD).displayText), - str(expectedDate), - ) + squish.waitFor( + lambda: (test.vp("publicLinkExpirationProgressIndicatorInvisible")) + ) + else: + defaultDate = str( + squish.waitForObjectExists(self.EXPIRATION_DATE_FIELD).displayText + ) + PublicLinkDialog.setDefaultExpiryDate(defaultDate) # This workaround is needed because the above function 'setExpirationDate' # will not work while creating new public link @@ -246,3 +266,14 @@ def verifyResource(self, resource): str(squish.waitForObjectExists(self.ITEM_TO_SHARE).text), resource, ) + + def verifyExpirationDate(self, expectedDate): + expectedDate = datetime.strptime(expectedDate, '%Y-%m-%d') + # date format in client UI is 'mm/dd/yy' e.g. '01/15/22' + expYear = expectedDate.year - 2000 + expectedDate = f"{expectedDate.month}/{expectedDate.day}/{expYear}" + + test.compare( + str(squish.waitForObjectExists(self.EXPIRATION_DATE_FIELD).displayText), + str(expectedDate), + ) diff --git a/test/gui/shared/steps/steps.py b/test/gui/shared/steps/steps.py index b6a8ede1601..b50ef945db4 100644 --- a/test/gui/shared/steps/steps.py +++ b/test/gui/shared/steps/steps.py @@ -2,7 +2,7 @@ import names import os import sys -from os import listdir +from os import listdir, rename from os.path import isfile, join, isdir import re import urllib.request @@ -157,20 +157,16 @@ def isFileSynced(fileName): return isItemSynced('FILE', fileName) -def waitForFileToBeSynced(context, fileName): +def waitForFileToBeSynced(context, filePath): waitFor( - lambda: isFileSynced( - sanitizePath(context.userData['currentUserSyncPath'] + fileName) - ), + lambda: isFileSynced(sanitizePath(filePath)), context.userData['clientSyncTimeout'] * 1000, ) -def waitForFolderToBeSynced(context, folderName): +def waitForFolderToBeSynced(context, folderPath): waitFor( - lambda: isFolderSynced( - sanitizePath(context.userData['currentUserSyncPath'] + folderName) - ), + lambda: isFolderSynced(sanitizePath(folderPath)), context.userData['clientSyncTimeout'] * 1000, ) @@ -334,19 +330,23 @@ def step(context): waitForFolderToBeSynced(context, '/') -@When('the user waits for file "|any|" to be synced') -def step(context, fileName): - waitForFileToBeSynced(context, fileName) +def waitForResourceToSync(context, resource, resourceType): + resource = join(context.userData['currentUserSyncPath'], resource) + if resourceType == "file": + waitForFileToBeSynced(context, resource) + elif resourceType == "folder": + waitForFolderToBeSynced(context, resource) -@When('the user waits for folder "|any|" to be synced') -def step(context, folderName): - waitForFolderToBeSynced(context, folderName) +@When(r'the user waits for (file|folder) "([^"]*)" to be synced', regexp=True) +def step(context, type, resource): + waitForResourceToSync(context, resource, type) -@Given('the user has waited for file "|any|" to be synced') -def step(context, fileName): - waitForFileToBeSynced(context, fileName) + +@Given(r'the user has waited for (file|folder) "([^"]*)" to be synced', regexp=True) +def step(context, type, resource): + waitForResourceToSync(context, resource, type) @Given( @@ -363,6 +363,13 @@ def step(context, username, filename): createFile(context, filename, username) +@When( + 'user "|any|" tries to create a file "|any|" with the following content inside the sync folder' +) +def step(context, username, filename): + createFile(context, filename, username) + + def createFile(context, filename, username=None): fileContent = "\n".join(context.multiLineText) syncPath = None @@ -380,6 +387,11 @@ def step(context, username, foldername): createFolder(context, foldername, username) +@When('user "|any|" tries to create a folder "|any|" inside the sync folder') +def step(context, username, foldername): + createFolder(context, foldername, username) + + @Given('user "|any|" has created a folder "|any|" inside the sync folder') def step(context, username, foldername): createFolder(context, foldername, username) @@ -395,6 +407,12 @@ def createFolder(context, foldername, username=None): os.makedirs(path) +def renameFileFolder(context, source, destination): + source = join(context.userData['currentUserSyncPath'], source) + destination = join(context.userData['currentUserSyncPath'], destination) + rename(source, destination) + + @When('the user copies the folder "|any|" to "|any|"') def step(context, sourceFolder, destinationFolder): source_dir = join(context.userData['currentUserSyncPath'], sourceFolder) @@ -402,6 +420,21 @@ def step(context, sourceFolder, destinationFolder): shutil.copytree(source_dir, destination_dir) +@When('the user renames a folder "|any|" to "|any|"') +def step(context, sourceFolder, destinationFolder): + renameFileFolder(context, sourceFolder, destinationFolder) + + +@When('the user renames a file "|any|" to "|any|"') +def step(context, sourceFile, destinationFile): + renameFileFolder(context, sourceFile, destinationFile) + + +@When('the user tries to rename a file "|any|" to "|any|"') +def step(context, sourceFile, destinationFile): + renameFileFolder(context, sourceFile, destinationFile) + + @Given(r"^(.*) on the server (.*)$", regexp=True) def step(context, stepPart1, stepPart2): executeStepThroughMiddleware(context, "Given " + stepPart1 + " " + stepPart2) @@ -685,6 +718,21 @@ def step(context, resource, password): createPublicLinkShare(context, resource, password) +@Then('the expiration date of the last public link of file "|any|" should be "|any|"') +def step(context, resource, expiryDate): + openSharingDialog(context, resource) + publicLinkDialog = PublicLinkDialog() + publicLinkDialog.openPublicLinkDialog() + + if expiryDate.strip("%") == "default": + expiryDate = PublicLinkDialog.getDefaultExpiryDate() + + publicLinkDialog.verifyExpirationDate(expiryDate) + + shareItem = SharingDialog() + shareItem.closeSharingDialog() + + def setExpirationDateWithVerification(resource, publicLinkName, expireDate): publicLinkDialog = PublicLinkDialog() publicLinkDialog.verifyResource(resource) @@ -721,11 +769,18 @@ def step(context): linkSettings = {} for row in context.table: linkSettings[row[0]] = row[1] + + if "path" not in linkSettings: + raise Exception("'path' is required but not given.") + + if "expireDate" in linkSettings and linkSettings['expireDate'] == "%default%": + linkSettings['expireDate'] = linkSettings['expireDate'].strip("%") + createPublicLinkShare( context, resource=linkSettings['path'], - password=linkSettings['password'], - expireDate=linkSettings['expireDate'], + password=linkSettings['password'] if "password" in linkSettings else None, + expireDate=linkSettings['expireDate'] if "expireDate" in linkSettings else None, ) @@ -918,6 +973,7 @@ def step(context, resource, group): @When('the user overwrites the file "|any|" with content "|any|"') def step(context, resource, content): print("starting file overwrite") + resource = join(context.userData['currentUserSyncPath'], resource) waitForFileToBeSynced(context, resource) waitForFolderToBeSynced(context, '/') @@ -928,7 +984,7 @@ def step(context, resource, content): snooze(5) - f = open(context.userData['currentUserSyncPath'] + resource, "w") + f = open(resource, "w") f.write(content) f.close() @@ -936,13 +992,12 @@ def step(context, resource, content): waitForFileToBeSynced(context, resource) -@When('the user tries to overwrite the file "|any|" with content "|any|"') -def step(context, resource, content): +def tryToOverwriteFile(context, resource, content): waitForFileToBeSynced(context, resource) waitForFolderToBeSynced(context, '/') try: - f = open(context.userData['currentUserSyncPath'] + resource, "w") + f = open(resource, "w") f.write(content) f.close() except: @@ -951,6 +1006,18 @@ def step(context, resource, content): waitForFileToBeSynced(context, resource) +@When('the user tries to overwrite the file "|any|" with content "|any|"') +def step(context, resource, content): + resource = context.userData['currentUserSyncPath'] + resource + tryToOverwriteFile(context, resource, content) + + +@When('user "|any|" tries to overwrite the file "|any|" with content "|any|"') +def step(context, user, resource, content): + resource = getResourcePath(context, resource, user) + tryToOverwriteFile(context, resource, content) + + def enableVFSSupport(vfsBtnText): # The enabling/disabling VFS button do not have it's own object # But it is inside the "stack_folderList_QTreeView" object. @@ -1030,8 +1097,7 @@ def step(context, errorMsg): test.compare(str(waitForObjectExists(newAccount.ERROR_LABEL).text), errorMsg) -@When(r'the user deletes the (file|folder) "([^"]*)"', regexp=True) -def step(context, itemType, resource): +def deleteResource(context, itemType, resource): resourcePath = sanitizePath(context.userData['currentUserSyncPath'] + resource) if itemType == 'file': os.remove(resourcePath) @@ -1041,6 +1107,16 @@ def step(context, itemType, resource): raise Exception("No such item type for resource") +@When(r'the user deletes the (file|folder) "([^"]*)"', regexp=True) +def step(context, itemType, resource): + deleteResource(context, itemType, resource) + + +@When(r'the user tries to delete the (file|folder) "([^"]*)"', regexp=True) +def step(context, itemType, resource): + deleteResource(context, itemType, resource) + + @When( 'the user unshares the resource "|any|" for collaborator "|any|" using the client-UI' ) diff --git a/test/gui/tst_sharing/test.feature b/test/gui/tst_sharing/test.feature index 4b39ed28709..661108c9084 100644 --- a/test/gui/tst_sharing/test.feature +++ b/test/gui/tst_sharing/test.feature @@ -6,7 +6,8 @@ Feature: Sharing Background: - Given user "Alice" has been created on the server with default attributes and without skeleton files + Given the setting "shareapi_auto_accept_share" on the server of app "core" has been set to "yes" + And user "Alice" has been created on the server with default attributes and without skeleton files @smokeTest Scenario: simple sharing with user @@ -18,6 +19,27 @@ Feature: Sharing And the user adds "Brian Murphy" as collaborator of resource "simple-folder" with permissions "edit,share" using the client-UI Then user "Brian Murphy" should be listed in the collaborators list for file "textfile0.txt" with permissions "edit,share" on the client-UI And user "Brian Murphy" should be listed in the collaborators list for file "simple-folder" with permissions "edit,share" on the client-UI + And as "Brian" folder "simple-folder" should exist on the server + And as "Brian" file "textfile0.txt" should exist on the server + + + Scenario: sharing file and folder with user who has some other shares + Given user "Brian" has been created on the server with default attributes and without skeleton files + And user "Alice" has created folder "shared" on the server + And user "Alice" has created folder "simple-folder" on the server + And user "Alice" has uploaded file with content "ownCloud test text file" to "textfile.txt" on the server + And user "Alice" has uploaded file with content "shared file" to "sharedfile.txt" on the server + And user "Alice" has shared folder "shared" on the server with user "Brian" with "all" permissions + And user "Alice" has shared file "sharedfile.txt" on the server with user "Brian" with "all" permissions + And user "Alice" has set up a client with default settings + When the user adds "Brian Murphy" as collaborator of resource "textfile.txt" with permissions "edit,share" using the client-UI + And the user adds "Brian Murphy" as collaborator of resource "simple-folder" with permissions "edit,share" using the client-UI + Then user "Brian Murphy" should be listed in the collaborators list for file "textfile.txt" with permissions "edit,share" on the client-UI + And user "Brian Murphy" should be listed in the collaborators list for file "simple-folder" with permissions "edit,share" on the client-UI + And as "Brian" folder "shared" should exist on the server + And as "Brian" file "sharedfile.txt" should exist on the server + And as "Brian" folder "simple-folder" should exist on the server + And as "Brian" file "textfile.txt" should exist on the server Scenario: sharing file/folder with a user that has special characters as username @@ -30,6 +52,8 @@ Feature: Sharing And the user adds "Speci@l_Name-.+" as collaborator of resource "FOLDER" with permissions "edit,share" using the client-UI Then user "Speci@l_Name-.+" should be listed in the collaborators list for file "textfile.txt" with permissions "edit,share" on the client-UI And user "Speci@l_Name-.+" should be listed in the collaborators list for file "FOLDER" with permissions "edit,share" on the client-UI + And as "Speci@l_Name-.+" folder "FOLDER" should exist on the server + And as "Speci@l_Name-.+" file "textfile.txt" should exist on the server Scenario: Share files/folders with special characters in their name @@ -41,24 +65,37 @@ Feature: Sharing And the user adds "Brian Murphy" as collaborator of resource "$ample1?.txt" with permissions "edit,share" using the client-UI Then user "Brian Murphy" should be listed in the collaborators list for file "SampleFolder,With,$pecial?Characters" with permissions "edit,share" on the client-UI And user "Brian Murphy" should be listed in the collaborators list for file "$ample1?.txt" with permissions "edit,share" on the client-UI + And as "Brian" folder "SampleFolder,With,$pecial?Characters" should exist on the server + And as "Brian" file "$ample1?.txt" should exist on the server - Scenario: try to share a file with a user to whom the file has already been shared + Scenario: try to share a file/folder with a user to whom the file has already been shared Given user "Brian" has been created on the server with default attributes and without skeleton files + And user "Alice" has created folder "SharedFolder" on the server And user "Alice" has uploaded file with content "ownCloud test text file" to "/textfile.txt" on the server + And user "Alice" has shared folder "SharedFolder" on the server with user "Brian" with "all" permissions And user "Alice" has shared file "textfile.txt" on the server with user "Brian" with "all" permissions And user "Alice" has set up a client with default settings When the user opens the sharing dialog of "textfile.txt" using the client-UI And the user searches for collaborator "Brian Murphy" using the client-UI Then the error "No results for 'Brian Murphy'" should be displayed + When the user closes the sharing dialog + And the user opens the sharing dialog of "SharedFolder" using the client-UI + And the user searches for collaborator "Brian Murphy" using the client-UI + Then the error "No results for 'Brian Murphy'" should be displayed - Scenario: try to self share a file + Scenario: try to self share a file/folder Given user "Alice" has uploaded file with content "ownCloud test text file" to "/textfile.txt" on the server + And user "Alice" has created folder "OwnFolder" on the server And user "Alice" has set up a client with default settings When the user opens the sharing dialog of "textfile.txt" using the client-UI And the user selects "Alice Hansen" as collaborator of resource "textfile.txt" using the client-UI Then the error "Can't share with yourself" should be displayed + When the user closes the sharing dialog + And the user opens the sharing dialog of "OwnFolder" using the client-UI + And the user selects "Alice Hansen" as collaborator of resource "OwnFolder" using the client-UI + Then the error "Can't share with yourself" should be displayed Scenario: search for users with minimum autocomplete characters @@ -77,16 +114,24 @@ Feature: Sharing Scenario: collaborators are listed in chronological order Given user "Brian" has been created on the server with default attributes and without skeleton files And user "Carol" has been created on the server with default attributes and without skeleton files + And user "TestUser1" has been created on the server with default attributes and without skeleton files + And user "TestUser2" has been created on the server with default attributes and without skeleton files + And user "TestUser3" has been created on the server with default attributes and without skeleton files And user "Alice" has uploaded file with content "ownCloud test text file" to "textfile.txt" on the server And user "Alice" has shared file "textfile.txt" on the server with user "Carol" with "all" permissions And user "Alice" has shared file "textfile.txt" on the server with user "Brian" with "all" permissions + And user "Alice" has shared file "textfile.txt" on the server with user "TestUser1" with "all" permissions + And user "Alice" has shared file "textfile.txt" on the server with user "TestUser3" with "all" permissions + And user "Alice" has shared file "textfile.txt" on the server with user "TestUser2" with "all" permissions And user "Alice" has set up a client with default settings When the user opens the sharing dialog of "textfile.txt" using the client-UI Then the collaborators should be listed in the following order: | collaborator | | Carol King | | Brian Murphy | - + | TestUser1 | + | TestUser3 | + | TestUser2 | @issue-7459 Scenario: Progress indicator should not be visible after unselecting the password protection checkbox while sharing through public link @@ -98,44 +143,112 @@ Feature: Sharing Then the password progress indicator should not be visible in the client-UI - expected to fail - Scenario: Collaborator should not see to whom a file is shared. + Scenario: Collaborator should not see to whom a file/folder is shared. Given user "Brian" has been created on the server with default attributes and without skeleton files And user "Alice" has uploaded file with content "ownCloud test text file 0" to "/textfile0.txt" on the server + And user "Alice" has created folder "Folder" on the server And user "Alice" has shared file "/textfile0.txt" on the server with user "Brian" with "read, share" permission + And user "Alice" has shared folder "Folder" on the server with user "Brian" with "read, share" permission And user "Brian" has set up a client with default settings When the user opens the sharing dialog of "textfile0.txt" using the client-UI Then the error text "The item is not shared with any users or groups" should be displayed in the sharing dialog + When the user closes the sharing dialog + And the user opens the sharing dialog of "Folder" using the client-UI + Then the error text "The item is not shared with any users or groups" should be displayed in the sharing dialog - Scenario: Group sharing + Scenario: share file and folder to a group Given group "grp1" has been created on the server + And user "Brian" has been created on the server with default attributes and without skeleton files + And user "Brian" has been added to group "grp1" on the server And user "Alice" has uploaded file with content "ownCloud test text file 0" to "/textfile0.txt" on the server + And user "Alice" has created folder "simple-folder" on the server And user "Alice" has set up a client with default settings When the user adds group "grp1" as collaborator of resource "textfile0.txt" with permissions "edit,share" using the client-UI Then group "grp1" should be listed in the collaborators list for file "textfile0.txt" with permissions "edit,share" on the client-UI + When the user adds group "grp1" as collaborator of resource "simple-folder" with permissions "edit,share" using the client-UI + Then group "grp1" should be listed in the collaborators list for file "simple-folder" with permissions "edit,share" on the client-UI + And as "Brian" folder "simple-folder" should exist on the server + And as "Brian" file "textfile0.txt" should exist on the server - Scenario: User (non-author) can not share to a group to which the file is already shared + Scenario: User (non-author) can not share to a group to which the file/folder is already shared Given user "Brian" has been created on the server with default attributes and without skeleton files And group "grp1" has been created on the server And user "Brian" on the server has been added to group "grp1" And user "Alice" has uploaded file with content "ownCloud test text file 0" to "/textfile0.txt" on the server + And user "Alice" has created folder "Folder" on the server And user "Alice" has shared file "/textfile0.txt" on the server with user "Brian" with "read, share, update" permission + And user "Alice" has shared folder "Folder" on the server with user "Brian" with "read, share, update" permission And user "Alice" has shared file "/textfile0.txt" on the server with group "grp1" with "read, share, update" permission + And user "Alice" has shared folder "Folder" on the server with group "grp1" with "read, share, update" permission And user "Brian" has set up a client with default settings When the user tires to share resource "textfile0.txt" with the group "grp1" using the client-UI Then the error "Path already shared with this group" should be displayed + When the user closes the sharing dialog + And the user tires to share resource "Folder" with the group "grp1" using the client-UI + Then the error "Path already shared with this group" should be displayed - Scenario: sharee edits content of a file inside of a shared folder shared by sharer + Scenario: sharee edits content of files shared by sharer Given user "Alice" has created folder "simple-folder" on the server - And user "Alice" has uploaded file with content "ownCloud test text file 0" to "simple-folder/textfile.txt" on the server + And user "Alice" has uploaded file with content "file inside a folder" to "simple-folder/textfile.txt" on the server + And user "Alice" has uploaded file with content "file in the root" to "textfile.txt" on the server And user "Brian" has been created on the server with default attributes and without skeleton files And user "Alice" has shared folder "simple-folder" on the server with user "Brian" with "all" permissions + And user "Alice" has shared file "textfile.txt" on the server with user "Brian" with "all" permissions + And user "Brian" has set up a client with default settings + When the user overwrites the file "textfile.txt" with content "overwrite file in the root" + And the user overwrites the file "simple-folder/textfile.txt" with content "overwrite file inside a folder" + Then as "Brian" the file "simple-folder/textfile.txt" on the server should have the content "overwrite file inside a folder" + And as "Brian" the file "textfile.txt" on the server should have the content "overwrite file in the root" + And as "Alice" the file "simple-folder/textfile.txt" on the server should have the content "overwrite file inside a folder" + And as "Alice" the file "textfile.txt" on the server should have the content "overwrite file in the root" + + + Scenario: sharee tries to edit content of files shared without write permission + Given user "Alice" has created folder "Parent" on the server + And user "Alice" has uploaded file with content "file inside a folder" to "Parent/textfile.txt" on the server + And user "Alice" has uploaded file with content "file in the root" to "textfile.txt" on the server + And user "Brian" has been created on the server with default attributes and without skeleton files + And user "Alice" has shared folder "Parent" on the server with user "Brian" with "read" permissions + And user "Alice" has shared file "textfile.txt" on the server with user "Brian" with "read" permissions And user "Brian" has set up a client with default settings - When the user overwrites the file "simple-folder/textfile.txt" with content "overwrite ownCloud test text file" - Then as "Brian" the file "simple-folder/textfile.txt" on the server should have the content "overwrite ownCloud test text file" - And as "Alice" the file "simple-folder/textfile.txt" on the server should have the content "overwrite ownCloud test text file" + When the user tries to overwrite the file "Parent/textfile.txt" with content "overwrite file inside a folder" + And the user tries to overwrite the file "textfile.txt" with content "overwrite file in the root" + Then as "Brian" the file "Parent/textfile.txt" on the server should have the content "file inside a folder" + And as "Brian" the file "textfile.txt" on the server should have the content "file in the root" + And as "Alice" the file "Parent/textfile.txt" on the server should have the content "file inside a folder" + And as "Alice" the file "textfile.txt" on the server should have the content "file in the root" + + + Scenario: sharee edits shared files and again try to edit after write permission is revoked + Given user "Alice" has uploaded file with content "ownCloud test text file" to "textfile.txt" on the server + And user "Alice" has created folder "FOLDER" on the server + And user "Alice" has uploaded file with content "some content" to "FOLDER/simple.txt" on the server + And user "Brian" has been created on the server with default attributes and without skeleton files + And user "Alice" has shared file "textfile.txt" on the server with user "Brian" with "all" permissions + And user "Alice" has shared folder "FOLDER" on the server with user "Brian" with "all" permissions + And user "Brian" has set up a client with default settings + When the user overwrites the file "textfile.txt" with content "overwrite ownCloud test text file" + And the user overwrites the file "FOLDER/simple.txt" with content "overwrite some content" + Then as "Brian" the file "textfile.txt" on the server should have the content "overwrite ownCloud test text file" + And as "Alice" the file "textfile.txt" on the server should have the content "overwrite ownCloud test text file" + And as "Brian" the file "FOLDER/simple.txt" on the server should have the content "overwrite some content" + And as "Alice" the file "FOLDER/simple.txt" on the server should have the content "overwrite some content" + When the user adds another account with + | server | %local_server% | + | user | Alice | + | password | 1234 | + And the user removes permissions "edit" for user "Brian Murphy" of resource "textfile.txt" using the client-UI + And the user closes the sharing dialog + And the user removes permissions "edit" for user "Brian Murphy" of resource "FOLDER" using the client-UI + And user "Brian" tries to overwrite the file "textfile.txt" with content "again overwrite ownCloud test text file" + And user "Brian" tries to overwrite the file "FOLDER/simple.txt" with content "again overwrite some content" + Then as "Brian" the file "textfile.txt" on the server should have the content "overwrite ownCloud test text file" + And as "Brian" the file "FOLDER/simple.txt" on the server should have the content "overwrite some content" + And as "Alice" the file "textfile.txt" on the server should have the content "overwrite ownCloud test text file" + And as "Alice" the file "FOLDER/simple.txt" on the server should have the content "overwrite some content" Scenario: sharee creates a file and a folder inside a shared folder @@ -157,35 +270,81 @@ Feature: Sharing And as "Alice" folder "Parent/localFolder" should exist on the server - Scenario: sharee tries to edit content of a file inside of a shared folder without write permission + Scenario: sharee tries to create a file and a folder inside a shared folder without write permission Given user "Alice" has created folder "Parent" on the server - And user "Alice" has uploaded file with content "ownCloud test text file" to "Parent/textfile.txt" on the server And user "Brian" has been created on the server with default attributes and without skeleton files And user "Alice" has shared folder "Parent" on the server with user "Brian" with "read" permissions And user "Brian" has set up a client with default settings - When the user tries to overwrite the file "Parent/textfile.txt" with content "overwrite ownCloud test text file" - Then as "Brian" the file "Parent/textfile.txt" on the server should have the content "ownCloud test text file" - And as "Alice" the file "Parent/textfile.txt" on the server should have the content "ownCloud test text file" + When the user waits for folder "Parent" to be synced + And user "Brian" tries to create a file "Parent/localFile.txt" with the following content inside the sync folder + """ + test content + """ + And user "Brian" tries to create a folder "Parent/localFolder" inside the sync folder + And the user waits for file "Parent/localFile.txt" to be synced + And the user waits for folder "Parent/localFolder" to be synced + Then as "Brian" file "Parent/localFile.txt" should not exist on the server + And as "Brian" folder "Parent/localFolder" should not exist on the server + And as "Alice" file "Parent/localFile.txt" should not exist on the server + And as "Alice" folder "Parent/localFolder" should not exist on the server - Scenario: sharee edits content of a file shared by sharer + Scenario: sharee renames the shared file and folder + Given user "Alice" has uploaded file with content "ownCloud test text file 0" to "textfile.txt" on the server + And user "Alice" has created folder "FOLDER" on the server + And user "Brian" has been created on the server with default attributes and without skeleton files + And user "Alice" has shared file "textfile.txt" on the server with user "Brian" with "all" permissions + And user "Alice" has shared file "FOLDER" on the server with user "Brian" with "all" permissions + And user "Brian" has set up a client with default settings + When the user waits for the files to sync + And the user renames a file "textfile.txt" to "lorem.txt" + And the user renames a folder "FOLDER" to "PARENT" + And the user waits for the files to sync + Then as "Brian" folder "FOLDER" should not exist on the server + And as "Brian" file "textfile.txt" should not exist on the server + And as "Brian" folder "PARENT" should exist on the server + And as "Brian" file "lorem.txt" should exist on the server + # File/folder will not change for Alice + And as "Alice" folder "FOLDER" should exist on the server + And as "Alice" file "textfile.txt" should exist on the server + And as "Alice" folder "PARENT" should not exist on the server + And as "Alice" file "lorem.txt" should not exist on the server + + + Scenario: sharee deletes a file and folder shared by sharer Given user "Alice" has uploaded file with content "ownCloud test text file 0" to "textfile.txt" on the server + And user "Alice" has created folder "Folder" on the server And user "Brian" has been created on the server with default attributes and without skeleton files And user "Alice" has shared file "textfile.txt" on the server with user "Brian" with "all" permissions + And user "Alice" has shared file "Folder" on the server with user "Brian" with "all" permissions And user "Brian" has set up a client with default settings - When the user overwrites the file "textfile.txt" with content "overwrite ownCloud test text file" - Then as "Brian" the file "textfile.txt" on the server should have the content "overwrite ownCloud test text file" - And as "Alice" the file "textfile.txt" on the server should have the content "overwrite ownCloud test text file" + When the user waits for file "textfile.txt" to be synced + And the user waits for file "Folder" to be synced + And the user deletes the file "textfile.txt" + And the user deletes the folder "Folder" + And the user waits for the files to sync + Then as "Brian" file "textfile.txt" on the server should not exist + And as "Brian" folder "Folder" on the server should not exist + And as "Alice" file "textfile.txt" on the server should not exist + And as "Alice" folder "Folder" on the server should not exist - Scenario: sharee tries to edit a file shared without write permission - Given user "Brian" has been created on the server with default attributes and without skeleton files - And user "Alice" has uploaded file with content "ownCloud test text file" to "textfile.txt" on the server + Scenario: sharee tries to delete shared file and folder without permissions + Given user "Alice" has uploaded file with content "ownCloud test text file 0" to "textfile.txt" on the server + And user "Alice" has created folder "Folder" on the server + And user "Brian" has been created on the server with default attributes and without skeleton files And user "Alice" has shared file "textfile.txt" on the server with user "Brian" with "read" permissions + And user "Alice" has shared file "Folder" on the server with user "Brian" with "read" permissions And user "Brian" has set up a client with default settings - When the user tries to overwrite the file "textfile.txt" with content "overwrite ownCloud test text file" - Then as "Brian" the file "textfile.txt" on the server should have the content "ownCloud test text file" - And as "Alice" the file "textfile.txt" on the server should have the content "ownCloud test text file" + When the user waits for file "textfile.txt" to be synced + And the user waits for file "Folder" to be synced + And the user tries to delete the file "textfile.txt" + And the user tries to delete the folder "Folder" + And the user waits for the files to sync + Then as "Brian" file "textfile.txt" on the server should exist + And as "Brian" folder "Folder" on the server should exist + And as "Alice" file "textfile.txt" on the server should exist + And as "Alice" folder "Folder" on the server should exist Scenario: reshare a file/folder @@ -200,6 +359,8 @@ Feature: Sharing And the user adds "Carol King" as collaborator of resource "textfile.txt" with permissions "edit,share" using the client-UI Then user "Carol King" should be listed in the collaborators list for file "FOLDER" with permissions "edit,share" on the client-UI And user "Carol King" should be listed in the collaborators list for file "textfile.txt" with permissions "edit,share" on the client-UI + And as "Carol" folder "FOLDER" should exist on the server + And as "Carol" file "textfile.txt" should exist on the server Scenario: try to reshare a file/folder shared without share permission @@ -216,23 +377,18 @@ Feature: Sharing Then the error text "The file can not be shared because it was shared without sharing permission." should be displayed in the sharing dialog - Scenario: unshare a shared file + Scenario: unshare a shared file and folder Given user "Brian" has been created on the server with default attributes and without skeleton files And user "Alice" has uploaded file with content "ownCloud test text file 0" to "textfile0.txt" on the server + And user "Alice" has created folder "simple-folder" on the server And user "Alice" has shared file "textfile0.txt" on the server with user "Brian" with "all" permissions + And user "Alice" has shared folder "simple-folder" on the server with user "Brian" with "all" permissions And user "Alice" has set up a client with default settings When the user unshares the resource "textfile0.txt" for collaborator "Brian Murphy" using the client-UI Then the text "The item is not shared with any users or groups" should be displayed in the sharing dialog And as "Brian" file "textfile0.txt" on the server should not exist - - - Scenario: unshare a shared folder - Given user "Brian" has been created on the server with default attributes and without skeleton files - And user "Alice" has created folder "simple-folder" on the server - And user "Alice" has uploaded file with content "ownCloud test text file 0" to "textfile0.txt" on the server - And user "Alice" has shared folder "simple-folder" on the server with user "Brian" with "all" permissions - And user "Alice" has set up a client with default settings - When the user unshares the resource "simple-folder" for collaborator "Brian Murphy" using the client-UI + When the user closes the sharing dialog + And the user unshares the resource "simple-folder" for collaborator "Brian Murphy" using the client-UI Then the text "The item is not shared with any users or groups" should be displayed in the sharing dialog And as "Brian" folder "simple-folder" on the server should not exist @@ -254,7 +410,6 @@ Feature: Sharing | Carol King | edit,share | | David Lopez | edit,share | - @issue-7423 Scenario: unshare a reshared file Given user "Alice" has uploaded file with content "ownCloud test text file" to "textfile.txt" on the server @@ -267,36 +422,47 @@ Feature: Sharing Then the text "The item is not shared with any users or groups" should be displayed in the sharing dialog @smokeTest - Scenario: simple sharing of a file by public link without password + Scenario: simple sharing of file and folder by public link without password Given user "Alice" has uploaded file with content "ownCloud test text file 0" to "/textfile0.txt" on the server + And user "Alice" has created folder "simple-folder" on the server + And user "Alice" has created folder "simple-folder/child" on the server And user "Alice" has set up a client with default settings When the user creates a new public link for file "textfile0.txt" without password using the client-UI + And the user closes the sharing dialog Then as user "Alice" the file "textfile0.txt" should have a public link on the server And the public should be able to download the file "textfile0.txt" without password from the last created public link by "Alice" on the server + When the user creates a new public link with permissions "Download / View" for folder "simple-folder" without password using the client-UI + Then as user "Alice" the folder "simple-folder" should have a public link on the server + And the public should be able to download the folder "simple-folder/child" without password from the last created public link by "Alice" on the server - Scenario: sharing of a file by public link and deleting the link + Scenario Outline: simple sharing of file and folder by public link with password Given user "Alice" has uploaded file with content "ownCloud test text file 0" to "/textfile0.txt" on the server + And user "Alice" has created folder "simple-folder" on the server And user "Alice" has set up a client with default settings - And user "Alice" has created a public link on the server with following settings - | path | textfile0.txt | - | name | Public-link | - When the user deletes the public link for file "textfile0.txt" - Then as user "Alice" the file "/textfile0.txt" should not have any public link on the server - - - Scenario Outline: simple sharing of a file by public link with password - Given user "Alice" has set up a client with default settings - And user "Alice" has uploaded file with content "ownCloud test text file 0" to "/textfile0.txt" on the server When the user creates a new public link for file "textfile0.txt" with password "" using the client-UI + And the user closes the sharing dialog Then as user "Alice" the file "textfile0.txt" should have a public link on the server And the public should be able to download the file "textfile0.txt" with password "" from the last created public link by "Alice" on the server + When the user creates a new public link with permissions "Download / View" for folder "simple-folder" with password "" using the client-UI + Then as user "Alice" the folder "simple-folder" should have a public link on the server + And the public should be able to download the folder "simple-folder" with password "" from the last created public link by "Alice" on the server Examples: | password | | password1234 | | p@$s!23 | + Scenario: sharing of a file by public link and deleting the link + Given user "Alice" has uploaded file with content "ownCloud test text file 0" to "/textfile0.txt" on the server + And user "Alice" has set up a client with default settings + And user "Alice" has created a public link on the server with following settings + | path | textfile0.txt | + | name | Public-link | + When the user deletes the public link for file "textfile0.txt" + Then as user "Alice" the file "/textfile0.txt" should not have any public link on the server + + Scenario: sharing of a file by public link with password and changing the password Given user "Alice" has set up a client with default settings And user "Alice" has uploaded file with content "ownCloud test text file 0" to "/textfile0.txt" on the server @@ -310,22 +476,37 @@ Feature: Sharing And the public should be able to download the file "textfile0.txt" with password "password1234" from the last created public link by "Alice" on the server + Scenario: simple sharing of a file by public link with default expiration date + Given user "Alice" has set up a client with default settings + And user "Alice" has uploaded file with content "ownCloud test text file" to "/textfile.txt" on the server + When the user creates a new public link with following settings using the client-UI: + | path | textfile.txt | + | expireDate | %default% | + And the user closes the sharing dialog + Then the expiration date of the last public link of file "textfile.txt" should be "%default%" + And as user "Alice" the file "textfile.txt" should have a public link on the server + - Scenario: simple sharing of a file by public link with password and expiration date + Scenario: simple sharing of file and folder by public link with expiration date Given user "Alice" has set up a client with default settings + And user "Alice" has created folder "FOLDER" on the server And user "Alice" has uploaded file with content "ownCloud test text file" to "/textfile.txt" on the server When the user creates a new public link with following settings using the client-UI: | path | textfile.txt | - | password | pass123 | | expireDate | 2031-10-14 | Then as user "Alice" the file "textfile.txt" should have a public link on the server And the fields of the last public link share response of user "Alice" should include on the server | expireDate | 2031-10-14 | - And the public should be able to download the file "textfile.txt" with password "pass123" from the last created public link by "Alice" on the server - + When the user closes the sharing dialog + And the user creates a new public link with following settings using the client-UI: + | path | FOLDER | + | expireDate | 2031-12-30 | + Then as user "Alice" the file "FOLDER" should have a public link on the server + And the fields of the last public link share response of user "Alice" should include on the server + | expireDate | 2031-12-30 | @skip @issue-9321 - Scenario: user changes the expiration date of an already existing public link using webUI + Scenario: user changes the expiration date of an already existing public link for file using client-UI Given user "Alice" has uploaded file with content "ownCloud test text file 0" to "/textfile0.txt" on the server And user "Alice" has set up a client with default settings And user "Alice" has created a public link on the server with following settings @@ -335,25 +516,10 @@ Feature: Sharing When the user opens the public links dialog of "textfile0.txt" using the client-UI And the user edits the public link named "Public link" of file "textfile0.txt" changing following | expireDate | 2038-07-21 | - Then the fields of the last public link share response of user "Alice" should include on the server + And the user closes the sharing dialog + And the fields of the last public link share response of user "Alice" should include on the server | expireDate | 2038-07-21 | - @smokeTest - Scenario: simple sharing of a folder by public link without password - Given user "Alice" has created folder "simple-folder" on the server - And user "Alice" has set up a client with default settings - When the user creates a new public link with permissions "Download / View" for folder "simple-folder" without password using the client-UI - Then as user "Alice" the folder "simple-folder" should have a public link on the server - And the public should be able to download the folder "lorem.txt" without password from the last created public link by "Alice" on the server - - - Scenario: simple sharing of a folder by public link with password - Given user "Alice" has created folder "simple-folder" on the server - And user "Alice" has set up a client with default settings - When the user creates a new public link with permissions "Download / View" for folder "simple-folder" with password "pass123" using the client-UI - Then as user "Alice" the folder "simple-folder" should have a public link on the server - And the public should be able to download the folder "lorem.txt" with password "pass123" from the last created public link by "Alice" on the server - @skip @issue-9321 Scenario: user changes the expiration date of an already existing public link for folder using client-UI Given user "Alice" has created folder "simple-folder" on the server @@ -366,7 +532,8 @@ Feature: Sharing When the user opens the public links dialog of "simple-folder" using the client-UI And the user edits the public link named "Public link" of file "simple-folder" changing following | expireDate | 2038-07-21 | - Then the fields of the last public link share response of user "Alice" on the server should include + And the user closes the sharing dialog + And the fields of the last public link share response of user "Alice" on the server should include | expireDate | 2038-07-21 | @@ -389,7 +556,7 @@ Feature: Sharing | Contributor | create | - Scenario: sharing by public link with "Uploader" role + Scenario: sharing a folder by public link with "Uploader" role and check if file can be downloaded Given user "Alice" has created folder "simple-folder" on the server And user "Alice" has created file "simple-folder/lorem.txt" on the server And user "Alice" has set up a client with default settings @@ -406,8 +573,7 @@ Feature: Sharing Scenario Outline: change collaborator permissions of a file & folder - Given the setting "shareapi_auto_accept_share" on the server of app "core" has been set to "yes" - And the administrator on the server has set the default folder for received shares to "Shares" + Given the administrator on the server has set the default folder for received shares to "Shares" And user "Alice" has created folder "simple-folder" on the server And user "Alice" has created file "lorem.txt" on the server And user "Brian" has been created on the server with default attributes and without skeleton files @@ -440,17 +606,3 @@ Feature: Sharing | edit | read, share | read, share | | share | read, update, create, delete | read,update | | edit,share | read | read | - - - Scenario: sharee deletes a file shared by sharer - Given the setting "shareapi_auto_accept_share" on the server of app "core" has been set to "yes" - And the administrator on the server has set the default folder for received shares to "Shares" - And user "Alice" has uploaded file with content "ownCloud test text file 0" to "textfile.txt" on the server - And user "Brian" has been created on the server with default attributes and without skeleton files - And user "Alice" has shared file "textfile.txt" on the server with user "Brian" with "all" permissions - And user "Brian" has set up a client with default settings - When the user waits for file "Shares/textfile.txt" to be synced - And the user deletes the file "Shares/textfile.txt" - And the user waits for the files to sync - Then as "Brian" file "Shares/textfile0.txt" on the server should not exist - And as "Alice" file "textfile0.txt" on the server should not exist