Skip to content

Commit

Permalink
Merge 6ef1818 into 557c5af
Browse files Browse the repository at this point in the history
  • Loading branch information
imurchie committed Sep 28, 2015
2 parents 557c5af + 6ef1818 commit bc328e1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
1 change: 1 addition & 0 deletions ANDROID_HOME_OLD
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/Users/isaac/code/adt-bundle/sdk
5 changes: 3 additions & 2 deletions lib/driver.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ class AndroidDriver extends BaseDriver {
log.info(`Chrome-type package and activity are ${pkg} and ${activity}`);
}

// set up an instance of ADB
this.adb = await ADB.createADB();

if (this.opts.app) {
// find and copy, or download and unzip an app url or path
this.opts.app = await this.helpers.configureApp(this.opts.app, APP_EXTENSION);
Expand Down Expand Up @@ -117,8 +120,6 @@ class AndroidDriver extends BaseDriver {

async startAndroidSession () {
log.info(`Starting Android session`);
// set up an instance of ADB
this.adb = await ADB.createADB();
// set up the device to run on (real or emulator, etc)
this.defaultIME = await helpers.initDevice(this.adb, this.opts);
// Set CompressedLayoutHierarchy on the device based on current settings object
Expand Down
8 changes: 5 additions & 3 deletions test/unit/driver-specs.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,21 @@ describe('driver', () => {
sandbox.stub(driver, 'checkAppPresent');
sandbox.stub(driver, 'checkPackagePresent');
sandbox.stub(driver, 'startAndroidSession');
sandbox.stub(ADB, 'createADB');
});
afterEach(() => {

sandbox.restore();
});
it('should get java version if non is provided', async () => {
it('should get java version if none is provided', async () => {
await driver.createSession({platformName: 'Android', deviceName: 'device', app: 'some.apk'});
driver.opts.javaVersion.should.exist;
});
it('should get browser package details if browserName is provided', async () => {
sandbox.spy(helpers, 'getChromePkg');
sandbox.spy(helpers, 'getChromePkg');
await driver.createSession({platformName: 'Android', deviceName: 'device', browserName: 'Chrome'});
helpers.getChromePkg.calledOnce.should.be.true;
});
});
it('should check an app is present', async () => {
await driver.createSession({platformName: 'Android', deviceName: 'device', app: 'some.apk'});
driver.checkAppPresent.calledOnce.should.be.true;
Expand Down

0 comments on commit bc328e1

Please sign in to comment.