appium-uiauto
Advanced tools
Comparing version 1.6.5 to 1.6.6
@@ -20,3 +20,4 @@ // Generate a bootstrap for the UIAuto Instruments script containing | ||
__dirname, '../bin/command-proxy-client.js'), | ||
instrumentsSock: opts.sock || '/tmp/instruments_sock' | ||
instrumentsSock: opts.sock || '/tmp/instruments_sock', | ||
interKeyDelay: opts.interKeyDelay || null | ||
}; | ||
@@ -23,0 +24,0 @@ return bootstrapEnv; |
{ | ||
"name": "appium-uiauto", | ||
"version": "1.6.5", | ||
"version": "1.6.6", | ||
"description": "appium uiauto ios driver", | ||
@@ -5,0 +5,0 @@ "main": "lib/main.js", |
@@ -1,2 +0,2 @@ | ||
/* globals $ */ | ||
/* globals $, env */ | ||
@@ -33,2 +33,5 @@ (function () { | ||
} | ||
if (env.interKeyDelay) { | ||
$.delay(env.interKeyDelay); | ||
} | ||
} | ||
@@ -35,0 +38,0 @@ } |
@@ -5,5 +5,12 @@ /* globals $ */ | ||
// return all elements of type contained in typeArray | ||
UIAElement.prototype._elementOrElementsByType = function (typeArray, onlyFirst, onlyVisible) { | ||
UIAElement.prototype._elementOrElementsByType = function (opts) { | ||
var typeArray = opts.typeArray, | ||
onlyFirst = opts.onlyFirst, | ||
onlyVisible = opts.onlyVisible, | ||
nameObject = opts.name, | ||
labelObject = opts.label, | ||
valueObject = opts.value; | ||
if (!typeArray) throw new Error("Must provide typeArray when calling _elementOrElementsByType"); | ||
var numTypes = typeArray.length; | ||
@@ -13,7 +20,39 @@ onlyFirst = onlyFirst === true; | ||
var validateObject = function (objectName, object) { | ||
if (object && (typeof object.substring === "undefined" || | ||
typeof object.target === "undefined" || | ||
typeof object.insensitive === "undefined")) { | ||
throw new Error(objectName + " object must contain substring, target, and insensitive"); | ||
} | ||
}; | ||
validateObject("name", nameObject); | ||
validateObject("label", labelObject); | ||
validateObject("value", valueObject); | ||
var target = $.target(); | ||
target.pushTimeout(0); | ||
var attributeMatch = function (elementProperty, attributeObject) { | ||
if (!elementProperty || !attributeObject) return false; | ||
var target = attributeObject.target; | ||
if (!target) return false; | ||
if (attributeObject.insensitive) { | ||
elementProperty = elementProperty.toLowerCase(); | ||
target = target.toLowerCase(); | ||
} | ||
if (attributeObject.substring) { | ||
return elementProperty.indexOf(target) !== -1; | ||
} else { | ||
return elementProperty === target; | ||
} | ||
}; | ||
var getTree = function (element) { | ||
var elems = []; | ||
// element.elements() may return nil children. | ||
if (element.isNil()) { | ||
return elems; | ||
} | ||
// process element | ||
@@ -25,3 +64,11 @@ var visible = element.isVisible() === 1; | ||
if (!onlyVisible || visible) { | ||
elems.push(element); | ||
// if an object isn't provided then it's a match. | ||
var nameMatch = nameObject ? attributeMatch(element.name(), nameObject) : true; | ||
var labelMatch = labelObject ? attributeMatch(element.label(), labelObject) : true; | ||
var valueMatch = valueObject ? attributeMatch(element.value(), valueObject) : true; | ||
if (nameMatch && labelMatch && valueMatch && element.checkIsValid()) { | ||
elems.push(element); | ||
} | ||
if (onlyFirst && elems.length === 1) return elems; | ||
@@ -108,6 +155,8 @@ break; | ||
for (var a = 0, len = this.elements().length; a < len; a++) { | ||
child = this.elements()[a]; | ||
child = this.elements()[a]; | ||
if (!child.isNil()) { | ||
results = results.concat(child | ||
._elementOrElementsWithPredicateWeighted(predicate, | ||
weighting, onlyFirst, onlyVisible)); | ||
} | ||
} | ||
@@ -114,0 +163,0 @@ } |
@@ -10,4 +10,5 @@ var env; | ||
this.instrumentsSock = dynamicEnv.instrumentsSock; | ||
this.interKeyDelay = dynamicEnv.interKeyDelay; | ||
}; | ||
})(); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13365743
3484