
com.karumi.shot.android.Adb.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of core Show documentation
Show all versions of core Show documentation
Gradle plugin developed to facilitate screenshot testing for Android.
The newest version!
package com.karumi.shot.android
import com.karumi.shot.domain.model.{AppId, Folder}
import scala.sys.process._
object Adb {
var adbBinaryPath: String = ""
}
class Adb {
def devices: List[String] = {
executeAdbCommandWithResult("devices").split('\n').toList.drop(1).map {
line =>
line.split('\t').toList.head
}
}
def pullScreenshots(device: String,
screenshotsFolder: Folder,
appId: AppId): Unit =
executeAdbCommandWithResult(
s"-s $device pull /sdcard/screenshots/$appId.test/screenshots-default/ $screenshotsFolder")
def clearScreenshots(device: String, appId: AppId): Unit =
executeAdbCommand(
s"-s $device shell rm -r /sdcard/screenshots/$appId.test/screenshots-default/")
private def executeAdbCommand(command: String): Int =
s"${Adb.adbBinaryPath} $command".!
private def executeAdbCommandWithResult(command: String): String =
s"${Adb.adbBinaryPath} $command".!!
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy