Example #1
0
def set_file_list(dlg, obj, addObj, removeObj, files):
  # Clear existing items
  while (True):
    try:
      ldtp.selectrowindex(dlg, obj, 0)
      ldtp.click(dlg, removeObj)
    except:
      break

  # FIXME compiz and modal windows tend to not work with ldtp
  set_settings_value('include-list' if obj == 'tblIncludeList' else 'exclude-list',
                     '[%s]' % ', '.join(["'%s'" % os.path.abspath(x) for x in files]))
  return

  # Add new items
  for f in files:
    ldtp.click(dlg, addObj)
    waitforgui('dlgChoosefolders')
    # Make sure path ends in '/'
    if f[-1] != '/':
      f += '/'
    ldtp.selectlastrow('dlgChoosefolders', 'tblPlaces') # must switch away from Recent Files view to get txtLocation
    ldtp.wait(1)
    ldtp.settextvalue('dlgChoosefolders', 'txtLocation', f)
    ldtp.click('dlgChoosefolders', 'btnOpen')
    ldtp.wait(1) # let dialog close
Example #2
0
def walk_restore_prefs(dlg, backend, dest):
  if backend == 'file':
    ldtp.comboselect(dlg, 'cboLocation', 'Local Folder')
    wait_for_combo(dlg, 'cboLocation', 'Local Folder') # this menu acts slowly, because of custom widgets
    remap(dlg)
    ldtp.settextvalue(dlg, 'txtFileFolder', dest)
    ldtp.wait(1) # without this, sometimes ldtp moves so fast, deja-dup doesn't notice dest
Example #3
0
def wait_for_encryption(dlg, encrypt):
  count = 0
  max_count = 10
  while count < max_count:
    if guivisible(dlg, 'txtEncryptionpassword'):
      if encrypt:
        ldtp.settextvalue(dlg, 'txtEncryptionpassword', 'test')
        if guivisible(dlg, 'txtConfirmpassword'):
          ldtp.settextvalue(dlg, 'txtConfirmpassword', 'test')
      else:
        ldtp.click(dlg, 'rbtnAllowrestoringwithoutapassword')
      ldtp.click(dlg, 'btnContinue')
      break
    time.sleep(1)
    count += 1
  assert count < max_count, max_count
Example #4
0
    def set_text_value(self, window_name, object_name, data):
        """
        [关键字概要] 设置Text文本框内容

        :@参数 window_name: 窗口名称

        :@参数 object_name: 对象名称

        :@参数 data: 要设置的内容

        :@返回值: 成功或失败

        Examples:

        |  *Test Cases*  |  *Action*    |  *Arguments*  |  *Arguments*   |  *Arguments*  |
        |  Example_Test  | Set Text Value |  ${FRM_NAME} | ${TXT_NAME}   |   ${DATA}     |


        """
        try:
            self._info("set text value ... (%s, %s)\r\n" %
                       (window_name, object_name))
            # print("*INFO* set text value ... [%s, %s]\r\n" % (window_name, object_name))
            return ldtp.settextvalue(window_name, object_name, data)
        except LdtpExecutionError:
            raise LdtpExecutionError(
                " set text value failed, please check if the input parameters are correct. "
            )
Example #5
0
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')
Example #6
0
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)
Example #7
0
        def testAddRepository(self):
                repo_name = "test2"
                pm_str = "%s/usr/bin/packagemanager" % pkg5unittest.g_proto_area
                ldtp.launchapp(pm_str,["-R", self.get_img_path()])
                ldtp.waittillguiexist('Package Manager', state = ldtp.state.ENABLED)

                ldtp.selectmenuitem('Package Manager', 'mnuFile;mnuAdd Publisher...')
                
                ldtp.waittillguiexist('dlgAdd Publisher')

                ldtp.settextvalue('dlgAdd Publisher', "txtURI", self.dcs[2].get_depot_url())

                ldtp.click('dlgAdd Publisher', 'btnAdd')

                ldtp.waittillguiexist('dlgAdding Publisher Complete')

                ldtp.click('dlgAdding Publisher Complete', 'btnClose')

                # Verify result
                self.pkg('publisher | grep %s' % repo_name, exit=0)

                # Quit Package Manager
                ldtp.selectmenuitem('Package Manager', 'mnuFile;mnuQuit')
