diff --git a/ANDROID_HOME_OLD b/ANDROID_HOME_OLD new file mode 100644 index 000000000..3a50222ec --- /dev/null +++ b/ANDROID_HOME_OLD @@ -0,0 +1 @@ +/Users/isaac/code/adt-bundle/sdk diff --git a/lib/driver.js b/lib/driver.js index 3a34cc011..909a195d8 100644 --- a/lib/driver.js +++ b/lib/driver.js @@ -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); @@ -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 diff --git a/test/unit/driver-specs.js b/test/unit/driver-specs.js index 02d11ba49..800e98441 100644 --- a/test/unit/driver-specs.js +++ b/test/unit/driver-specs.js @@ -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;