mirror of
https://github.com/priyanshujain/sanderling.git
synced 2026-10-04 20:17:09 +00:00
test(ioscompanion): cover pasteboard grant on launch, drop warm-up tests
This commit is contained in:
1 parent
a0cc3b5d05
commit
8b7a51c5b5
2 files changed
+26
-27
No files matched your search
@@ -109,6 +109,7 @@ func newTestDriver(companion transport.Companion) *Driver {
|
||||
}
|
||||
d.resetContainer = func(context.Context) error { return nil }
|
||||
d.reinstallApp = func(context.Context) error { return nil }
|
||||
d.grantPaste = func(context.Context) error { return nil }
|
||||
return d
|
||||
}
|
||||
|
||||
@@ -137,6 +138,31 @@ func TestLaunchTerminatesFirstThenLaunches(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestLaunchGrantsPasteboardBeforeLaunch(t *testing.T) {
|
||||
companion := &fakeCompanion{accessibilityJSON: "[]"}
|
||||
d := newTestDriver(companion)
|
||||
granted := false
|
||||
d.grantPaste = func(context.Context) error { granted = true; return nil }
|
||||
if err := d.Launch(context.Background(), "", false, nil); err != nil {
|
||||
t.Fatalf("Launch: %v", err)
|
||||
}
|
||||
if !granted {
|
||||
t.Fatal("Launch must grant pasteboard access so unicode input skips the permission prompt")
|
||||
}
|
||||
}
|
||||
|
||||
func TestLaunchContinuesWhenGrantFails(t *testing.T) {
|
||||
companion := &fakeCompanion{accessibilityJSON: "[]"}
|
||||
d := newTestDriver(companion)
|
||||
d.grantPaste = func(context.Context) error { return errors.New("no privacy db") }
|
||||
if err := d.Launch(context.Background(), "", false, nil); err != nil {
|
||||
t.Fatalf("Launch must continue when the grant fails: %v", err)
|
||||
}
|
||||
if indexOf(companion.calls, "launch") < 0 {
|
||||
t.Fatalf("app must still launch; got %v", companion.calls)
|
||||
}
|
||||
}
|
||||
|
||||
func TestLaunchClearStateReinstallsWithAppPath(t *testing.T) {
|
||||
companion := &fakeCompanion{accessibilityJSON: "[]"}
|
||||
d := newTestDriver(companion)
|
||||
|
||||
Reference in new issue
Block a user