Fix adbkit API invocations (#524)

Update Adbkit to 3.2.3
This commit is contained in:
Karol Wrótniak
2022-05-05 18:43:22 +02:00
committed by GitHub
parent 481f220992
commit 6f09708304
14 changed files with 11712 additions and 11379 deletions

View File

@@ -3,6 +3,7 @@ var util = require('util')
var syrup = require('@devicefarmer/stf-syrup')
var ProtoBuf = require('protobufjs')
var semver = require('semver')
var deviceClient = require('@devicefarmer/adbkit').DeviceClient
var pathutil = require('../../../util/pathutil')
var streamutil = require('../../../util/streamutil')
@@ -30,7 +31,8 @@ module.exports = syrup.serial()
}
function getPath() {
return adb.shell(options.serial, ['pm', 'path', resource.pkg])
var client = deviceClient(adb, options.serial)
return client.shell(['pm', 'path', resource.pkg])
.timeout(10000)
.then(function(out) {
return streamutil.findLine(out, (/^package:/))
@@ -46,7 +48,8 @@ module.exports = syrup.serial()
return getPath()
.then(function(installedPath) {
log.info('Running version check')
return adb.shell(options.serial, util.format(
var client = deviceClient(adb, options.serial)
return client.shell(util.format(
"export CLASSPATH='%s';" +
" exec app_process /system/bin '%s' --version 2>/dev/null"
, installedPath
@@ -74,11 +77,13 @@ module.exports = syrup.serial()
log.info('Installing STFService')
// Uninstall first to make sure we don't have any certificate
// issues.
return adb.uninstall(options.serial, resource.pkg)
var client = deviceClient(adb, options.serial)
return client.uninstall(resource.pkg)
.timeout(15000)
.then(function() {
return promiseutil.periodicNotify(
adb.install(options.serial, resource.apk)
client.install(resource.apk)
, 20000
)
.timeout(65000)