Skip to content

Commit

Permalink
fix installApp name conflict and add tests (fix appium#3030)
Browse files Browse the repository at this point in the history
  • Loading branch information
jlipps committed Jul 1, 2014
1 parent d14108b commit 3d4a486
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 8 deletions.
2 changes: 1 addition & 1 deletion lib/devices/android/android-common.js
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ androidCommon.uninstallApp = function (cb) {
}
};

androidCommon.installApp = function (cb) {
androidCommon.installAppForTest = function (cb) {
if (this.args.app === null) {
logger.debug("Skipping install since we launched with a package instead " +
"of an app path");
Expand Down
8 changes: 4 additions & 4 deletions lib/devices/android/android-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -795,14 +795,14 @@ androidController.removeApp = function (appPackage, cb) {
deviceCommon.removeApp(removeCommand, this.args.udid, appPackage, cb);
};

androidController.installApp = function (appPackage, cb) {
androidController.installApp = function (appPath, cb) {
var installationCommand = null;
if (this.args.udid) {
installationCommand = 'adb -s ' + this.args.udid + ' install ' + appPackage;
installationCommand = 'adb -s ' + this.args.udid + ' install ' + appPath;
} else {
installationCommand = 'adb install ' + appPackage;
installationCommand = 'adb install ' + appPath;
}
deviceCommon.installApp(installationCommand, this.args.udid, appPackage, cb);
deviceCommon.installApp(installationCommand, this.args.udid, appPath, cb);
};

androidController.unpackApp = function (req, cb) {
Expand Down
2 changes: 1 addition & 1 deletion lib/devices/android/android.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ Android.prototype.start = function (cb, onDie) {
this.pushStrings.bind(this),
this.processFromManifest.bind(this),
this.uninstallApp.bind(this),
this.installApp.bind(this),
this.installAppForTest.bind(this),
this.forwardPort.bind(this),
this.pushAppium.bind(this),
this.initUnicode.bind(this),
Expand Down
2 changes: 1 addition & 1 deletion lib/devices/android/selendroid.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ Selendroid.prototype.start = function (cb) {
conditionalInstallSelendroid,
this.extractStringsSelendroid.bind(this),
this.uninstallApp.bind(this),
this.installApp.bind(this),
this.installAppForTest.bind(this),
this.forwardPort.bind(this),
this.initUnicode.bind(this),
this.pushSettingsApp.bind(this),
Expand Down
9 changes: 8 additions & 1 deletion test/functional/android/apidemos/basic-specs.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ var env = require('../../../helpers/env')
, should = chai.should()
, spawn = require('child_process').spawn
, _ = require('underscore')
, getAppPath = require('../../../helpers/app').getAppPath
, androidReset = require('../../../helpers/reset').androidReset;

describe("apidemo - basic @skip-ci", function () {
Expand Down Expand Up @@ -90,10 +91,16 @@ describe("apidemo - basic @skip-ci", function () {
}).nodeify(done);
});

it('should be able to detect if app is installed', function (done) {
it('should be able to install/remove app and detect its status', function (done) {
driver
.isAppInstalled('foo')
.should.eventually.equal(false)
.isAppInstalled('io.appium.android.apis')
.should.eventually.equal(true)
.removeApp('io.appium.android.apis')
.isAppInstalled('io.appium.android.apis')
.should.eventually.equal(false)
.installApp(getAppPath('ApiDemos'))
.isAppInstalled('io.appium.android.apis')
.should.eventually.equal(true)
.nodeify(done);
Expand Down

0 comments on commit 3d4a486

Please sign in to comment.