Best Python code snippet using pyatom_python
dbusmenu.py
Source:dbusmenu.py
1from mago.test_suite.main import SingleApplicationTestSuite 2from mago.application.main import Application 3import ldtp, ooldtp, ldtputils, os.path4class DbusMenuGtkApp():5 LAUNCHER = os.path.join(os.path.dirname(__file__), "..", "dbusMenuTest")6 WINDOW = "frmlibdbusmenu-gtktest"7 def open(self, menu_schema=''):8 ldtp.launchapp(self.LAUNCHER, [menu_schema])9 def menu_exists(self, menu=''):10 app = ooldtp.context(self.WINDOW)11 if menu == '':12 menu = "mnu1"13 try:14 component = app.getchild(menu)15 except ldtp.LdtpExecutionError:16 return False17 return True18 19 def get_submenus(self, menu=''):20 app = ooldtp.context(self.WINDOW)21 if menu == '':22 menu = "mnu1"23 component = app.getchild(menu)24 try:25 submenus = component.listsubmenus()26 except ldtp.LdtpExecutionError:27 return "" 28 29 return submenus30class DbusMenuGtkTest(SingleApplicationTestSuite):31 APPLICATION_FACTORY = DbusMenuGtkApp32 def cleanup(self):33 ldtp.waittillguinotexist(self.application.WINDOW, guiTimeOut=70)34 def teardown(self):35 ldtp.waittillguinotexist(self.application.WINDOW, guiTimeOut=70)36 def testStaticMenu(self, menu_schema, menu_item='', notexists=''):37 self.application.open(menu_schema)38 ldtp.waittillguiexist(self.application.WINDOW)39 if notexists == "True":40 if self.application.menu_exists(menu_item):41 raise AssertionError("The menu item exists")42 else:43 if not self.application.menu_exists(menu_item):44 raise AssertionError("The menu item does not exists")45 def testSubmenus(self, menu_schema, menu_item='', submenus=''):46 self.application.open(menu_schema)47 ldtp.waittillguiexist(self.application.WINDOW)48 if submenus != self.application.get_submenus(menu_item):49 raise AssertionError("The submenus are different")...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!