Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[tests-only] change collaborator permissions #8788

Merged
merged 1 commit into from
Jul 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions test/gui/shared/scripts/names.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,4 @@
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}
32 changes: 28 additions & 4 deletions test/gui/shared/scripts/pageObjects/SharingDialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -65,10 +74,8 @@ def addCollaborator(self, receiver, permissions):
)
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
):
Expand All @@ -82,3 +89,20 @@ def addCollaborator(self, receiver, permissions):

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)
)
34 changes: 34 additions & 0 deletions test/gui/shared/steps/steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
38 changes: 38 additions & 0 deletions test/gui/tst_sharing/test.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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 |