diff options
author | Swoichha Adhikari <swoichhaa@gmail.com> | 2021-12-13 13:14:32 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-13 13:14:32 +0300 |
commit | f100deb90127fa169b5d25e380569dadbf6fdf07 (patch) | |
tree | 80e3b71134da3e2f6c37a720745dc813039abebf /test | |
parent | bad73476715612cf316aeab5d3d7f955270677f5 (diff) |
[tests-only]add test for sharing file to multiple users (#9188)
Diffstat (limited to 'test')
-rw-r--r-- | test/gui/shared/scripts/pageObjects/SharingDialog.py | 5 | ||||
-rw-r--r-- | test/gui/shared/steps/steps.py | 66 | ||||
-rw-r--r-- | test/gui/tst_sharing/test.feature | 19 |
3 files changed, 85 insertions, 5 deletions
diff --git a/test/gui/shared/scripts/pageObjects/SharingDialog.py b/test/gui/shared/scripts/pageObjects/SharingDialog.py index a8a4f1ea5..79388926f 100644 --- a/test/gui/shared/scripts/pageObjects/SharingDialog.py +++ b/test/gui/shared/scripts/pageObjects/SharingDialog.py @@ -74,8 +74,6 @@ class SharingDialog: ): squish.clickButton(squish.waitForObject(self.SHARE_PERMISSIONS_CHECKBOX)) - squish.clickButton(squish.waitForObject(self.SHARING_DIALOG_CLOSE_BUTTON)) - def getSharingDialogMessage(self): return str(squish.waitForObjectExists(self.SHARING_DIALOG).text) @@ -130,3 +128,6 @@ class SharingDialog: str(squish.waitForObjectExists(self.ITEM_TO_SHARE).text), resource, ) + + def closeSharingDialog(self): + squish.clickButton(squish.waitForObject(self.SHARING_DIALOG_CLOSE_BUTTON)) diff --git a/test/gui/shared/steps/steps.py b/test/gui/shared/steps/steps.py index 73f4471e8..3f0df5da4 100644 --- a/test/gui/shared/steps/steps.py +++ b/test/gui/shared/steps/steps.py @@ -239,6 +239,21 @@ def step(context, receiver, resource, permissions): openSharingDialog(context, resource) shareItem = SharingDialog() shareItem.addCollaborator(receiver, permissions) + shareItem.closeSharingDialog() + + +@When('the user adds following collaborators of resource "|any|" using the client-UI') +def step(context, resource): + openSharingDialog(context, resource) + shareItem = SharingDialog() + + # In the following loop we are trying to share resource with given permission to one user at a time given from the data table in the feature file + for row in context.table[1:]: + receiver = row[0] + permissions = row[1] + shareItem.addCollaborator(receiver, permissions) + + shareItem.closeSharingDialog() @When( @@ -248,6 +263,7 @@ def step(context, receiver, resource, permissions): openSharingDialog(context, resource) shareItem = SharingDialog() shareItem.addCollaborator(receiver, permissions, True) + shareItem.closeSharingDialog() @Then( @@ -265,14 +281,39 @@ def step(context, receiver, resource, permissions): collaboratorShouldBeListed(context, receiver, resource, permissions) -def collaboratorShouldBeListed(context, receiver, resource, permissions): +def collaboratorShouldBeListed( + context, receiver, resource, permissions, receiverCount=0 +): resource = getResourcePath(context, resource) socketConnect = syncstate.SocketConnect() socketConnect.sendCommand("SHARE:" + resource + "\n") permissionsList = permissions.split(',') - test.compare( - str(waitForObjectExists(names.scrollArea_sharedWith_QLabel).text), receiver + + waitForObject( + { + "container": names.sharingDialogUG_scrollArea_QScrollArea, + "name": "sharedWith", + "type": "QLabel", + "visible": 1, + } + ) + + # findAllObjects: This functionfinds and returns a list of object references identified by the symbolic or real (multi-property) name objectName. + sharedWithObj = findAllObjects( + { + "container": names.sharingDialogUG_scrollArea_QScrollArea, + "name": "sharedWith", + "type": "QLabel", + "visible": 1, + } ) + + # we use sharedWithObj list from above while verifying if users are listed or not. + # For this we need an index value i.e receiverCount + # For 1st user in the list the index will be 0 which is receiverCount default value + # For 2nd user in the list the index will be 1 and so on + + test.compare(str(sharedWithObj[receiverCount].text), receiver) test.compare( waitForObjectExists(names.scrollArea_permissionsEdit_QCheckBox).checked, ('edit' in permissionsList), @@ -281,6 +322,8 @@ def collaboratorShouldBeListed(context, receiver, resource, permissions): waitForObjectExists(names.scrollArea_permissionShare_QCheckBox).checked, ('share' in permissionsList), ) + shareItem = SharingDialog() + shareItem.closeSharingDialog() @When('the user waits for the files to sync') @@ -1104,3 +1147,20 @@ def step(context, resource): def step(context, publicLinkName, password): publicLinkDialog = PublicLinkDialog() publicLinkDialog.changePassword(publicLinkName, password) + + +@Then( + 'the following users should be listed in as collaborators for file "|any|" on the client-UI' +) +def step(context, resource): + # Here we are trying to verify if the user added in when step are listed in the client-UI or not + # We now have a variable name receiverCount which is used in collaboratorShouldBeListed function call + receiverCount = 0 + for row in context.table[1:]: + receiver = row[0] + permissions = row[1] + + collaboratorShouldBeListed( + context, receiver, resource, permissions, receiverCount + ) + receiverCount += 1 diff --git a/test/gui/tst_sharing/test.feature b/test/gui/tst_sharing/test.feature index a05d8232b..210eb27d7 100644 --- a/test/gui/tst_sharing/test.feature +++ b/test/gui/tst_sharing/test.feature @@ -107,6 +107,25 @@ Feature: Sharing 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 + + Scenario: share a file with many users + 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 "David" 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 set up a client with default settings + When the user adds following collaborators of resource "textfile0.txt" using the client-UI + | user | permissions | + | Brian Murphy | edit,share | + | Carol King | edit,share | + | David Lopez | edit,share | + Then the following users should be listed in as collaborators for file "textfile0.txt" on the client-UI + | user | permissions | + | Brian Murphy | edit,share | + | Carol King | edit,share | + | David Lopez | edit,share | + + @issue-7423 Scenario: unshare a reshared file Given the setting "shareapi_auto_accept_share" on the server of app "core" has been set to "no" |