diff options
author | Swoichha Adhikari <swoichhaa@gmail.com> | 2021-07-01 06:17:49 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-01 06:17:49 +0300 |
commit | ea03dab027840d112fa8e44a493c9aaaefa1fed1 (patch) | |
tree | a3eef98f85512a8b5624859941d6f177dbdb9f7b /test/gui | |
parent | d25f15af24912a57a4b1b18524ff78b5a575d6a6 (diff) |
[tests-only] change collaborator permissions (#8788)
Diffstat (limited to 'test/gui')
-rw-r--r-- | test/gui/shared/scripts/names.py | 1 | ||||
-rw-r--r-- | test/gui/shared/scripts/pageObjects/SharingDialog.py | 32 | ||||
-rw-r--r-- | test/gui/shared/steps/steps.py | 34 | ||||
-rw-r--r-- | test/gui/tst_sharing/test.feature | 38 |
4 files changed, 101 insertions, 4 deletions
diff --git a/test/gui/shared/scripts/names.py b/test/gui/shared/scripts/names.py index 7188f72f9..01df761a5 100644 --- a/test/gui/shared/scripts/names.py +++ b/test/gui/shared/scripts/names.py @@ -98,3 +98,4 @@ oCC_IssuesWidget_tableView_QTableView = {"container": qt_tabwidget_stackedwidget o_tableView_0_1_QModelIndex = {"column": 1, "container": oCC_IssuesWidget_tableView_QTableView, "row": 0, "type": "QModelIndex"} settings_settingsdialog_toolbutton_Add_account_QToolButton = {"name": "settingsdialog_toolbutton_Add account", "type": "QToolButton", "visible": 1, "window": settings_OCC_SettingsDialog} settings_settingsdialog_toolbutton_Activity_QToolButton = {"name": "settingsdialog_toolbutton_Activity", "type": "QToolButton", "visible": 1, "window": settings_OCC_SettingsDialog} +sharingDialog_Close_QPushButton = {"text": "Close", "type": "QPushButton", "unnamed": 1, "visible": 1, "window": sharingDialog_OCC_ShareDialog}
\ No newline at end of file diff --git a/test/gui/shared/scripts/pageObjects/SharingDialog.py b/test/gui/shared/scripts/pageObjects/SharingDialog.py index 0447593eb..c1af02f9a 100644 --- a/test/gui/shared/scripts/pageObjects/SharingDialog.py +++ b/test/gui/shared/scripts/pageObjects/SharingDialog.py @@ -44,6 +44,15 @@ class SharingDialog: "window": names.sharingDialog_OCC_ShareDialog, } + def getAvailablePermission(self): + + editChecked = squish.waitForObjectExists(self.EDIT_PERMISSIONS_CHECKBOX).checked + shareChecked = squish.waitForObjectExists( + self.SHARE_PERMISSIONS_CHECKBOX + ).checked + + return editChecked, shareChecked + def addCollaborator(self, receiver, permissions): squish.mouseClick( squish.waitForObject(self.SHARE_WITH_COLLABORATOR_INPUT_FIELD), @@ -65,10 +74,8 @@ class SharingDialog: ) permissionsList = permissions.split(",") - editChecked = squish.waitForObjectExists(self.EDIT_PERMISSIONS_CHECKBOX).checked - shareChecked = squish.waitForObjectExists( - self.SHARE_PERMISSIONS_CHECKBOX - ).checked + editChecked, shareChecked = self.getAvailablePermission() + if ('edit' in permissionsList and editChecked == False) or ( 'edit' not in permissionsList and editChecked == True ): @@ -82,3 +89,20 @@ class SharingDialog: def getErrorText(self): return str(squish.waitForObjectExists(self.ERROR_SHOWN_ON_SHARING_DIALOG).text) + + def removePermissions(self, permissions): + removePermissionsList = permissions.split(",") + ( + isEditPermissionAvailable, + isSharePermissionAvailable, + ) = self.getAvailablePermission() + + if 'share' in removePermissionsList and isSharePermissionAvailable: + squish.clickButton( + squish.waitForObject(names.scrollArea_permissionShare_QCheckBox) + ) + + if 'edit' in removePermissionsList and isEditPermissionAvailable: + squish.clickButton( + squish.waitForObject(names.scrollArea_permissionsEdit_QCheckBox) + ) diff --git a/test/gui/shared/steps/steps.py b/test/gui/shared/steps/steps.py index 674d464f8..d3ef1d9a8 100644 --- a/test/gui/shared/steps/steps.py +++ b/test/gui/shared/steps/steps.py @@ -646,3 +646,37 @@ def step(context): def step(context): for tabName in context.table: test.vp(tabName[0]) + + +@When( + 'the user removes permissions "|any|" for user "|any|" of resource "|any|" using the client-UI' +) +def step(context, permissions, receiver, resource): + openSharingDialog(context, resource) + test.compare( + str(waitForObjectExists(names.scrollArea_sharedWith_QLabel).text), receiver + ) + + shareItem = SharingDialog() + shareItem.removePermissions(permissions) + + +@When("the user closes the sharing dialog") +def step(context): + clickButton(waitForObject(names.sharingDialog_Close_QPushButton)) + + +@Then( + '"|any|" permissions should not be displayed for user "|any|" for resource "|any|" on the client-UI' +) +def step(context, permissions, user, resource): + permissionsList = permissions.split(',') + + shareItem = SharingDialog() + editChecked, shareChecked = shareItem.getAvailablePermission() + + if 'edit' in permissionsList: + test.compare(editChecked, False) + + if 'share' in permissionsList: + test.compare(shareChecked, False) diff --git a/test/gui/tst_sharing/test.feature b/test/gui/tst_sharing/test.feature index 957058cfc..f92187219 100644 --- a/test/gui/tst_sharing/test.feature +++ b/test/gui/tst_sharing/test.feature @@ -134,3 +134,41 @@ Feature: Sharing | path | /simple-folder | | name | Public link | And the public should not be able to download the file "lorem.txt" from the last created public link by "Alice" on the server + + + Scenario Outline: change collaborator permissions of a file & folder + Given user "Alice" has created on the server folder "simple-folder" + And user "Alice" on the server has created file "lorem.txt" + And user "Brian" has been created on the server with default attributes and without skeleton files + And user "Alice" on the server has shared folder "simple-folder" with user "Brian" with "all" permissions + And user "Alice" on the server has shared file "lorem.txt" with user "Brian" with "all" permissions + And user "Alice" has set up a client with default settings + When the user removes permissions "<permissions>" for user "Brian Murphy" of resource "%client_sync_path%/simple-folder" using the client-UI + And the user closes the sharing dialog + And the user removes permissions "<permissions>" for user "Brian Murphy" of resource "%client_sync_path%/lorem.txt" using the client-UI + Then "<permissions>" permissions should not be displayed for user "Brian Murphy" for resource "%client_sync_path%/simple-folder" on the client-UI + And "<permissions>" permissions should not be displayed for user "Brian Murphy" for resource "%client_sync_path%/lorem.txt" on the client-UI + And user "Alice" on the server should have a share with these details: + | field | value | + | uid_owner | Alice | + | share_with | Brian | + | share_type | user | + | file_target | /Shares/simple-folder | + | item_type | folder | + | permissions | <expected-folder-permission> | + And user "Alice" on the server should have a share with these details: + | field | value | + | uid_owner | Alice | + | share_with | Brian | + | share_type | user | + | file_target | /Shares/lorem.txt | + | item_type | file | + | permissions | <expected-file-permission> | + Examples: + | permissions | expected-folder-permission | expected-file-permission | + | edit | read, share | read, share | + | share | read, update, create, delete | read,update | + | edit,share | read | read | + + + |