def getApplicationwindowId(ReferenceID): try: ldtp.wait(5) window = ReferenceID.windows()[0] logging.info("Application id of the window : %s" % window) except Exception as er: logging.info('Not able to get window name of Application') return False return window
def launchApplication(Cbundleid): try: atomac.launchAppByBundleId(Cbundleid) logging.info('Application launched successfully') ldtp.wait(3) except Exception as er: logging.info( 'Not able to launch Application, Please check Application added in Accessbility' )
def getChildwindows(ReferenceID): try: ldtp.wait(3) window = ReferenceID.windowsR()[0] logging.info("child windows : %s" % window) except Exception as er: logging.info('Not able to get child windows') return False return window
def verifynotification(notificationbutton): try: atomacclick(notificationbutton) ldtp.wait(3) content = notificationbutton.AXTitle ldtp.wait(1) except Exception as er: logging.DEBUG("Not able to click on notification object") return False return content
def homerunascan(window, referenceid): allbuttons = getAppButtons(window) atomacclick(allbuttons[14]) ldtp.wait(3) Runwindow = getChildwindows(referenceid) buttons = getAppButtons(Runwindow) atomacclick(buttons[0]) buttons = getAppButtons(Runwindow) ldtp.wait(4) atomacclick(buttons[1])
def MacSecurityrunascan(window, referenceid): try: allobjects = getAllObjects(window) atomacclick(allobjects[52]) ldtp.wait(2) Runwindow = getChildwindows(referenceid) buttons = getAppButtons(Runwindow) atomacclick(buttons[0]) except Exception as er: return False
def homeCustomScan(window, referenceid): try: allobjects = getAllObjects(window) atomacclick(allobjects[52]) ldtp.wait(2) Runwindow = getChildwindows(referenceid) buttons = getAppButtons(Runwindow) atomacclick(buttons[1]) except Exception as er: print("Not able to click on HomeCustomScan") return False
def contextualhelpverificationhome(window, contextualhelpbutton): try: atomacclick(contextualhelpbutton) appbuttons = getAppButtons(window) for i in range(1, 6): ldtp.wait(2) atomacclick(appbuttons[27]) appbuttons = getAppButtons(window) atomacclick(appbuttons[27]) except Exception as er: return False print "Not able to click on contextualhelpverification"
def homeupdates(window, referenceid): try: allobjects = getAllObjects(window) atomacclick(allobjects[53]) ldtp.wait(2) Runwindow = getChildwindows(referenceid) buttons = getAppButtons(Runwindow) atomacclick(buttons[0]) buttons = getAppButtons(Runwindow) ldtp.wait(2) atomacclick(buttons[1]) except Exception as er: print("Not able to click on MacSecurityhistory") return False
def ReporterParsing(refrenceid): try: Mcafee_Reporter_window = getApplicationwindowId(refrenceid) Mcafee_Reporter_buttons = getAllObjects(Mcafee_Reporter_window) Mcafee_Reporter_all_objects = getAllObjects(Mcafee_Reporter_window) table_object = Mcafee_Reporter_all_objects[18] table_rows = table_object.AXRows #for n in table_rows: # print n.AXChildren #print n.AXValue #print "data", n.AXChildren #print "value", n.AXValue ldtp.wait(10) atomacclick(Mcafee_Reporter_all_objects[50]) except Exception as er: return False print "Not able to Parse Reporter window"
def verify(self, bundleid, preexpirycommand, Appbuttons, window, resettimeanddate): commonFns.quitApplication(bundleid) print "product quit" commonFns.executeCommand(preexpirycommand) print "PreExpiry" ldtp.wait(80) commonFns.launchApplication(bundleid) print "Launching" ldtp.wait(10) commonFns.atomacclick(Appbuttons[6]) ldtp.wait(10) device_status = commonFns.devicesSatusVerification(window) print "Device status" ldtp.wait(1) return device_status commonFns.executeCommand(timeanddatereset)
def MacSecurityqurantine(window, refrenceid): try: allobjects = getAllObjects(window) atomacclick(allobjects[52]) Quarantine_window = getChildwindows(refrenceid) Quarantine_window_buttons = getAppButtons(Quarantine_window) ldtp.wait(3) atomacclick(Quarantine_window_buttons[0]) ldtp.wait(3) atomacclick(Quarantine_window_buttons[1]) ldtp.wait(3) atomacclick(Quarantine_window_buttons[5]) ldtp.wait(3) atomacclick(Quarantine_window_buttons[6]) except Exception as er: print "Not able to click on MacSecurityqurantine" return False
def MacSecurityhistory(window, refrenceid): try: atomacclick(window[44]) History_window = getChildwindows(refrenceid) History_window_buttons = getAppButtons(History_window) print "History_window_buttons", History_window_buttons atomacclick(History_window_buttons[0]) ldtp.wait(3) atomacclick(History_window_buttons[2]) ldtp.wait(3) atomacclick(History_window_buttons[3]) ldtp.wait(3) except Exception as er: print "Not able to click on MacSecurityhistory" return False
def appButtons(self, window): try: AppButtons = commonFns.getAppButtons(window) except Exception as er: return False return AppButtons def verify(self, window, reference): commonFns.MacSecurityqurantine(window, reference) def reporting(self): print "Executing %s" % testcaseName, ":" + testcaseDescription 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) ldtp.wait(5) testcaseobj.verify(window, ref) filename = testcaseDescription + "pass" + strftime("%Y-%m-%d %H:%M:%S", gmtime()) commonFns.screenshot(filename) commonFns.Resultsupdate(constants.Data["testresult"], filename) testcaseobj.quit(constants.Data["bundleid"])
_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) commonFns.atomacclick(protectdevicewindowbuttons[0]) ldtp.wait(10) newbuttons = commonFns.getAppButtons(childwindows)
def verify(self, Appbuttons, window): commonFns.atomacclick(Appbuttons[6]) device_status = commonFns.devicesSatusVerification(window) ldtp.wait(1) return device_status
def verify(self, window, ReferenceID): commonFns.deepDevice(window, ReferenceID) def reporting(self): print "Executing %s" % testcaseName, ":" + testcaseDescription 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(4) deep_device_all_objects = commonFns.getAllObjects(deep_device) deep_deivce_buttons = commonFns.getAppButtons(deep_device) commonFns.atomacclick(deep_deivce_buttons[1]) ldtp.wait(4) commonFns.atomacclick(deep_deivce_buttons[2]) ldtp.wait(2) filename = testcaseDescription + "pass" + strftime("%Y-%m-%d %H:%M:%S", gmtime()) commonFns.Resultsupdate(constants.Data['testresult'], filename) testcaseobj.quit(constants.Data["bundleid"])
import os import sys import time import atomac import atomac.ldtp as ldtp sys.path.append(os.path.join(os.path.dirname(__file__), '..')) import TestCases import commonFns import constants import TestCases if __name__ == "__main__": _installflag = constants.Data.get('installbuild-flag') if _installflag == 0: print "Going to install new build from QA Server after uninstalling existing one" commonFns.productUninstall(constants.Data.get('uninstallproduct')) ldtp.wait(10) #After getting serial key #first check build is available if it is there skip or else download the build #install build #then Run all the test cases #send mail with results else: installed_build_number = commonFns.xmlparsing( constants.Data.get('xmlfilepath'), constants.Data.get('buildnumber')) print("Triggering Consumer GUi Automation Scripts for build :%s" % installed_build_number) #Run all the test cases #send mail with results
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) testcaseobj.quit(constants.Data["bundleid"])
def verify(self,Appbuttons,window): commonFns.atomacclick(Appbuttons[7]) ldtp.wait(5) device_status = commonFns.devicesSatusVerification(window) return device_status def quit(self,Appbundleid ): commonFns.quitApplication(Appbundleid) def reporting(self): print "Executing %s" % testcaseName, ":" + testcaseDescription 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) testcaseobj.verify(buttons,window) ldtp.wait(3) filename = testcaseDescription + "pass"+ strftime("%Y-%m-%d %H:%M:%S", gmtime()) commonFns.screenshot(filename) if testcaseobj.verify(buttons,window): commonFns.Resultsupdate(constants.Data["testresult"], filename) else: commonFns.Resultsupdate(constants.Data["testresult"], filename) testcaseobj.quit(constants.Data["bundleid"])