Example #8
0
def enter_connection_credentials(backend_name):
	if backend_name == 'PostgresCentral':
		if ldtp.waittillguiexist('Connection Details') == 0:
			raise ldtp.LdtpExecutionError('The Glom connection details dialog did not appear.')

		(hostname, username, password) = read_central_info()

		# Set connection details
		ldtp.settextvalue('Connection Details', 'txtHost', hostname)
		ldtp.settextvalue('Connection Details', 'txtUser', username)
		ldtp.settextvalue('Connection Details', 'txtPassword', password)

		# Acknowledge the dialog
		ldtp.click('Connection Details', 'btnConnect')

		# Make sure it's gone
		if ldtp.waittillguinotexist('Connection Details') == 0:
			raise ldtp.LdtpExecutionError('The cnnection details dialog did not disappear')
Example #9
0
def enter_connection_credentials(backend_name):
    if backend_name == 'PostgresCentral':
        if ldtp.waittillguiexist('Connection Details') == 0:
            raise ldtp.LdtpExecutionError(
                'The Glom connection details dialog did not appear.')

        (hostname, username, password) = read_central_info()

        # Set connection details
        ldtp.settextvalue('Connection Details', 'txtHost', hostname)
        ldtp.settextvalue('Connection Details', 'txtUser', username)
        ldtp.settextvalue('Connection Details', 'txtPassword', password)

        # Acknowledge the dialog
        ldtp.click('Connection Details', 'btnConnect')

        # Make sure it's gone
        if ldtp.waittillguinotexist('Connection Details') == 0:
            raise ldtp.LdtpExecutionError(
                'The cnnection details dialog did not disappear')
Example #10
0
 def input_text(self, window, text, text_value):
     ldtp.settextvalue(RHSMGuiLocator().get_locator(window), RHSMGuiLocator().get_locator(text), text_value)
Example #11
0
 def set_value(self, control, value):
     return ldtp.settextvalue(*_ldtp_args(control, value))
Example #12
0
    def test_insert_clientfromUI(self):
        """docstring for test_insert_clientfromUI"""
        ldtp.click(self.mv_name, self.new_c_button_name)
        ldtp.guiexist("frmNewclient1")
        ldtp.click("frmNewclient1", "btnCancel")
        ldtp.click(self.mv_name, self.new_c_button_name)
        ldtp.guiexist("frmNewclient2")
        new_c_name = "frmNewclient2"
        dni = "12345678R"
        ldtp.settextvalue("frmNewclient2", "txt4", "Alice")
        ldtp.settextvalue("frmNewclient2", "txt3", "Pound")
        ldtp.click("frmNewclient2", "btnOK")
        ldtp.settextvalue("frmNewclient2", "txt2", dni)
        ldtp.click("frmNewclient2", "btnOK")
        ldtp.singleclickrow(self.mv_name, self.tree_name_mv, "Alice")

        #Alice client changing
        ldtp.doubleclickrow(self.mv_name, self.tree_name_mv, "Alice")
        alice_title = "*DNI:12345678R"
        ldtp.guiexist(alice_title)
        ldtp.click(alice_title, "btnCancel")
        ldtp.doubleclickrow(self.mv_name, self.tree_name_mv, "Alice")
        #alice_title += "1"
        ldtp.guiexist(alice_title)
        ldtp.click(alice_title, "btnOK")

        ldtp.doubleclickrow(self.mv_name, self.tree_name_mv, "Alice")
        ldtp.guiexist(alice_title)
        ldtp.settextvalue(alice_title, "txt3", "Poundssss")
        ldtp.click(alice_title, "btnCancel")
        ldtp.doubleclickrow(self.mv_name, self.tree_name_mv, "Alice")
        ldtp.guiexist(alice_title)
        ldtp.settextvalue(alice_title, "txt3", "Poundssss")
        ldtp.settextvalue(alice_title, "txt2", "678R")
        ldtp.click(alice_title, "btnOK")



        #delete Alice from UI
        ldtp.selectrow(self.mv_name, self.tree_name_mv, "Alice")
        delete_dlg = "dlgDeleteclient"
        ldtp.click(self.mv_name, self.delete_c_button_name)
        ldtp.guiexist(delete_dlg)
        ldtp.click(delete_dlg, "btnNo")

        ldtp.click(self.mv_name, self.delete_c_button_name)
        ldtp.singleclickrow(self.mv_name, self.tree_name_mv, "Alice")
        ldtp.guiexist(delete_dlg)
        ldtp.click(delete_dlg, "btnYes")
Example #13
0
 def text(self, window, textId, text):
     """Inserts :text into text-box :textId of :window"""
     settextvalue(window, textId, text)
Example #14
0
	def set_text(self, msg, window_name, object_name, text):
		'''
			Sets the text for an object.
		'''	
		logger.debug(msg)
		ldtp.settextvalue(window_name, object_name, text)
Example #15
0
 def set_value(self, control, value):
     return ldtp.settextvalue(*_ldtp_args(control, value))