diff options
author | Talank <talank@gces.edu.np> | 2021-07-15 13:50:37 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-15 13:50:37 +0300 |
commit | 89c18b6d6451496a162101e5c63d1b4071d5ffd2 (patch) | |
tree | a64a673693f1c31d3e7b6b8faf165835a1c6edd9 /test/gui/shared | |
parent | a600f96bc1cb2c07a4d776f327e205d7c63f582b (diff) |
Group share tests added (#8695)
Diffstat (limited to 'test/gui/shared')
-rw-r--r-- | test/gui/shared/scripts/pageObjects/SharingDialog.py | 54 | ||||
-rw-r--r-- | test/gui/shared/steps/steps.py | 39 |
2 files changed, 71 insertions, 22 deletions
diff --git a/test/gui/shared/scripts/pageObjects/SharingDialog.py b/test/gui/shared/scripts/pageObjects/SharingDialog.py index c1af02f9a..2e5e54b88 100644 --- a/test/gui/shared/scripts/pageObjects/SharingDialog.py +++ b/test/gui/shared/scripts/pageObjects/SharingDialog.py @@ -37,15 +37,15 @@ class SharingDialog: "type": "QLabel", "visible": 1, } - ERROR_SHOWN_ON_SHARING_DIALOG = { + SHARING_DIALOG = { "type": "QLabel", "unnamed": 1, "visible": 1, "window": names.sharingDialog_OCC_ShareDialog, } + SHARING_DIALOG_ERROR = {"name": "errorLabel", "type": "QLabel", "visible": 1} def getAvailablePermission(self): - editChecked = squish.waitForObjectExists(self.EDIT_PERMISSIONS_CHECKBOX).checked shareChecked = squish.waitForObjectExists( self.SHARE_PERMISSIONS_CHECKBOX @@ -53,7 +53,34 @@ class SharingDialog: return editChecked, shareChecked - def addCollaborator(self, receiver, permissions): + def addCollaborator(self, receiver, permissions, isGroup=False): + self.selectCollaborator(receiver, isGroup) + permissionsList = permissions.split(",") + + editChecked, shareChecked = self.getAvailablePermission() + + if ('edit' in permissionsList and editChecked == False) or ( + 'edit' not in permissionsList and editChecked == True + ): + squish.clickButton(squish.waitForObject(self.EDIT_PERMISSIONS_CHECKBOX)) + if ('share' in permissionsList and shareChecked == False) or ( + 'share' not in permissionsList and shareChecked == True + ): + 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) + + def getErrorText(self): + return str(squish.waitForObjectExists(self.SHARING_DIALOG_ERROR).text) + + def selectCollaborator(self, receiver, isGroup=False): + postFixInSuggestion = "" + if isGroup: + postFixInSuggestion = " (group)" + squish.mouseClick( squish.waitForObject(self.SHARE_WITH_COLLABORATOR_INPUT_FIELD), 0, @@ -66,29 +93,14 @@ class SharingDialog: receiver, ) squish.mouseClick( - squish.waitForObjectItem(self.SUGGESTED_COLLABORATOR, receiver), + squish.waitForObjectItem( + self.SUGGESTED_COLLABORATOR, receiver + postFixInSuggestion + ), 0, 0, squish.Qt.NoModifier, squish.Qt.LeftButton, ) - permissionsList = permissions.split(",") - - editChecked, shareChecked = self.getAvailablePermission() - - if ('edit' in permissionsList and editChecked == False) or ( - 'edit' not in permissionsList and editChecked == True - ): - squish.clickButton(squish.waitForObject(self.EDIT_PERMISSIONS_CHECKBOX)) - if ('share' in permissionsList and shareChecked == False) or ( - 'share' not in permissionsList and shareChecked == True - ): - squish.clickButton(squish.waitForObject(self.SHARE_PERMISSIONS_CHECKBOX)) - - squish.clickButton(squish.waitForObject(self.SHARING_DIALOG_CLOSE_BUTTON)) - - def getErrorText(self): - return str(squish.waitForObjectExists(self.ERROR_SHOWN_ON_SHARING_DIALOG).text) def removePermissions(self, permissions): removePermissionsList = permissions.split(",") diff --git a/test/gui/shared/steps/steps.py b/test/gui/shared/steps/steps.py index f402d3d04..622507050 100644 --- a/test/gui/shared/steps/steps.py +++ b/test/gui/shared/steps/steps.py @@ -205,10 +205,31 @@ def step(context, receiver, resource, permissions): shareItem.addCollaborator(receiver, permissions) +@When( + 'the user adds group "|any|" as collaborator of resource "|any|" with permissions "|any|" using the client-UI' +) +def step(context, receiver, resource, permissions): + openSharingDialog(context, resource) + shareItem = SharingDialog() + shareItem.addCollaborator(receiver, permissions, True) + + @Then( 'user "|any|" should be listed in the collaborators list for file "|any|" with permissions "|any|" on the client-UI' ) def step(context, receiver, resource, permissions): + collaboratorShouldBeListed(context, receiver, resource, permissions) + + +@Then( + 'group "|any|" should be listed in the collaborators list for file "|any|" with permissions "|any|" on the client-UI' +) +def step(context, receiver, resource, permissions): + receiver += " (group)" + collaboratorShouldBeListed(context, receiver, resource, permissions) + + +def collaboratorShouldBeListed(context, receiver, resource, permissions): resource = substituteInLineCodes(context, resource) socketConnect = syncstate.SocketConnect() socketConnect.sendCommand("SHARE:" + resource + "\n") @@ -447,7 +468,7 @@ def step(context, receiver, resource): @Then('the error text "|any|" should be displayed in the sharing dialog') def step(context, fileShareContext): shareItem = SharingDialog() - errorText = shareItem.getErrorText() + errorText = shareItem.getSharingDialogMessage() test.compare( errorText, fileShareContext, @@ -687,3 +708,19 @@ def step(context, permissions, user, resource): if 'share' in permissionsList: test.compare(shareChecked, False) + + +@Then('the error "|any|" should be displayed') +def step(context, errorMessage): + sharingDialog = SharingDialog() + test.compare(sharingDialog.getErrorText(), errorMessage) + + +@When( + 'the user tires to share resource "|any|" with the group "|any|" using the client-UI' +) +def step(context, resource, group): + openSharingDialog(context, resource) + + sharingDialog = SharingDialog() + sharingDialog.selectCollaborator(group, True) |