appium-uiauto
Advanced tools
Comparing version 1.2.0-beta4 to 1.2.0-beta5
#!/usr/bin/env node | ||
// This is used by the uiauto script on Instruments to connect to the Command | ||
// Proxy. It transmits the instruments message exactly as they come in. | ||
// Because stderr is unreliable, we append logs and program output before | ||
// sending sending them to the uiauto script in the following form: | ||
// This script is used by the UIAuto job, running on Instruments, to connect | ||
// to the Command Proxy. It transmits the Instruments messages exactly as they | ||
// come in. Because stderr is unreliable, we append logs and program output | ||
// before sending them to the UIAuto script in the following form: | ||
// ----- LOGS ----- | ||
@@ -18,10 +18,10 @@ // blah blah blah... | ||
function exit(status) { | ||
if(output){ | ||
if (output){ | ||
console.log('----- OUTPUT -----'); | ||
console.log(output); | ||
} | ||
// chill out before exiting | ||
setTimeout(function() { | ||
} | ||
// chill out before exiting | ||
process.nextTick(function () { | ||
process.exit(status); | ||
}, 1); | ||
}); | ||
} | ||
@@ -31,3 +31,3 @@ | ||
d.on('error', function(err) { | ||
d.on('error', function (err) { | ||
console.log('An error occured:', (err||"").toString()); | ||
@@ -37,3 +37,3 @@ exit(1); | ||
d.run(function() { | ||
d.run(function () { | ||
var net = require('net'); | ||
@@ -43,5 +43,5 @@ | ||
var client = net.connect({path:sock}, function () { | ||
if(dataFromInstruments && dataFromInstruments.length > 0){ | ||
if (dataFromInstruments && dataFromInstruments.length > 0){ | ||
console.log("Data from instruments to command proxy:"); | ||
console.log(dataFromInstruments.substring(0, 100)); | ||
console.log(dataFromInstruments.substring(0, 100)); | ||
} | ||
@@ -51,3 +51,3 @@ client.end(dataFromInstruments, "utf8"); | ||
client.setEncoding('utf8'); | ||
client.on('data', function (dataFromCommandProxy) { | ||
client.on('data', function (dataFromCommandProxy) { | ||
console.log("Data from command proxy to instruments: " + dataFromCommandProxy); | ||
@@ -61,3 +61,3 @@ output = dataFromCommandProxy; | ||
console.log('----- LOGS -----'); | ||
connect(process.argv[2], process.argv[3]); | ||
connect(process.argv[2], process.argv[3]); | ||
}); |
@@ -1,10 +0,14 @@ | ||
// This is the uiauto facade for appium, the Command Proxy relays uiauto message | ||
// to and from Appium. | ||
// The messages route is the following: | ||
// The Command Proxy relays UIAuto message to and from Appium. It is also the | ||
// UIAuto facade for Appium. | ||
// | ||
// The message route is the following: | ||
// Appium <--> Command Proxy <--> Instruments | ||
// The medium between Instruments and Command Proxy is the command-proxy-client script. | ||
// The format of the Command Proxy --> Instruments messages is {cmd:"<CMD>"} | ||
// The format of the Instruments --> Command Proxy messages is: | ||
// The medium between Instruments and Command Proxy is the command-proxy-client | ||
// script. | ||
// | ||
// Command Proxy --> Instruments message format: {cmd:"<CMD>"} | ||
// | ||
// Instruments --> Command Proxy message format: | ||
// <one char message type>,<stringified json data> | ||
// The json data in the message above has the following format: | ||
// <stringified json data> format: | ||
// {status:<status>, value:<result>} | ||
@@ -81,3 +85,3 @@ | ||
} | ||
logger.debug("Socket data being routed for '" + data.event + "' event"); | ||
logger.debug("Socket data being routed."); | ||
getResultAndSendNext(parsedData, conn); | ||
@@ -84,0 +88,0 @@ }); |
@@ -1,3 +0,3 @@ | ||
// This generates a bootstrap for the uiauto instruments script containing | ||
// the environment variable we need. | ||
// Generate a bootstrap for the UIAuto Instruments script containing | ||
// the environment variables we need. | ||
@@ -4,0 +4,0 @@ 'use strict'; |
{ | ||
"name": "appium-uiauto", | ||
"version": "1.2.0-beta4", | ||
"version": "1.2.0-beta5", | ||
"description": "appium uiauto ios driver", | ||
@@ -5,0 +5,0 @@ "main": "lib/main.js", |
@@ -1,8 +0,11 @@ | ||
// The messages route is the following: | ||
// The message route is the following: | ||
// Appium <--> Command Proxy <--> Instruments | ||
// The medium between Instruments and Command Proxy is the command-proxy-client script. | ||
// The format of the Command Proxy --> Instruments messages is {cmd:"<CMD>"} | ||
// The format of the Instruments --> Command Proxy messages is: | ||
// The medium between Instruments and Command Proxy is the command-proxy-client | ||
// script. | ||
// | ||
// Command Proxy --> Instruments message format: {cmd:"<CMD>"} | ||
// | ||
// Instruments --> Command Proxy message format: | ||
// <one char message type>,<stringified json data> | ||
// The json data in the message above has the following format: | ||
// <stringified json data> format: | ||
// {status:<status>, value:<result>} | ||
@@ -61,3 +64,3 @@ | ||
// regular small results | ||
args.push(MESSAGE_TYPES.indexOf('regular') + ',' +stringResult); | ||
args.push(MESSAGE_TYPES.indexOf('regular') + ',' + stringResult); | ||
} else { | ||
@@ -64,0 +67,0 @@ // initiating big result transfer |
@@ -14,3 +14,4 @@ /* globals $ */ | ||
, delay: function (ms) { delaySec.call(this, ms/1000); } | ||
, logTree: function() {$($.mainApp()).logTree();} | ||
}); | ||
})(); |
@@ -55,25 +55,31 @@ /* globals $, errors */ | ||
, hideKeyboard: function (keyName) { | ||
if (keyName) { | ||
$.log("Hiding keyboard with keyName " + keyName); | ||
try { | ||
var keys = $.keyboard().buttons(); | ||
keys[keyName].tap(); | ||
} catch (e) { | ||
return { | ||
status: errors.NoSuchElement.code | ||
, value: "Could not find the '" + keyName + "' button, " + | ||
"you're on your own for closing it!" | ||
}; | ||
} | ||
} else if (!$.keyboard().isNil()) { | ||
$.log("Hiding keyboard using default method"); | ||
var startY = $.keyboard().rect().origin.y - 10; | ||
var endY = $.mainWindow().rect().size.height - 10; | ||
this.flickApp(0, startY, 0, endY); | ||
} else { | ||
return { | ||
status: errors.NoSuchElement.code | ||
, value: "The keyboard was not present, not closing it" | ||
}; | ||
, hideKeyboard: function (strategy, keyName) { | ||
var tapOutside = function() { | ||
$($.mainWindow()).tap(); | ||
$.delay(1000); | ||
}; | ||
switch(strategy) { | ||
case 'press': | ||
case 'pressKey': | ||
$.log("Hiding keyboard by pressing the key: " + keyName); | ||
try { | ||
var keys = $.keyboard().buttons(); | ||
keys[keyName].tap(); | ||
} catch (e) { | ||
return { | ||
status: errors.NoSuchElement.code, | ||
value: "Could not find the '" + keyName + "' key." | ||
}; | ||
} | ||
$.delay(1000); | ||
break; | ||
case 'tapOut': | ||
case 'tapOutside': | ||
tapOutside(); | ||
break; | ||
case 'default': | ||
tapOutside(); | ||
break; | ||
default: | ||
throw new Error('Unknown strategy: ' + strategy); | ||
} | ||
@@ -80,0 +86,0 @@ } |
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
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 102 instances 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
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
13338982
150
3216
105