appium-uiauto
Advanced tools
Comparing version 0.0.20 to 1.0.0-beta1
{ | ||
"name": "appium-uiauto", | ||
"version": "0.0.20", | ||
"version": "1.0.0-beta1", | ||
"description": "appium uiauto ios driver", | ||
"main": "index.js", | ||
"main": "lib/main.js", | ||
"bin": { | ||
@@ -14,3 +14,3 @@ "instruments-client.js": "./bin/instruments-client.js" | ||
"type": "git", | ||
"url": "https://github.com/appium/appium-uiauto.git" | ||
"url": "https://github.com/appium/appium-uiauto/tree/1.0.0-beta" | ||
}, | ||
@@ -29,4 +29,13 @@ "author": "", | ||
"dependencies": { | ||
"argparse": "~0.1.15" | ||
"argparse": "~0.1.15", | ||
"mkdirp": "~0.5.0", | ||
"q": "~1.0.1", | ||
"winston": "~0.7.3" | ||
}, | ||
"devDependencies": { | ||
"jscs": "~1.4.5", | ||
"jshint": "~2.5.1", | ||
"rimraf": "~2.2.8", | ||
"sinon": "^1.10.2" | ||
} | ||
} |
@@ -220,4 +220,3 @@ /* globals codes, $ */ | ||
// only be performed on a collection/string. | ||
return "name contains[c] '" + sel + "' || label contains[c] '" + sel | ||
+ "'"; | ||
return "name contains[c] '" + sel + "' || label contains[c] '" + sel + "'"; | ||
} | ||
@@ -224,0 +223,0 @@ } |
@@ -241,4 +241,4 @@ /* globals $, au, codes */ | ||
UIAElement.prototype._elementOrElementsWithPredicateWeighted = function (predicate, weighting, onlyFirst) { | ||
var onlyFirst = (onlyFirst === true); | ||
var weighting = weighting || ['elements']; | ||
onlyFirst = (onlyFirst === true); | ||
weighting = weighting || ['elements']; | ||
@@ -249,3 +249,3 @@ UIATarget.localTarget().pushTimeout(0); | ||
var element = this; | ||
var func, found; | ||
var found; | ||
$.each(weighting, function (idx, prop) { | ||
@@ -252,0 +252,0 @@ if (typeof element[prop] === 'function') { |
@@ -1,2 +0,3 @@ | ||
/* globals target, curAppiumCmdId, getFirstCommand, sendResultAndGetNext, codes */ | ||
/* globals setenv, target, curAppiumCmdId, getFirstCommand, sendResultAndGetNext, codes */ | ||
/* exported bootstrap */ | ||
@@ -10,3 +11,4 @@ /* jshint ignore:start */ | ||
(function () { | ||
var bootstrap = function(dynamicEnv) { | ||
setenv(dynamicEnv); | ||
// safe default | ||
@@ -83,3 +85,3 @@ target.setTimeout(1); | ||
} | ||
})(); | ||
}; | ||
@@ -1,3 +0,3 @@ | ||
/* globals sysExec, dirExists, fileExists */ | ||
/* exported WAIT_FOR_DATA_TIMEOUT, system, target, mainWindow, mainWindow, wd_frame */ | ||
/* exported setenv, user, isVerbose, nodePath, instrumentsClientPath, WAIT_FOR_DATA_TIMEOUT */ | ||
@@ -10,169 +10,11 @@ // automation globals | ||
// local environment | ||
var user = null, | ||
settings = {}, | ||
isVerbose = false, | ||
nodePath, | ||
instrumentsClientPath, | ||
var user, isVerbose, nodePath, instrumentsClientPath, | ||
WAIT_FOR_DATA_TIMEOUT = 3600; | ||
(function () { | ||
console.start('Bootstrapping uiauto'); | ||
var earlyLogs = []; // cannot properly log before isVerbose has been read from settings | ||
// retrieving user | ||
(function () { | ||
var getUserFromCommand = function (cmd) { | ||
var _user; | ||
try { | ||
_user = sysExec(cmd); | ||
} catch (ign) {} | ||
if (_user && dirExists('/Users/' + _user)) { | ||
earlyLogs.push("Found user using cmd: " + cmd + ', user:' + _user); | ||
return _user; | ||
} else return null; | ||
}; | ||
var cmds = [ | ||
'whoami', | ||
'echo $HOME | cut -d / -f3', | ||
'ls -d ~ | cut -d / -f3' | ||
]; | ||
for (var i = 0; i < cmds.length; i++) { | ||
user = getUserFromCommand(cmds[i]); | ||
if (user) break; | ||
} | ||
console.start(user ? "Got user: " + user : "Could not get user"); | ||
})(); | ||
// retrieving settings + isVerbose | ||
(function () { | ||
var settingsFile = "/Users/" + user + "/.instruments.conf"; | ||
if (fileExists(settingsFile)) { | ||
console.start('Using setting file: ' + settingsFile); | ||
var lines = sysExec("/bin/cat " + settingsFile).split('\n'); | ||
for (var index = 0; index < lines.length; index++) { | ||
var line = lines[index]; | ||
if (line[0] === '#') continue; | ||
if (line.indexOf('=') !== -1) { | ||
var parts = line.split('='); | ||
if (parts.length !== 2) { | ||
throw new Error("Error reading " + settingsFile); | ||
} | ||
settings[parts[0]] = parts[1]; | ||
} | ||
} | ||
isVerbose = settings.verbose === 'true'; | ||
console.start("isVerbose:" + isVerbose); | ||
// now it's time to print early logs | ||
for (var i = 0; i < earlyLogs.length; i++) { | ||
console.log(earlyLogs[i]); | ||
} | ||
if (settings.length > 0) { | ||
console.log("Read in settings: "); | ||
for (var key in settings) { | ||
if (settings.hasOwnProperty(key)) { | ||
console.log(" " + key + ": " + settings[key]); | ||
} | ||
} | ||
} | ||
} else { | ||
console.start('Not using settings file.'); | ||
console.start("isVerbose:" + isVerbose); | ||
isVerbose = false; | ||
} | ||
})(); | ||
// retrieving node path | ||
(function () { | ||
var getNodePathFromCommand = function (cmd) { | ||
var path; | ||
try { | ||
path = sysExec(cmd); | ||
} catch (ign) {} | ||
if (path && fileExists(path)) { | ||
console.log("Found node using cmd: " + cmd + ', path:' + path); | ||
return path; | ||
} else return null; | ||
}; | ||
var getNodePathFromSettings = function () { | ||
var path; | ||
if ((typeof settings !== "undefined") && ('NODE_BIN' in settings)) { | ||
path = settings.NODE_BIN; | ||
} | ||
if (path && fileExists(path)) { | ||
console.log("Using settings override for NODE_BIN: " + settings.NODE_BIN); | ||
return path; | ||
} else return null; | ||
}; | ||
var getNodePathFromAppiumApp = function () { | ||
var appScript = [ | ||
'try', | ||
' set appiumIsRunning to false', | ||
' tell application "System Events"', | ||
' set appiumIsRunning to name of every process contains "Appium"', | ||
' end tell', | ||
' if appiumIsRunning then', | ||
' tell application "Appium" to return node path', | ||
' end if', | ||
'end try', | ||
'return "NULL"' | ||
].join("\n"); | ||
var path = null; | ||
try { | ||
path = sysExec("osascript -e '" + appScript + "'"); | ||
} catch (ign) {} | ||
if (path === "NULL") path = null; | ||
if (path && fileExists(path)) { | ||
console.log("Found node in Appium.app. path: " + path); | ||
return path; | ||
} else return null; | ||
}; | ||
nodePath = getNodePathFromSettings(); | ||
if (!nodePath) nodePath = getNodePathFromCommand('/usr/bin/env node -e "console.log(process.execPath);"'); | ||
if (!nodePath) nodePath = getNodePathFromAppiumApp(); | ||
if (!nodePath) { | ||
var cmds = [ | ||
'echo $NODE_BIN', | ||
'which node', | ||
'ls /usr/local/bin/node', | ||
'ls /opt/local/bin/node' | ||
]; | ||
for (var i = 0; i < cmds.length; i++) { | ||
nodePath = getNodePathFromCommand(cmds[i]); | ||
if (nodePath) break; | ||
} | ||
} | ||
if (!nodePath) { | ||
throw new Error("Could not find node, where is it?"); | ||
} | ||
console.start("Using node at: " + nodePath); | ||
})(); | ||
// figure out where instruments client is (relative to where appium is run) | ||
(function () { | ||
var getClientPath = function () { | ||
var possiblePaths = [ | ||
'./node_modules/.bin/instruments-client.js', | ||
'./node_modules/appium/node_modules/.bin/instruments-client.js' | ||
]; | ||
for (var i = 0; i < possiblePaths.length; i++) { | ||
if (fileExists(possiblePaths[i])) { | ||
return possiblePaths[i]; | ||
} | ||
} | ||
}; | ||
instrumentsClientPath = getClientPath(); | ||
if (!instrumentsClientPath) { | ||
throw new Error("Could not find instruments clientPath, where is it?"); | ||
} | ||
console.log('Using instrument client at: ' + instrumentsClientPath); | ||
})(); | ||
})(); | ||
var setenv = function(dynamicEnv) { | ||
user = dynamicEnv.USER; | ||
isVerbose = dynamicEnv.VERBOSE_INSTRUMENTS; | ||
nodePath = dynamicEnv.NODE_BIN; | ||
instrumentsClientPath = dynamicEnv.INSTRUMENTS_CLIENT_PATH; | ||
}; |
@@ -1,3 +0,3 @@ | ||
/* globals isVerbose, system, user */ | ||
/* exported console, fileExists, dirExists, sysExec */ | ||
/* globals isVerbose */ | ||
/* exported console */ | ||
/* jshint -W079 */ | ||
@@ -19,54 +19,1 @@ | ||
}; | ||
var fileExists = function (filename) { | ||
var params = []; | ||
params = params.concat(['-f', filename]); | ||
var res = system.performTaskWithPathArgumentsTimeout("/bin/test", params, 3); | ||
if (res.exitCode === 0) { | ||
return true; | ||
} else { | ||
return false; | ||
} | ||
}; | ||
var dirExists = function (filename) { | ||
var params = []; | ||
params = params.concat(['-d', filename]); | ||
var res = system.performTaskWithPathArgumentsTimeout("/bin/test", params, 3); | ||
if (res.exitCode === 0) { | ||
return true; | ||
} else { | ||
return false; | ||
} | ||
}; | ||
var sysExec = function (cmd) { | ||
var params = []; | ||
if (user !== null) { | ||
if (fileExists('/Users/' + user + '/.profile')) { | ||
params = params.concat(['--rcfile', '/Users/' + user + '/.profile']); | ||
} else { | ||
if (fileExists('/Users/' + user + '/.bash_profile')) { | ||
params = params.concat(['--rcfile', '/Users/' + user + '/.bash_profile']); | ||
} else { | ||
if (fileExists('/Users/' + user + '/.bashrc')) { | ||
params = params.concat(['--rcfile', '/Users/' + user + '/.bashrc']); | ||
} | ||
} | ||
} | ||
} | ||
params = params.concat(['-c', cmd]); | ||
var res = system.performTaskWithPathArgumentsTimeout("/bin/bash", | ||
params, 3); | ||
if (res.exitCode !== 0) { | ||
throw new Error("Failed executing the command " + cmd + " (exit code " + res.exitCode + ")"); | ||
} else { | ||
var output = res.stdout.trim(); | ||
if (output.length) { | ||
return output; | ||
} else { | ||
throw new Error("Executing " + cmd + " failed since there was no output"); | ||
} | ||
} | ||
}; | ||
Sorry, the diff of this file is not supported yet
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
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 5 instances in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
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
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 4 instances in 1 package
30
2492
0
2
85456
4
4
14
+ Addedmkdirp@~0.5.0
+ Addedq@~1.0.1
+ Addedwinston@~0.7.3
+ Addedasync@0.2.10(transitive)
+ Addedaws-sign@0.2.1(transitive)
+ Addedboom@0.3.8(transitive)
+ Addedcolors@0.6.2(transitive)
+ Addedcombined-stream@0.0.7(transitive)
+ Addedcookie-jar@0.2.0(transitive)
+ Addedcryptiles@0.1.3(transitive)
+ Addedcycle@1.0.3(transitive)
+ Addeddelayed-stream@0.0.5(transitive)
+ Addedeyes@0.1.8(transitive)
+ Addedforever-agent@0.2.0(transitive)
+ Addedform-data@0.0.10(transitive)
+ Addedhawk@0.10.2(transitive)
+ Addedhoek@0.7.6(transitive)
+ Addedjson-stringify-safe@3.0.0(transitive)
+ Addedmime@1.2.11(transitive)
+ Addedminimist@1.2.8(transitive)
+ Addedmkdirp@0.5.6(transitive)
+ Addednode-uuid@1.4.8(transitive)
+ Addedoauth-sign@0.2.0(transitive)
+ Addedpkginfo@0.3.1(transitive)
+ Addedq@1.0.1(transitive)
+ Addedqs@0.5.6(transitive)
+ Addedrequest@2.16.6(transitive)
+ Addedsntp@0.1.4(transitive)
+ Addedstack-trace@0.0.10(transitive)
+ Addedtunnel-agent@0.2.0(transitive)
+ Addedwinston@0.7.3(transitive)