Beispiel #1
0
def iCloudSignIn(testcaseId):
	stepName = "icloud sign in"
	if testcaseId is not None:
		configurationData = bs_common.getConfiguration()
		time.sleep(1)
		
		with patience(30):
			target.processes()["Safari"].mainWindow().webViews()[0].textFields()["Apple ID"].isEnabled()
		
		if not target.processes()["Safari"].mainWindow().webViews()[0].textFields()["Apple ID"].isEnabled():
			bs_common.writeFunctionalTestResults(testcaseId, stepName, "FAIL")
			msg = "FAIL - "+ stepName
			bs_common.transactionFailedExit(msg)
			
		target.processes()["Safari"].mainWindow().webViews()[0].textFields()["Apple ID"].click()
		keyboard.typeString_(configurationData["iCloudAccount"]["userid"])
		target.processes()["Safari"].mainWindow().webViews()[0].textFields()["Password"].click()
		keyboard.typeString_(configurationData["iCloudAccount"]["password"])
		target.processes()["Safari"].mainWindow().webViews()[0].buttons().firstWithPredicate_("helpTag like 'Sign In'").click()	
		
		with patience(30): target.processes()["Safari"].mainWindow().webViews()[0].images()["iCloud"]
		
		time.sleep(5)
		
		if not target.processes()["Safari"].mainWindow().webViews()[0].images()["iCloud"].isEnabled():
			bs_common.writeFunctionalTestResults(testcaseId, stepName, "FAIL")
			msg = "FAIL - "+ stepName
			bs_common.transactionFailedExit(msg)

		else:
			bs_common.writeFunctionalTestResults(testcaseId, stepName, "PASS")
			msg = "PASS - "+ stepName
			bs_common.writeToConsole(msg)
			bs_common.writeToLogFile(msg)
Beispiel #2
0
def gearMenu_fileUpload(testcaseId, appName, inFileName):
	stepName = "file upload - "+ appName +" / "+ inFileName
	
	configurationData = bs_common.getConfiguration()
	myFileImportPath = configurationData["fileImportPath"]

	myFileName, myFileExtenstion = inFileName.split(".")
	
	baseObjectPath = target.processes()["Safari"].mainWindow().webViews()[0].webViews()[appName]
	resultsData = bs_common.getResultsFile()

	baseObjectPath.buttons().firstWithPredicate_("name contains 'Document and Sort Options'").click()
	
	myAppFileType = getFileTypeFromAppName(appName)
	
	baseObjectPath.menuItems()["Upload "+ myAppFileType +"..."].staticTexts()["Upload "+ myAppFileType +"..."].click()
	
	if baseObjectPath.staticTexts().firstWithPredicate_("name like 'Choose * upload*'"):
		print "upload dialog appeared"
		baseObjectPath.buttons()["Choose Files"].click()
				
	keyboard.typeString_withModifiersMask_("g", (kUIAShiftKeyMask|kUIACommandKeyMask))
	keyboard.typeString_(myFileImportPath +"/"+ inFileName)	
	keyboard.typeVirtualKey_(kVK_Return)
	time.sleep(1)
	target.processes()["Safari"].mainWindow().sheet().buttons()["Choose"].click()
	
	with patience(60): baseObjectPath.buttons()["Cancel\n"].waitForInvalid()
	
	if not baseObjectPath.staticTexts().firstWithPredicate_("name like '*"+ myFileName +"*'"):
		bs_common.writeFunctionalTestResults(testcaseId, stepName, "FAIL")
		msg = "FAIL - "+ stepName
		bs_common.writeToConsole(msg)
		bs_common.writeToLogFile(msg)
		
	else:
		bs_common.writeFunctionalTestResults(testcaseId, stepName, "PASS")	
		msg = "PASS - "+ stepName
		bs_common.writeToConsole(msg)
		bs_common.writeToLogFile(msg)