fix(runner): surface focus-tap errors in InputText (#12)

* fix(runner): surface focus-tap errors in InputText action

A failed Tap/TapSelector before InputText was swallowed, so text typed
into the wrong field (or no field) still reported success. Return the
error so the step fails explicitly.

* feat(sample-app): add username EditText and snapshot

Gives the spec a real EditText target (content-desc: username_field)
so the InputText action path can be exercised end-to-end. The typed
value is mirrored into MainActivity.username and surfaced as the
"username" snapshot for spec assertions.

* feat(sample-app): exercise InputText action against username field

Adds typeUsername action and usernameNeverShrinks property to the
sample spec, and extends the integration test to assert the bundled
spec emits an InputText(desc:username_field, "alice") action and that
the property correctly violates when a snapshot reports a shorter
string.
This commit is contained in:
pj authored and GitHub committed 2026-04-18 16:51:35 +07:00
1 parent b457e22569
commit 16e55086d8
6 files changed
+101 -8

No files matched your search

+6 -2
View File
@@ -198,9 +198,13 @@ func applyAction(ctx context.Context, drv driver.Driver, action verifier.Action,
return drv.Tap(ctx, x, y)
case verifier.ActionKindInputText:
if x, y, ok := resolveCoordinates(action, tree); ok {
_ = drv.Tap(ctx, x, y)
if err := drv.Tap(ctx, x, y); err != nil {
return err
}
} else if action.On != "" {
_ = drv.TapSelector(ctx, action.On)
if err := drv.TapSelector(ctx, action.On); err != nil {
return err
}
}
return drv.InputText(ctx, action.Text)
default: