test(ioscompanion): cover replace-on-input and TextReplacer capability

This commit is contained in:
pj committed 2026-06-07 12:19:56 +05:30
1 parent 6cc84fcafe
commit 4792626515
2 files changed
+36 -25

No files matched your search

+9 -5
View File
@@ -409,9 +409,9 @@ func TestHealthReportsIOS(t *testing.T) {
}
}
// The driver must satisfy DeviceDriver and ForegroundChecker, but must NOT
// satisfy TextReplacer: its InputText appends, so the runner's pre-erase must
// stay in place.
// The driver must satisfy DeviceDriver, ForegroundChecker, and TextReplacer
// (its InputText clears the field then types, so the runner skips its
// blackout-fragile pre-erase), but must NOT satisfy FocusedWindowChecker.
func TestCapabilityAssertions(t *testing.T) {
var instance any = newTestDriver(&fakeCompanion{})
if _, ok := instance.(driver.DeviceDriver); !ok {
@@ -420,8 +420,12 @@ func TestCapabilityAssertions(t *testing.T) {
if _, ok := instance.(driver.ForegroundChecker); !ok {
t.Fatal("Driver must implement ForegroundChecker")
}
if _, ok := instance.(driver.TextReplacer); ok {
t.Fatal("Driver must NOT implement TextReplacer")
replacer, ok := instance.(driver.TextReplacer)
if !ok {
t.Fatal("Driver must implement TextReplacer")
}
if !replacer.ReplacesTextOnInput() {
t.Fatal("ReplacesTextOnInput must report true")
}
if _, ok := instance.(driver.FocusedWindowChecker); ok {
t.Fatal("Driver must NOT implement FocusedWindowChecker")