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/shared | |
parent | d25f15af24912a57a4b1b18524ff78b5a575d6a6 (diff) |
[tests-only] change collaborator permissions (#8788)
Diffstat (limited to 'test/gui/shared')
-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 |
3 files changed, 63 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) |