Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

appium-uiauto

Package Overview
Dependencies
Maintainers
2
Versions
93
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

appium-uiauto - npm Package Compare versions

Comparing version 0.0.20 to 1.0.0-beta1

.jscs.json

17

package.json
{
"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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc