def check_small_business_integrity(): if (ldtp.getrowcount(main_window, 'tblTableContent') != 9): raise ldtp.LdtpExecutionError( "Newly created database does not contain all 8 rows" ) # Note there is one placeholder row ldtp.selecttab(main_window, 'ptlListOrDetailsView', 'Details')
def backup_simple(finish=True, error=None, timeout=400, backend = None, encrypt = True, dest = None, includes = None, excludes = None, add_srcdir = True): global srcdir if add_srcdir: if includes is not None: includes = [os.path.join(srcdir, f) for f in includes] if excludes is not None: excludes = [os.path.join(srcdir, f) for f in excludes] start_deja_dup(executable='deja-dup-preferences') if guivisible('frmBackup', 'btnJustshowmybackupsettings'): ldtp.click('frmBackup', 'btnJustshowmybackupsettings') remap('frmBackup') if backend is not None or includes is not None or excludes is not None: walk_prefs(backend=backend, dest=dest, includes=includes, excludes=excludes) ldtp.selecttab('frmBackup', 'ptlCategories', 'Overview') ldtp.click('frmBackup', 'btnBackUpNow') waitforgui('frmBackUp') if encrypt is not None: wait_for_encryption('frmBackUp', encrypt) if finish: error = strip_obj_name(error) wait_for_finish('frmBackUp', error, timeout, prefix=True)
def selectTab(objs=None): ''' select a "page tab" in a "page tab list". If objs is None, it uses CurrentObjs. ''' objs, rstr = __checkObjs(objs) r = [] for o in objs: #if getRole(o) == 'page tab' : #... r.append(ldtp.selecttab(subContext(o),subParent(o),o)) return __checkR(r,rstr)
def restore_simple(path, date=None, backend = None, encrypt=True, dest = None): start_deja_dup(executable='deja-dup-preferences') if guivisible('frmBackup', 'btnIwanttorestorefilesfromapreviousbackup…'): ldtp.click('frmBackup', 'btnIwanttorestorefilesfromapreviousbackup…') else: ldtp.selecttab('frmBackup', 'ptlCategories', 'Overview') ldtp.click('frmBackup', 'btnRestore…') waitforgui('frmRestore') if backend is not None: walk_restore_prefs('frmRestore', backend, dest) ldtp.click('frmRestore', 'btnForward') wait_for_finish('frmRestore', 'lblRestoreFromWhen?', 200) if date: ldtp.comboselect('frmRestore', 'cboDate', date) ldtp.click('frmRestore', 'btnForward') ldtp.click('frmRestore', 'rbtnRestoretospecificfolder') ldtp.comboselect('frmRestore', 'cboRestorefolder', 'Other...') waitforgui('dlgChoosedestinationforrestoredfiles') # Make sure path ends in '/' if path[-1] != '/': path += '/' ldtp.selectlastrow('dlgChoosedestinationforrestoredfiles', 'tblPlaces') # must switch away from Recent Files view to get txtLocation ldtp.wait(1) # give the dlg a second to settle ldtp.settextvalue('dlgChoosedestinationforrestoredfiles', 'txtLocation', path) ldtp.click('dlgChoosedestinationforrestoredfiles', 'btnOpen') ldtp.wait(1) # give the combo a second to settle ldtp.click('frmRestore', 'btnForward') ldtp.wait(1) # give the dlg a second to settle ldtp.click('frmRestore', 'btnRestore') if encrypt is not None: wait_for_encryption('frmRestore', encrypt) wait_for_finish('frmRestore', 'lblYourfilesweresuccessfullyrestored', 400) ldtp.click('frmRestore', 'btnClose') ldtp.waittillguinotexist('frmRestore')
def walk_prefs(backend, dest, includes, excludes): if backend == 'file': ldtp.selecttab('frmBackup', 'ptlCategories', 'Storage') if dest is None: dest = get_temp_name('local') os.system('mkdir -p %s' % dest) elif dest[0] != '/' and dest.find(':') == -1: dest = os.getcwd()+'/'+dest ldtp.comboselect('frmBackup', 'cboLocation', 'Local Folder') wait_for_combo('frmBackup', 'cboLocation', 'Local Folder') # this menu acts slowly, because of custom widgets remap('frmBackup') ldtp.settextvalue('frmBackup', 'txtFileFolder', dest) ldtp.wait(1) # without this, sometimes ldtp moves so fast, deja-dup doesn't notice dest ldtp.selecttab('frmBackup', 'ptlCategories', 'Folders') if includes is not None: set_file_list('frmBackup', 'tblIncludeList', 'btnIncludeListAdd', 'btnIncludeListRemove', includes) if excludes is not None: set_file_list('frmBackup', 'tblExcludeList', 'btnExcludeListAdd', 'btnExcludeListRemove', excludes)
def select_tab(self, window_name, tab_list_name, tab_name): """ Select the given tab name in the tab list :param window_name: :param tab_list_name: :param tab_name: :return:1 if the tab is selected, otherwise LdtpExecutionError will be thrown """ try: self._info('select tab (%s, %s, %s)' % (window_name, tab_list_name, tab_name)) return ldtp.selecttab(window_name, tab_list_name, tab_name) except LdtpExecutionError: raise LdtpExecutionError('select tab failed.')
def click_tab(self, tab_name): ldtp.selecttab(RHSMGuiLocator().get_locator("main-window"), RHSMGuiLocator().get_locator("all-tabs"), RHSMGuiLocator().get_locator(tab_name))
def check_small_business_integrity(): if(ldtp.getrowcount(main_window, 'tblTableContent') != 9): raise ldtp.LdtpExecutionError("Newly created database does not contain all 8 rows"); # Note there is one placeholder row ldtp.selecttab(main_window, 'ptlListOrDetailsView', 'Details')