def getAvailablePermission(self): editChecked = squish.waitForObjectExists( self.EDIT_PERMISSIONS_CHECKBOX).checked shareChecked = squish.waitForObjectExists( self.SHARE_PERMISSIONS_CHECKBOX).checked return editChecked, shareChecked
def createPublicLink(self, context, resource, password='', permissions=''): radioObjectName = '' if permissions: radioObjectName = self.getRadioObjectForPermssion(permissions) test.compare( str(squish.waitForObjectExists(self.ITEM_TO_SHARE).text), resource.replace(context.userData['clientSyncPathUser1'], ''), ) if radioObjectName: test.compare(str(squish.waitForObjectExists(radioObjectName).text), permissions) squish.clickButton(squish.waitForObject(radioObjectName)) if password: squish.clickButton(squish.waitForObject(self.PASSWORD_CHECKBOX)) squish.mouseClick( squish.waitForObject(self.PASSWORD_CHECKBOX), 0, 0, squish.Qt.NoModifier, squish.Qt.LeftButton, ) squish.type( squish.waitForObject(self.PASSWORD_CHECKBOX), password, ) squish.clickButton(squish.waitForObject(self.CREATE_SHARE_BUTTON)) squish.waitFor(lambda: (squish.waitForObject( names.linkShares_0_0_QModelIndex).displayText == "Public link"))
def checkFileExist(self, filename): squish.waitForObject(names.settings_OCC_SettingsDialog) squish.waitForObjectExists({ "column": 1, "container": names.oCC_IssuesWidget_tableView_QTableView, "text": RegularExpression(buildConflictedRegex(filename)), "type": "QModelIndex", })
def getDisplayedAccountText(self, displayname, host): return str( squish.waitForObjectExists({ "name": "settingsdialog_toolbutton_" + displayname + "@" + host, "type": "QToolButton", "visible": 1, }).text)
def setExpirationDate(self, context, publicLinkName, resource): test.compare( str(squish.waitForObjectExists(self.ITEM_TO_SHARE).text), resource, ) test.compare( str(squish.waitForObjectExists(self.PUBLIC_LINK_NAME).text), publicLinkName, ) expDate = [] for row in context.table: if row[0] == 'expireDate': expDate = datetime.datetime.strptime(row[1], '%Y-%m-%d') expYear = expDate.year - 2000 squish.mouseClick( squish.waitForObject(self.EXPIRATION_DATE_FIELD), 0, 0, squish.Qt.NoModifier, squish.Qt.LeftButton, ) squish.nativeType("<Delete>") squish.nativeType("<Delete>") squish.nativeType(expDate.month) squish.nativeType(expDate.day) squish.nativeType(expYear) squish.nativeType("<Return>") squish.testSettings.silentVerifications = True squish.waitFor(lambda: (test.xvp( "publicLinkExpirationProgressIndicatorInvisible"))) waitFor(lambda: (test.vp("publicLinkExpirationProgressIndicatorInvisible"))) squish.testSettings.silentVerifications = False test.compare( str( squish.waitForObjectExists( self.EXPIRATION_DATE_FIELD).displayText), str(expDate.month) + "/" + str(expDate.day) + "/" + str(expYear), )
def clickTab(self, tabName): # It might take some time for all files to sync except the expected number of unsynced files squish.snooze(10) tabFound = False # Selecting tab by name fails for "Not Synced" when there are no unsynced files # Because files count will be appended like "Not Synced (2)" # So to overcome this the following approach has been implemented tabCount = squish.waitForObjectExists(self.SUBTAB_CONTAINER).count for index in range(tabCount): tabText = squish.waitForObjectExists({ "container": names.stack_qt_tabwidget_tabbar_QTabBar, "index": index, "type": "TabItem", }).text if tabName in tabText: tabFound = True squish.clickTab(squish.waitForObject(self.SUBTAB), tabText) break if not tabFound: raise Exception("Tab not found: " + tabName)
def selectSyncFolder(self, context): clientDetails = getClientDetails(context) try: squish.clickButton(squish.waitForObject(self.ERROR_OK_BUTTON)) except LookupError: pass squish.clickButton(squish.waitForObject(self.SELECT_LOCAL_FOLDER)) squish.mouseClick(squish.waitForObject(self.DIRECTORY_NAME_BOX)) squish.type( squish.waitForObject(self.DIRECTORY_NAME_BOX), clientDetails['localfolder'] ) squish.clickButton(squish.waitForObject(self.CHOOSE_BUTTON)) test.compare( str(squish.waitForObjectExists(self.SELECT_LOCAL_FOLDER).text), self.sanitizeFolderPath(clientDetails['localfolder']), )
def getErrorText(self): return str(squish.waitForObjectExists(self.SHARING_DIALOG_ERROR).text)
def getSharingDialogMessage(self): return str(squish.waitForObjectExists(self.SHARING_DIALOG).text)