feat(cli): add --ios-app-path flag

This commit is contained in:
pj committed 2026-06-06 23:45:13 +05:30
1 parent 20dab0ae2f
commit 30c84288f5
3 files changed
+46 -18

No files matched your search

+11 -9
View File
@@ -16,15 +16,16 @@ import (
var Version = "dev" var Version = "dev"
type testOptions struct { type testOptions struct {
spec string spec string
bundleID string bundleID string
platform string platform string
avd string avd string
iosDevice string iosDevice string
duration time.Duration iosAppPath string
seed int64 duration time.Duration
output string seed int64
clearData bool output string
clearData bool
} }
const topUsage = `sanderling is a property-based UI fuzzer for mobile apps. const topUsage = `sanderling is a property-based UI fuzzer for mobile apps.
@@ -50,6 +51,7 @@ func parseTestArgs(args []string, stderr io.Writer) (testOptions, error) {
flagSet.StringVar(&options.platform, "platform", "android", "target platform: android, ios, web") flagSet.StringVar(&options.platform, "platform", "android", "target platform: android, ios, web")
flagSet.StringVar(&options.avd, "avd", "", "Android AVD name to boot if no device is connected") flagSet.StringVar(&options.avd, "avd", "", "Android AVD name to boot if no device is connected")
flagSet.StringVar(&options.iosDevice, "ios-device", "", "iOS simulator name or UDID to boot if none is running") flagSet.StringVar(&options.iosDevice, "ios-device", "", "iOS simulator name or UDID to boot if none is running")
flagSet.StringVar(&options.iosAppPath, "ios-app-path", "", "path to the .app bundle for iOS simulator clear-state reinstall")
flagSet.DurationVar(&options.duration, "duration", 5*time.Minute, "total test duration") flagSet.DurationVar(&options.duration, "duration", 5*time.Minute, "total test duration")
flagSet.Int64Var(&options.seed, "seed", 0, "RNG seed (0 = random)") flagSet.Int64Var(&options.seed, "seed", 0, "RNG seed (0 = random)")
flagSet.StringVar(&options.output, "output", "./runs", "output directory for traces") flagSet.StringVar(&options.output, "output", "./runs", "output directory for traces")
+25
View File
@@ -181,6 +181,31 @@ func TestParseTestArgs_IosDeviceFlag(t *testing.T) {
} }
} }
func TestParseTestArgs_IosAppPathFlag(t *testing.T) {
options, err := parseTestArgs([]string{
"--spec", "s.ts",
"--bundle-id", "com.example.app",
"--platform", "ios",
"--ios-app-path", "/tmp/build/iosApp.app",
}, io.Discard)
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
if options.iosAppPath != "/tmp/build/iosApp.app" {
t.Errorf("expected iosAppPath=/tmp/build/iosApp.app, got %q", options.iosAppPath)
}
}
func TestParseTestArgs_IosAppPathOptional(t *testing.T) {
options, err := parseTestArgs([]string{"--spec", "s.ts", "--bundle-id", "com.example.app"}, io.Discard)
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
if options.iosAppPath != "" {
t.Errorf("iosAppPath default: got %q, want empty", options.iosAppPath)
}
}
func TestRun_TestSubcommand_PipelineErrors(t *testing.T) { func TestRun_TestSubcommand_PipelineErrors(t *testing.T) {
// Web skips host-dependent device boot and bundles first, so a missing spec // Web skips host-dependent device boot and bundles first, so a missing spec
// deterministically surfaces a bundle-resolution error. This proves the // deterministically surfaces a bundle-resolution error. This proves the
+10 -9
View File
@@ -9,14 +9,15 @@ import (
func runTestPipeline(ctx context.Context, options testOptions, stdout io.Writer) error { func runTestPipeline(ctx context.Context, options testOptions, stdout io.Writer) error {
return testrun.Execute(ctx, testrun.Options{ return testrun.Execute(ctx, testrun.Options{
Spec: options.spec, Spec: options.spec,
BundleID: options.bundleID, BundleID: options.bundleID,
Platform: options.platform, Platform: options.platform,
AVD: options.avd, AVD: options.avd,
IosDevice: options.iosDevice, IosDevice: options.iosDevice,
Duration: options.duration, IosAppPath: options.iosAppPath,
Seed: options.seed, Duration: options.duration,
Output: options.output, Seed: options.seed,
ClearData: options.clearData, Output: options.output,
ClearData: options.clearData,
}, stdout) }, stdout)
} }