Compare commits

...
Author SHA1 Message Date
Eric Millin 004f52f249 1.3.6 2015-03-04 11:01:35 -05:00
7 changed files with 45 additions and 40 deletions
+7
View File
@@ -1,3 +1,10 @@
CHANGES IN VERSION 1.3.6
======================================
#### Android
- fix XPath regression where Appium failed to recognize non-ASCII characters
- fix regression where Appium failed to set ADB's path during Chromedriver tests
CHANGES IN VERSION 1.3.5
======================================
+7 -4
View File
@@ -1033,7 +1033,7 @@ androidCommon.getJavaVersion = function (cb) {
} else if (stderr) {
var firstLine = stderr.split("\n")[0];
if (new RegExp("java version").test(firstLine)) {
javaVersion = firstLine.split(" ")[2].replace(/"/g, '');
javaVersion = firstLine.split(" ")[2].replace(/"/g, '');
}
}
if (javaVersion === null) {
@@ -1056,10 +1056,13 @@ androidCommon.initJavaVersion = function (cb) {
androidCommon.initAdb = function (cb) {
if (this.adb === null) {
this.adb = new ADB(this.args);
this.adb.checkAdbPresent(cb);
ADB.createADB(this.args, function (e, adb) {
if (e) return cb(e);
this.adb = adb;
cb();
}.bind(this));
} else {
return cb();
cb();
}
};
@@ -15,7 +15,6 @@
*/
package io.appium.uiautomator.core;
import android.graphics.Point;
import android.os.Environment;
import android.os.SystemClock;
import android.util.Log;
import android.util.Xml;
@@ -27,6 +26,9 @@ import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.StringWriter;
import java.util.regex.Pattern;
/**
*
@@ -46,7 +48,14 @@ public class AccessibilityNodeInfoDumper {
android.widget.GridView.class.getName(), android.widget.GridLayout.class.getName(),
android.widget.ListView.class.getName(), android.widget.TableLayout.class.getName()
};
// XML 1.0 Legal Characters (http://stackoverflow.com/a/4237934/347155)
// #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF]
private static Pattern XML10Pattern = Pattern.compile("[^"
+ "\u0009\r\n"
+ "\u0020-\uD7FF"
+ "\uE000-\uFFFD"
+ "\ud800\udc00-\udbff\udfff"
+ "]");
/**
* Using {@link AccessibilityNodeInfo} this method will walk the layout hierarchy
* and generates an xml dump to the location specified by <code>dumpFile</code>
@@ -208,27 +217,10 @@ public class AccessibilityNodeInfoDumper {
return stripInvalidXMLChars(cs);
}
}
private static String stripInvalidXMLChars(CharSequence cs) {
StringBuilder ret = new StringBuilder();
char ch;
for (int i = 0; i < cs.length(); i++) {
ch = cs.charAt(i);
// code below from Html#withinStyle, this is a temporary workaround because XML
// serializer does not support surrogates
if (ch >= 0xD800 && ch <= 0xDFFF) {
if (ch < 0xDC00 && i + 1 < cs.length()) {
char d = cs.charAt(i + 1);
if (d >= 0xDC00 && d <= 0xDFFF) {
i++;
ret.append("?");
}
}
} else if (ch > 0x7E || ch < ' ') {
ret.append("?");
} else {
ret.append(ch);
}
}
return ret.toString();
// Original Google code here broke UTF characters
private static String stripInvalidXMLChars(CharSequence charSequence) {
final StringBuilder sb = new StringBuilder(charSequence.length());
sb.append(charSequence);
return XML10Pattern.matcher(sb.toString()).replaceAll("?");
}
}
+10 -7
View File
@@ -7,8 +7,6 @@ var Android = require('./android.js')
, deviceCommon = require('../common.js')
, jwpSuccess = deviceCommon.jwpSuccess
, async = require('async')
, ADB = require('./adb.js')
, UiAutomator = require('./uiautomator.js')
, Chromedriver = require('./chromedriver.js');
var NATIVE_WIN = "NATIVE_APP";
@@ -74,19 +72,24 @@ ChromeAndroid.prototype.configure = function (args, caps, cb) {
cb();
};
ChromeAndroid.prototype.startAutomation = function (cb) {
// this wrapper is required because uiautomator is not instantiated
// at the beginning of the async#series call
this.uiautomator.start(cb);
};
ChromeAndroid.prototype.start = function (cb, onDie) {
this.adb = new ADB(this.args);
this.uiautomator = new UiAutomator(this.adb, this.args);
this.uiautomator.setExitHandler(this.onUiautomatorExit.bind(this));
this.onDie = onDie;
async.series([
this.initAdb.bind(this),
this.initUiautomator.bind(this),
this.prepareDevice.bind(this),
this.prepareChromedriver.bind(this),
this.pushAndUnlock.bind(this),
this.forwardPort.bind(this),
this.pushAppium.bind(this),
this.uiautomator.start.bind(this.uiautomator),
this.startAutomation.bind(this),
this.getDataDir.bind(this),
this.createSession.bind(this)
], function (err, results) {
@@ -104,7 +107,7 @@ ChromeAndroid.prototype.prepareChromedriver = function (cb) {
, deviceId: this.adb.curDeviceId
, enablePerformanceLogging: this.args.enablePerformanceLogging
};
this.chromedriver = new Chromedriver(chromeArgs,
this.chromedriver = new Chromedriver(chromeArgs, this.adb,
this.onChromedriverExit.bind(this));
this.proxyTo = this.chromedriver.proxyTo.bind(this.chromedriver);
this.proxyHost = this.chromedriver.proxyHost;
+2 -2
View File
@@ -13,7 +13,7 @@ var proxyTo = require('../common.js').proxyTo
, fs = require('fs')
, ADB = require('./adb.js');
var Chromedriver = function (args, onDie) {
var Chromedriver = function (args, adb, onDie) {
this.proxyHost = '127.0.0.1';
this.proxyPort = args.port || 9515;
this.deviceId = args.deviceId;
@@ -24,7 +24,7 @@ var Chromedriver = function (args, onDie) {
this.exitCb = null;
this.shuttingDown = false;
this.executable = args.executable;
this.adb = new ADB(args);
this.adb = adb;
};
Chromedriver.prototype.initChromedriverPath = function (cb) {
+2 -2
View File
@@ -11,7 +11,7 @@
"firefoxos",
"testing"
],
"version": "1.3.5",
"version": "1.3.6",
"author": "https://github.com/appium",
"licenses": [
{
@@ -41,7 +41,7 @@
},
"dependencies": {
"adm-zip": "~0.4.4",
"appium-adb": "=1.7.1",
"appium-adb": "=1.7.4",
"appium-atoms": "=0.0.5",
"appium-instruments": "=1.5.3",
"appium-support": "=0.0.4",