def appButtons(self, window): try: AppButtons = commonFns.getAppButtons(window) except Exception as er: return False return AppButtons
HomeTabobjects = [] MacSecurityTabObjects = [] AccountTabObjects = [] _filepath = commonFns.checkFileExits(constants.Data.get('xmlfilepath')) _buildinstalled_in_system = commonFns.xmlparsing( _filepath, constants.Data.get('buildnumber')) print("Build number installed: %s" % _buildinstalled_in_system) commonFns.launchApplication(constants.Data["bundleid"]) _refrenceid = commonFns.getApplicationReferenceID( constants.Data["bundleid"]) print "_ref", _refrenceid _windowname = commonFns.getApplicationwindowId(_refrenceid) _title = commonFns.getApplicatontitle(_windowname) print("Installed: %s" % _title) #2secnd test case HomeTabobjects = commonFns.getAppButtons(_windowname) commonFns.atomacclick(HomeTabobjects[6]) print "Verifying Device Status " ldtp.wait(3) DeviceStatus_Descriptions = commonFns.devicesSatusVerification( _windowname) for info in DeviceStatus_Descriptions: print info print "Verifying protectMoreDevices" commonFns.protectMoreDevices(HomeTabobjects[7]) print "Verifying pcorMacVerification" commonFns.pcorMacVerification(_windowname, _refrenceid, constants.Data["icon"], constants.Data["email"]) childwindows = commonFns.getApplicationwindowId(_refrenceid) protectdevicewindowbuttons = commonFns.getAppButtons(childwindows)
if __name__ == "__main__": testcaseobj = TestCase() testcaseobj.reporting() testcaseobj.launch(constants.Data["bundleid"]) reference = testcaseobj.appRef(constants.Data["bundleid"]) window = testcaseobj.appwindow(reference) buttons = testcaseobj.appButtons(window) testcaseobj.verify(buttons, window, reference, constants.Data["icon"], constants.Data["email"]) filename = testcaseDescription + "pass" + strftime("%Y-%m-%d %H:%M:%S", gmtime()) commonFns.screenshot(filename) childwindows = commonFns.getApplicationwindowId(reference) protectdevicewindowbuttons = commonFns.getAppButtons(childwindows) commonFns.atomacclick(protectdevicewindowbuttons[0]) filename = testcaseDescription + "pass" + strftime("%Y-%m-%d %H:%M:%S", gmtime()) commonFns.screenshot(filename) newbuttons = commonFns.getAppButtons(childwindows) ldtp.wait(8) if commonFns.atomacclick(newbuttons[0]): filename = testcaseDescription + "pass" + strftime( "%Y-%m-%d %H:%M:%S", gmtime()) commonFns.Resultsupdate(constants.Data["testresult"], filename) commonFns.screenshot(filename) else: fileupdate = testcaseDescription + "fail" + strftime( "%Y-%m-%d %H:%M:%S", gmtime()) commonFns.Resultsupdate(constants.Data["testresult"], fileupdate)
def quit(self, Appbundleid): commonFns.quitApplication(Appbundleid) if __name__ == "__main__": testcaseobj = TestCase() testcaseobj.reporting() testcaseobj.launch(constants.Data["bundleid"]) ref = testcaseobj.appRef(constants.Data["bundleid"]) window = testcaseobj.appwindow(ref) buttons = testcaseobj.appButtons(window) commonFns.atomacclick(buttons[0]) testcaseobj.verify(window, ref) deep_device = commonFns.deepDevice(window, ref) ldtp.wait(5) filename = testcaseDescription + "pass" + strftime("%Y-%m-%d %H:%M:%S", gmtime()) commonFns.screenshot(filename) deep_device_all_objects = commonFns.getAllObjects(deep_device) deep_deivce_buttons = commonFns.getAppButtons(deep_device) commonFns.atomacclick(deep_deivce_buttons[2]) ldtp.wait(5) commonFns.screenshot(filename) if commonFns.atomacclick(deep_deivce_buttons[3]): commonFns.screenshot(filename) commonFns.Resultsupdate(constants.Data['testresult'], filename) ldtp.wait(5) else: commonFns.Resultsupdate(constants.Data['testresult'], filename) testcaseobj.quit(constants.Data["bundleid"])