feat(test): add --device flag to target a specific Android device by serial

This commit is contained in:
pj committed 2026-06-09 19:52:11 +05:30
1 parent da6612890f
commit 24be870896
6 files changed
+64 -5

No files matched your search

+3
View File
@@ -145,6 +145,9 @@ func buildDriver(ctx context.Context, options Options, stdout io.Writer) (driver
"--port", strconv.Itoa(sidecarPort),
"--platform", options.Platform,
}
if options.Device != "" {
sidecarArgs = append(sidecarArgs, "--serial", options.Device)
}
sidecarCommand := exec.CommandContext(ctx, "java", sidecarArgs...)
sidecarCommand.Stdout = stdout
sidecarCommand.Stderr = stdout
+2 -1
View File
@@ -26,6 +26,7 @@ type Options struct {
BundleID string
Platform string
AVD string
Device string
IosDevice string
IosAppPath string
Duration time.Duration
@@ -46,7 +47,7 @@ type Options struct {
func Execute(ctx context.Context, options Options, stdout io.Writer) error {
switch options.Platform {
case "android":
if err := android.EnsureDevice(ctx, options.AVD, stdout); err != nil {
if err := android.EnsureDevice(ctx, options.Device, options.AVD, stdout); err != nil {
return err
}
case "ios":