allow pushStrings to work with 'app' as package, not just file

fix #2749 and add tests
also fix tryNTimes, I think it was vacuously succeeding all the time
(cc @sebv)
This commit is contained in:
Jonathan Lipps
2014-06-05 17:03:53 -07:00
parent 7b419650f1
commit 4b73ef93cf
3 changed files with 11 additions and 4 deletions

View File

@@ -62,7 +62,7 @@ androidCommon.configureApp = function (cb) {
if (this.appIsPackageOrBundle(this.args.app)) {
// we have a package instead of app
this.args.androidPackage = this.args.app;
this.args.appPackage = this.args.app;
this.args.app = null;
logger.debug("App is an Android package, will attempt to run on device");
cb();

View File

@@ -187,11 +187,10 @@ describe("apidemo - basic @skip-ci", function () {
try3Times(function () {
return session.setUp(title)
.catch(function (err) { throw err.data; })
.should.be.rejectedWith(/Error locating the app/);
.should.eventually.be.rejectedWith(/Error locating the app/);
}).nodeify(done);
});
});
});
describe('pre-existing uiautomator session', function () {
@@ -259,6 +258,14 @@ describe("apidemo - basic @skip-ci", function () {
session.setUp(title + "- zip url").nodeify(done);
});
it('should load an app via package', function (done) {
var caps = _.clone(desired);
caps.app = 'io.appium.android.apis';
caps.appActivity = '.ApiDemos';
session = initSession(caps, desired);
session.setUp(title + "- package").nodeify(done);
});
});
});

View File

@@ -1,7 +1,7 @@
"use strict";
var tryNTimes = function (n, fn) {
if (n <= 0) return;
if (n === 1) return fn();
return fn().catch(function () {
return tryNTimes(n - 1, fn);
});