feat(cli): add --android-app-path for clear-state reinstall

Wires the APK path from the test command through to the sidecar client so
Android clear-state can reset apps on OEM builds that deny pm clear.
This commit is contained in:
pj committed 2026-06-10 15:20:41 +05:30
1 parent 015f619693
commit 921ecb910e
4 files changed
+5

No files matched your search

+2
View File
@@ -25,6 +25,7 @@ type testOptions struct {
device string
iosDevice string
iosAppPath string
androidAppPath string
duration time.Duration
seed int64
output string
@@ -56,6 +57,7 @@ func parseTestArgs(args []string, stderr io.Writer) (testOptions, error) {
flagSet.StringVar(&options.device, "device", "", "Android device serial (from `adb devices`) to target when several are connected")
flagSet.StringVar(&options.iosDevice, "ios-device", "", "iOS target: a simulator name/UDID to boot, or a connected device's name, UDID, or CoreDevice id")
flagSet.StringVar(&options.iosAppPath, "ios-app-path", "", "path to the .app bundle for iOS clear-state reinstall (simulator: simctl; device: devicectl)")
flagSet.StringVar(&options.androidAppPath, "android-app-path", "", "path to the .apk for Android clear-state reinstall; required to reset apps on OEM builds that deny `pm clear`")
flagSet.DurationVar(&options.duration, "duration", 5*time.Minute, "total test duration")
flagSet.Int64Var(&options.seed, "seed", 0, "RNG seed (0 = random)")
flagSet.StringVar(&options.output, "output", "./runs", "output directory for traces")
+1
View File
@@ -16,6 +16,7 @@ func runTestPipeline(ctx context.Context, options testOptions, stdout io.Writer)
Device: options.device,
IosDevice: options.iosDevice,
IosAppPath: options.iosAppPath,
AndroidAppPath: options.androidAppPath,
Duration: options.duration,
Seed: options.seed,
Output: options.output,
+1
View File
@@ -170,6 +170,7 @@ func buildDriver(ctx context.Context, options Options, stdout io.Writer) (driver
return nil, nil, fmt.Errorf("dial sidecar: %w", err)
}
driverClient.SetPlatform(options.Platform)
driverClient.SetClearStateReinstall(options.Device, options.AndroidAppPath, stdout)
// WaitForHealth confirms the gRPC sidecar is up. For iOS, the WDA warmup
// (absorbing the XCUITest startup race) runs inside IosDriverBackend.init
// in the sidecar - no additional sleep needed here.
+1
View File
@@ -29,6 +29,7 @@ type Options struct {
Device string
IosDevice string
IosAppPath string
AndroidAppPath string
Duration time.Duration
Seed int64
Output string