appium-adb
Advanced tools
Comparing version 2.0.0-beta3 to 2.0.0-beta4
@@ -15,3 +15,3 @@ import _ from 'lodash'; | ||
keyPassword: null, | ||
adb: {path: "adb", defaultArgs: []}, | ||
executable: {path: "adb", defaultArgs: []}, | ||
tmpDir: null, | ||
@@ -38,6 +38,6 @@ curDeviceId: null, | ||
if (opts.remoteAdbHost) { | ||
this.adb.defaultArgs.push("-H", opts.remoteAdbHost); | ||
this.executable.defaultArgs.push("-H", opts.remoteAdbHost); | ||
} | ||
if (opts.remoteAdbPort) { | ||
this.adb.defaultArgs.push("-P", opts.remoteAdbPort); | ||
this.executable.defaultArgs.push("-P", opts.remoteAdbPort); | ||
} | ||
@@ -44,0 +44,0 @@ this.initJars(); |
@@ -14,4 +14,4 @@ import log from '../logger.js'; | ||
methods.getAdbWithCorrectAdbPath = async function () { | ||
this.adb.path = await this.getSdkBinaryPath("adb"); | ||
this.binaries.adb = this.adb.path; | ||
this.executable.path = await this.getSdkBinaryPath("adb"); | ||
this.binaries.adb = this.executable.path; | ||
return this.adb; | ||
@@ -126,2 +126,6 @@ }; | ||
methods.getAdbPath = function () { | ||
return this.executable.path; | ||
}; | ||
methods.isScreenLocked = async function () { | ||
@@ -450,9 +454,9 @@ let stdout = await this.shell(['dumpsys', 'window']); | ||
return new Promise(async (resolve, reject) => { | ||
let args = this.adb.defaultArgs | ||
let args = this.executable.defaultArgs | ||
.concat(['shell', 'am', 'instrument', '-e', 'coverage', 'true', '-w']) | ||
.concat([instrumentClass]); | ||
log.debug(`Collecting coverage data with: ${[this.adb.path].concat(args).join(' ')}`); | ||
log.debug(`Collecting coverage data with: ${[this.executable.path].concat(args).join(' ')}`); | ||
try { | ||
// am instrument runs for the life of the app process. | ||
this.instrumentProc = new SubProcess(this.adb.path, args); | ||
this.instrumentProc = new SubProcess(this.executable.path, args); | ||
await this.instrumentProc.start(0); | ||
@@ -459,0 +463,0 @@ this.instrumentProc.on('output', (stdout, stderr) => { |
@@ -84,3 +84,3 @@ import path from 'path'; | ||
try { | ||
let {stdout} = await exec(this.adb.path, ['devices']); | ||
let {stdout} = await exec(this.executable.path, ['devices']); | ||
// expecting adb devices to return output as | ||
@@ -145,3 +145,3 @@ // List of devices attached | ||
try { | ||
await exec(this.adb.path, ['kill-server']); | ||
await exec(this.executable.path, ['kill-server']); | ||
} catch (e) { | ||
@@ -164,3 +164,4 @@ log.error("Error killing ADB server, going to see if it's online anyway"); | ||
} | ||
let {stdout} = await exec(this.adb.path, this.adb.defaultArgs.concat(cmd), opts); | ||
let {stdout} = await exec(this.executable.path, | ||
this.executable.defaultArgs.concat(cmd), opts); | ||
// sometimes ADB prints out stupid stdout warnings that we don't want | ||
@@ -252,3 +253,3 @@ // to include in any of the response data, so let's strip it out | ||
this.curDeviceId = deviceId; | ||
this.adb.defaultArgs.push("-s", deviceId); | ||
this.executable.defaultArgs.push("-s", deviceId); | ||
}; | ||
@@ -255,0 +256,0 @@ |
{ | ||
"name": "appium-adb", | ||
"version": "2.0.0-beta3", | ||
"version": "2.0.0-beta4", | ||
"description": "appium-adb", | ||
@@ -5,0 +5,0 @@ "main": "./build/index.js", |
@@ -12,3 +12,3 @@ import chai from 'chai'; | ||
let adb = await ADB.createADB(); | ||
should.exist(adb.adb.path); | ||
should.exist(adb.executable.path); | ||
}); | ||
@@ -18,3 +18,3 @@ it('should correctly return adb from path when ANDROID_HOME is not set', async () => { | ||
let adb = await ADB.createADB(opts); | ||
should.exist(adb.adb.path); | ||
should.exist(adb.executable.path); | ||
}); | ||
@@ -21,0 +21,0 @@ it.skip('should error out if binary not persent', async () => { |
@@ -13,3 +13,3 @@ import chai from 'chai'; | ||
adb = await ADB.createADB(); | ||
logcat = new Logcat({adb: adb.adb, debug: false, debugTrace: false}); | ||
logcat = new Logcat({adb: adb.executable, debug: false, debugTrace: false}); | ||
}); | ||
@@ -16,0 +16,0 @@ it('getLogs should return logs', async function () { |
@@ -409,4 +409,4 @@ import chai from 'chai'; | ||
it('should call shell with correct arguments', async () => { | ||
adb.adb.defaultArgs = []; | ||
adb.adb.path = "dummy_adb_path"; | ||
adb.executable.defaultArgs = []; | ||
adb.executable.path = "dummy_adb_path"; | ||
let conn = new events.EventEmitter(); | ||
@@ -417,3 +417,3 @@ conn.start = () => { }; // do nothing | ||
waitActivity = 'waitActivity'; | ||
let args = adb.adb.defaultArgs | ||
let args = adb.executable.defaultArgs | ||
.concat(['shell', 'am', 'instrument', '-e', 'coverage', 'true', '-w']) | ||
@@ -465,2 +465,5 @@ .concat([instrumentClass]); | ||
}); | ||
it('getAdbPath should correctly return adbPath', () => { | ||
adb.getAdbPath().should.equal(adb.executable.path); | ||
}); | ||
}); |
@@ -10,3 +10,3 @@ import chai from 'chai'; | ||
const adb = new ADB(); | ||
adb.adb.path = 'adb_path'; | ||
adb.executable.path = 'adb_path'; | ||
@@ -16,3 +16,3 @@ describe('System calls', withMocks({teen_process}, (mocks) => { | ||
mocks.teen_process.expects("exec") | ||
.once().withExactArgs(adb.adb.path, ['devices']) | ||
.once().withExactArgs(adb.executable.path, ['devices']) | ||
.returns({stdout:"List of devices attached \n emulator-5554 device"}); | ||
@@ -25,3 +25,3 @@ let devices = await adb.getConnectedDevices(); | ||
mocks.teen_process.expects("exec") | ||
.once().withExactArgs(adb.adb.path, ['devices']) | ||
.once().withExactArgs(adb.executable.path, ['devices']) | ||
.returns({stdout:"foobar"}); | ||
@@ -34,3 +34,3 @@ await adb.getConnectedDevices().should.eventually.be | ||
mocks.teen_process.expects("exec") | ||
.atLeast(2).withExactArgs(adb.adb.path, ['devices']) | ||
.atLeast(2).withExactArgs(adb.executable.path, ['devices']) | ||
.returns({stdout:"List of devices attached"}); | ||
@@ -43,3 +43,3 @@ await adb.getDevicesWithRetry(1000).should.eventually.be | ||
mocks.teen_process.expects("exec") | ||
.atLeast(2).withExactArgs(adb.adb.path, ['devices']) | ||
.atLeast(2).withExactArgs(adb.executable.path, ['devices']) | ||
.returns({stdout:"foobar"}); | ||
@@ -52,3 +52,3 @@ await adb.getDevicesWithRetry(1000).should.eventually.be | ||
mocks.teen_process.expects("exec") | ||
.once().withExactArgs(adb.adb.path, ['devices']) | ||
.once().withExactArgs(adb.executable.path, ['devices']) | ||
.returns({stdout:"List of devices attached \n emulator-5554 device"}); | ||
@@ -64,3 +64,3 @@ let devices = await adb.getDevicesWithRetry(1000); | ||
mocks.teen_process.expects("exec") | ||
.withExactArgs(adb.adb.path, ['devices']) | ||
.withExactArgs(adb.executable.path, ['devices']) | ||
.returns({stdout:"List of devices attached \n emulator-5554 device"}); | ||
@@ -82,3 +82,3 @@ let devices = await adb.getDevicesWithRetry(2000); | ||
adb.curDeviceId.should.equal('foobar'); | ||
adb.adb.defaultArgs.should.include('foobar'); | ||
adb.executable.defaultArgs.should.include('foobar'); | ||
}); | ||
@@ -88,5 +88,5 @@ it('setDevice should set the device id and emu port from obj', () => { | ||
adb.curDeviceId.should.equal('emulator-1234'); | ||
adb.adb.defaultArgs.should.include('emulator-1234'); | ||
adb.executable.defaultArgs.should.include('emulator-1234'); | ||
adb.emulatorPort.should.equal(1234); | ||
}); | ||
})); |
Sorry, the diff of this file is not supported yet
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 1 instance in 1 package
3081
3
21558247
49