mirror of
https://github.com/priyanshujain/sanderling.git
synced 2026-10-04 12:07:09 +00:00
fix(runner): trust V8 coordinates for InputText, even at origin
resolveCoordinates required strict positive X/Y, so a V8-emitted InputText for an element at viewport (0, *) or (*, 0) skipped the focus tap and typed into whatever was focused. Distinguish the selector-driven path (mobile) from the coords-only path (web V8) so edge coordinates are honored without breaking the existing tree-lookup fallback. Add applyAction tests covering both the typical web case and the (0,0) edge case.
This commit is contained in:
1 parent
b9ac133345
commit
f853af4fac
2 files changed
+45
-3
No files matched your search
@@ -335,10 +335,18 @@ func collectLogs(ctx context.Context, drv driver.DeviceDriver, since time.Time)
|
||||
}
|
||||
|
||||
func resolveCoordinates(action verifier.Action, tree *hierarchy.Tree) (int, int, bool) {
|
||||
if action.X > 0 && action.Y > 0 {
|
||||
return action.X, action.Y, true
|
||||
// When On is empty, X/Y are authoritative (web V8 path emits coordinates
|
||||
// directly from getBoundingClientRect; the runtime nullifies unresolved
|
||||
// actions upstream so a non-null InputText here always has real coords,
|
||||
// even at (0,0)). When On is set, prefer the tree lookup so stale coords
|
||||
// don't leak from earlier ticks.
|
||||
if action.On == "" {
|
||||
if action.X >= 0 && action.Y >= 0 {
|
||||
return action.X, action.Y, true
|
||||
}
|
||||
return 0, 0, false
|
||||
}
|
||||
if tree != nil && action.On != "" {
|
||||
if tree != nil {
|
||||
if element := tree.Find(action.On); element != nil {
|
||||
x, y := element.Bounds.Center()
|
||||
if x > 0 && y > 0 {
|
||||
@@ -346,6 +354,9 @@ func resolveCoordinates(action verifier.Action, tree *hierarchy.Tree) (int, int,
|
||||
}
|
||||
}
|
||||
}
|
||||
if action.X > 0 && action.Y > 0 {
|
||||
return action.X, action.Y, true
|
||||
}
|
||||
return 0, 0, false
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user