appium-uiauto
Advanced tools
Comparing version 1.2.0-beta1 to 1.2.0-beta2
@@ -6,4 +6,4 @@ var path = require('path'), | ||
prepareBootstrap: dynamicBootstrap.prepareBootstrap, | ||
rotate: path.resolve(__dirname, "../uiauto/Rotate.applescript"), | ||
rotate: path.resolve(__dirname, "../osa/Rotate.applescript"), | ||
logger: require('./logger') | ||
}; |
{ | ||
"name": "appium-uiauto", | ||
"version": "1.2.0-beta1", | ||
"version": "1.2.0-beta2", | ||
"description": "appium uiauto ios driver", | ||
@@ -5,0 +5,0 @@ "main": "lib/main.js", |
@@ -1,85 +0,20 @@ | ||
/* globals setenv, target, curAppiumCmdId, getFirstCommand, sendResultAndGetNext, codes */ | ||
/* exported bootstrap */ | ||
/* globals env, alerts, commands */ | ||
/* jshint ignore:start */ | ||
#import "lib/helpers.js" | ||
#import "./vendors/mechanic.js" | ||
#import "lib/env.js" | ||
#import "lib/instruments_client_launcher.js" | ||
#import "appium/base.js" | ||
#import "lib/errors.js" | ||
#import "lib/mechanic-ext/index.js" | ||
#import "lib/element-patch/index.js" | ||
#import "lib/commands.js" | ||
#import "lib/alerts.js" | ||
/* jshint ignore:end */ | ||
var bootstrap; | ||
var bootstrap = function(dynamicEnv) { | ||
setenv(dynamicEnv); | ||
// safe default | ||
target.setTimeout(1); | ||
// let server know we're alive and get first command | ||
var cmd = getFirstCommand(); | ||
var bootstrapSettings = { | ||
autoAcceptAlerts: false | ||
(function() { | ||
bootstrap = function(dynamicEnv) { | ||
env.init(dynamicEnv); | ||
alerts.configure(); | ||
commands.startProcessing(); | ||
}; | ||
UIATarget.onAlert = function (alert) { | ||
if (alert.name() && alert.name().indexOf("attempting to open a pop-up") !== -1 && alert.buttons().length > 0) { | ||
alert.defaultButton().tap(); | ||
} else if (bootstrapSettings.autoAcceptAlerts && alert.buttons().length > 0) { | ||
alert.defaultButton().tap(); | ||
} | ||
return true; | ||
}; | ||
var result; | ||
var configStr; | ||
var configParts; | ||
var bootstrapConfigPrefix = "setBootstrapConfig: "; | ||
while (true) { | ||
if (cmd) { | ||
console.log("Got new command " + curAppiumCmdId + " from instruments: " + cmd); | ||
try { | ||
if (cmd.indexOf(bootstrapConfigPrefix) === 0) { | ||
configStr = cmd.slice(bootstrapConfigPrefix.length); | ||
console.log("Got bootstrap config: " + configStr); | ||
configParts = configStr.split("="); | ||
bootstrapSettings[configParts[0]] = JSON.parse(configParts[1]); | ||
console.log("Set bootstrap config key '" + configParts[0] + "' to " + | ||
configParts[1]); | ||
} else { | ||
/* jshint evil:true */ | ||
try { | ||
result = eval(cmd); | ||
} catch (possStaleEl) { | ||
if (possStaleEl.message === codes.StaleElementReference.code) { | ||
result = { | ||
status: codes.StaleElementReference.code, | ||
value: codes.StaleElementReference.summary | ||
}; | ||
} else { | ||
throw possStaleEl; | ||
} | ||
} | ||
} | ||
} catch (e) { | ||
result = { | ||
status: codes.JavaScriptError.code | ||
, value: e.message | ||
}; | ||
} | ||
if (typeof result === "undefined" || result === null) { | ||
result = ''; | ||
console.log("Command executed without response"); | ||
} | ||
if (typeof result.status === "undefined" || typeof result.status === "object") { | ||
console.log("Result is not protocol compliant, wrapping"); | ||
result = { | ||
status: codes.Success.code, | ||
value: result | ||
}; | ||
} | ||
cmd = sendResultAndGetNext(result); | ||
} else { | ||
throw new Error("Error getting next command, shutting down :-("); | ||
} | ||
} | ||
}; | ||
})(); |
@@ -1,19 +0,28 @@ | ||
/* exported WAIT_FOR_DATA_TIMEOUT, system, target, mainWindow, mainWindow, wd_frame */ | ||
/* exported setenv, user, isVerbose, nodePath, instrumentsClientPath, WAIT_FOR_DATA_TIMEOUT */ | ||
/* globals $ */ | ||
// automation globals | ||
var system = UIATarget.localTarget().host(); | ||
var target = UIATarget.localTarget(); | ||
var mainWindow = target.frontMostApp().mainWindow(); | ||
var wd_frame = target.frontMostApp(); | ||
var env; | ||
// local environment | ||
var user, isVerbose, nodePath, instrumentsClientPath, | ||
WAIT_FOR_DATA_TIMEOUT = 3600; | ||
// TODO: we should not need those | ||
var target, au; | ||
var setenv = function(dynamicEnv) { | ||
user = dynamicEnv.USER; | ||
isVerbose = dynamicEnv.VERBOSE_INSTRUMENTS; | ||
nodePath = dynamicEnv.NODE_BIN; | ||
instrumentsClientPath = dynamicEnv.INSTRUMENTS_CLIENT_PATH; | ||
}; | ||
(function() { | ||
env = {}; | ||
env.init = function(dynamicEnv) { | ||
// safe default | ||
$.target().setTimeout(1); | ||
target = $.target(); | ||
au = $; | ||
// TODO: move to dynamic env | ||
this.autoAcceptAlerts = false; | ||
this.user = dynamicEnv.USER; | ||
this.isVerbose = dynamicEnv.VERBOSE_INSTRUMENTS; | ||
this.nodePath = dynamicEnv.NODE_BIN; | ||
this.instrumentsClientPath = dynamicEnv.INSTRUMENTS_CLIENT_PATH; | ||
}; | ||
})(); | ||
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
90909
39
2534
3