mirror of
https://github.com/priyanshujain/sanderling.git
synced 2026-10-02 11:07:10 +00:00
Remove the JVM sidecar's iOS backend (#65)
* refactor(sidecar): drop IosDriverBackend * refactor(sidecar): route ios platform off the iOS backend * chore(sidecar): remove maestro ios dependencies * feat(testrun): reject physical iOS with a clear message * refactor(sidecar): drop iOS hierarchy helpers and their test * build(sidecar): strip iOS runner bundles and classes from the fat jar * test(testrun): cover physical-iOS rejection
This commit is contained in:
7 files changed
+43
-413
No files matched your search
@@ -21,8 +21,9 @@ import (
|
||||
|
||||
// buildDriver creates the appropriate DeviceDriver for the platform and returns
|
||||
// a cleanup function. For web, ChromeDriver is used directly. An iOS simulator
|
||||
// is driven by the native simulator companion (no JVM). Android and physical
|
||||
// iOS devices use the JVM sidecar, which is extracted, spawned, and dialed.
|
||||
// is driven by the native simulator companion (no JVM). Android uses the JVM
|
||||
// sidecar, which is extracted, spawned, and dialed. Physical iOS devices are
|
||||
// not yet supported.
|
||||
func buildDriver(ctx context.Context, options Options, stdout io.Writer) (driver.DeviceDriver, func(), error) {
|
||||
if err := Preflight(ctx, options.Platform); err != nil {
|
||||
return nil, nil, err
|
||||
@@ -45,7 +46,11 @@ func buildDriver(ctx context.Context, options Options, stdout io.Writer) (driver
|
||||
return d, d.Close, nil
|
||||
}
|
||||
|
||||
// Physical iOS devices and Android use the JVM sidecar, which requires java.
|
||||
if options.Platform == "ios" {
|
||||
return nil, nil, fmt.Errorf("physical-device iOS is not yet supported; run against a simulator instead")
|
||||
}
|
||||
|
||||
// Android uses the JVM sidecar, which requires java.
|
||||
if err := preflightDevice(options.Platform); err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
@@ -65,11 +70,6 @@ func buildDriver(ctx context.Context, options Options, stdout io.Writer) (driver
|
||||
"--port", strconv.Itoa(sidecarPort),
|
||||
"--platform", options.Platform,
|
||||
}
|
||||
if options.Platform == "ios" {
|
||||
if options.iosUDID != "" {
|
||||
sidecarArgs = append(sidecarArgs, "--udid", options.iosUDID)
|
||||
}
|
||||
}
|
||||
sidecarCommand := exec.CommandContext(ctx, "java", sidecarArgs...)
|
||||
sidecarCommand.Stdout = stdout
|
||||
sidecarCommand.Stderr = stdout
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package testrun
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
"os/exec"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestBuildDriverRejectsPhysicalIOS(t *testing.T) {
|
||||
if _, err := exec.LookPath("xcrun"); err != nil {
|
||||
t.Skip("xcrun not on PATH; physical-iOS rejection is reached only after preflight")
|
||||
}
|
||||
options := Options{Platform: "ios"}
|
||||
options.iosIsSimulator = false
|
||||
|
||||
_, cleanup, err := buildDriver(context.Background(), options, io.Discard)
|
||||
if cleanup != nil {
|
||||
cleanup()
|
||||
}
|
||||
if err == nil {
|
||||
t.Fatal("expected physical-device iOS to be rejected")
|
||||
}
|
||||
if !strings.Contains(err.Error(), "not yet supported") {
|
||||
t.Fatalf("expected an unsupported-physical-iOS error, got %v", err)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user