Stop when activity fails to show up

Fix targetActivity name in debug message
Log when an object is found
Update gitignore
Fix #371
This commit is contained in:
bootstraponline 2013-04-03 13:25:57 -04:00
Родитель 2d54939fa0
Коммит a78e4a2f87
4 изменённых файлов: 14 добавлений и 4 удалений

1
.gitignore поставляемый
Просмотреть файл

@ -38,3 +38,4 @@ app/android/AndroidManifest.xml.apk
app/android/AndroidManifest.xml
.*~
*~
uiautomator/bootstrap/target/

Просмотреть файл

@ -69,9 +69,17 @@ Android.prototype.start = function(cb, onDie) {
var onLaunch = _.bind(function(err) {
if (err) {
logger.error("Relaunching adb....");
var me = this;
this.adb.waitForDevice(function(){ didLaunch = true; me.push(null, true); cb(null); });
// This message is from adb.js. Must update when adb.js changes.
if (err.message === null || typeof err.message === 'undefined' || err.message.indexOf('App never showed up') === -1) {
logger.error("Relaunching adb....");
var me = this;
this.adb.waitForDevice(function(){ didLaunch = true; me.push(null, true); cb(null); });
} else {
// error is already printed by ADB.prototype.waitForActivity
this.adb = null;
this.onStop = null;
cb(err);
}
} else {
logger.info("ADB launched! Ready for commands (will time out in " +
(this.commandTimeoutMs / 1000) + "secs)");

Просмотреть файл

@ -683,7 +683,7 @@ ADB.prototype.waitForActivity = function(cb) {
setTimeout(getFocusedApp, intMs);
} else {
var found = found && found.length > 2 ? found[2] : "null";
var msg = "App never showed up as active. appActivity: " + found + " != " + this.appActivity;
var msg = "App never showed up as active. appActivity: " + found + " != " + targetActivity;
logger.error(msg);
cb(new Error(msg));
}

Просмотреть файл

@ -178,6 +178,7 @@ class AndroidCommandHolder {
}
counter++;
if (lastFoundObj != null && lastFoundObj.exists()) {
Logger.info("Found obj.");
elIds.add(elHash.addElement(lastFoundObj));
} else {
keepSearching = false;