def wait_for_database_open(): # Wait for the list view to pop up in the main Glom window: # Note that the Window title of the Glom Window changes when the file # has loaded. If we use wildcards for the Window title (*Glom*) here, # then objectexist does not find the notebook_data # (ptlListOrDetailsView) widget, even when it has actually appeared. # TODO: Maybe we can use setcontext(), to avoid this. # TODO: Or maybe this has been fixed in LDTP in the meanwhile, # see bug #583021. while not ldtp.guiexist('Glom-Test') or not ldtp.objectexist( 'Glom-Test', 'ptlListOrDetailsView'): # onwindowcreate calls the callback in a new thread, which # does not really help us since we don't have a mainloop the # callback thread could notify, so we would need to have to # poll an event anyway. Instead, we can simply poll directly # the existance of an error dialog. # Plus, there seems to be a bug in LDTP when running a test # sequence of multiple tests using onwindowcreate: # http://bugzilla.gnome.org/show_bug.cgi?id=586291. if ldtp.guiexist('Warning') or ldtp.guiexist('Error'): # TODO: Read error message from error dialog raise ldtp.LdtpExecutionError('Failed to create new database') # Wait a bit and then try again: ldtp.wait()
def testInstallSimplePackage(self): pkgname = 'package1' pm_str = "%s/usr/bin/packagemanager" % pkg5unittest.g_proto_area self.pkgsend_bulk(self.rurl, self.foo10) self.image_create(self.rurl) ldtp.launchapp(pm_str,["-R", self.get_img_path()]) ldtp.waittillguiexist('Package Manager', state = ldtp.state.ENABLED) ldtp.selectindex('Package Manager', 'Publisher', 0) ldtp.selectrow('Package Manager', 'Packages', pkgname) ldtp.selectmenuitem('Package Manager', 'mnuEdit;mnuSelect All') ldtp.click('Package Manager', 'btnInstall/Update') ldtp.waittillguiexist('dlgInstall Confirmation') ldtp.click('dlgInstall Confirmation', 'btnProceed') while (ldtp.objectexist('dlgInstall/Update', 'btnClose') == 0): ldtp.wait(0.1) ldtp.click('dlgInstall/Update', 'btnClose') ldtp.waittillguinotexist('dlgInstall/Update') # Verify result self.pkg('verify') # Quit packagemanager ldtp.selectmenuitem('Package Manager', 'mnuFile;mnuQuit')
def test_1(self): ldtp.waittillguiexist('frmUbuntuSoftwareCent*', 'btnAccessories') assert ldtp.objectexist('frmUbuntuSoftwareCent*', 'btnAccessories') b = "Time taken from start to find the Accessories button " + str( time.time() - start_time) + " Cpu percentage: " + str( ldtp.getcpustat( 'software-center')) + " Memory usage in MB: " + str( ldtp.getmemorystat('software-center')) self.msgs.append(b)
def isExisting(objs=None): ''' Verify if the object(s) exist. If objs is None, it uses CurrentObjs. ''' objs, rstr = __checkObjs(objs) r = [] for o in objs: role = getRole(o) if role == 'Root' or role == 'Windows' or role == 'Application' : r.append(True) else : r.append(ldtp.objectexist(subContext(o),o)) return __checkR(r,rstr)
def select_backend(dialog_title, backend_name): try: button_texts = backend_create_db_button_texts[backend_name] except KeyError: raise ldtp.LdtpExecutionError('Backend "' + backend + '" does not exist') for text in button_texts: if ldtp.objectexist(dialog_title, 'rbtn' + text): ldtp.click(dialog_title, 'rbtn' + text) break else: raise ldtp.LdtpExecutionError('Backend "' + backend + '" not supported')
def object_exist(self, window_name, object_name): """ [关键字概要] 判断窗口是否存在 :@参数 window_name: 窗口名称 :@参数 object_name: 对象名称 :@返回值: 1 on success, 0 on failure Examples: | *Test Cases* | *Returns* | *Action* | *Argument* | *Argument* | | Example_Test | @{return}= | Object Exist | ${window_name} | ${object_name} | """ try: self._info("object exist :(%s, %s)" % (window_name, object_name)) return ldtp.objectexist(window_name, object_name) except LdtpExecutionError: raise LdtpExecutionError("objectexist failed")
def wait_for_database_open(): # Wait for the list view to pop up in the main Glom window: # Note that the Window title of the Glom Window changes when the file # has loaded. If we use wildcards for the Window title (*Glom*) here, # then objectexist does not find the notebook_data # (ptlListOrDetailsView) widget, even when it has actually appeared. # TODO: Maybe we can use setcontext(), to avoid this. # TODO: Or maybe this has been fixed in LDTP in the meanwhile, # see bug #583021. while not ldtp.guiexist('Glom-Test') or not ldtp.objectexist('Glom-Test', 'ptlListOrDetailsView'): # onwindowcreate calls the callback in a new thread, which # does not really help us since we don't have a mainloop the # callback thread could notify, so we would need to have to # poll an event anyway. Instead, we can simply poll directly # the existance of an error dialog. # Plus, there seems to be a bug in LDTP when running a test # sequence of multiple tests using onwindowcreate: # http://bugzilla.gnome.org/show_bug.cgi?id=586291. if ldtp.guiexist('Warning') or ldtp.guiexist('Error'): # TODO: Read error message from error dialog raise ldtp.LdtpExecutionError('Failed to create new database') # Wait a bit and then try again: ldtp.wait()
def test_1(self): ldtp.waittillguiexist('frmUbuntuSoftwareCent*', 'btnAccessories') assert ldtp.objectexist('frmUbuntuSoftwareCent*', 'btnAccessories') b = "Time taken from start to find the Accessories button " + str( time.time() - start_time) + " Cpu percentage: " + str(ldtp.getcpustat('software-center')) + " Memory usage in MB: " + str(ldtp.getmemorystat('software-center')) self.msgs.append(b)
def testWalletButtons(self): for button in WALLET_BUTTONS: self.assertTrue(objectexist(MAIN_WINDOW, button))
def testMenuItems(self): for item in MENU_ITEMS: self.assertTrue(objectexist(MAIN_WINDOW, item))
def testLeftHandButtons(self): for button in LEFT_HAND_BUTTONS: self.assertTrue(objectexist(MAIN_WINDOW, button))
def test_1(self): ldtp.waittillguiexist('frmUbuntuSoftwareCent*', 'btnAccessories') assert ldtp.objectexist('frmUbuntuSoftwareCent*', 'btnAccessories') b = "Time taken from start to find the Accessories button " + str( time.time() - start_time) self.msgs.append(b)