fix(runtime): surface unresolved action targets instead of dropping silently

serializeAction emitted {x:0,y:0} via `?? 0` whenever a Tap/InputText/Swipe
target failed to resolve to coordinates. The runner then collapsed those
to ErrNoAction, so every selector typo became a silent no-op tick.

Have the runtime return null on unresolved targets and log a console
warning (visible via chromedp's runtime listener). Drop the now-redundant
{0,0} -> ErrNoAction guard so a deliberate Tap at the origin actually
fires.
This commit is contained in:
pj committed 2026-05-03 11:01:16 +07:00
1 parent 372fd23d87
commit 57101df48d
2 files changed
+17 -8

No files matched your search

-3
View File
@@ -446,9 +446,6 @@ func nextActionFromV8(ctx context.Context, web driver.WebDriver) (verifier.Actio
}
switch decoded.Kind {
case "Tap":
if decoded.X == 0 && decoded.Y == 0 {
return verifier.Action{}, verifier.ErrNoAction
}
return verifier.Action{Kind: verifier.ActionKindTap, X: decoded.X, Y: decoded.Y}, nil
case "InputText":
return verifier.Action{
+17 -5
View File
@@ -471,20 +471,32 @@ function serializeAction(action: unknown): unknown {
switch (obj.kind) {
case "Tap": {
const point = pointOf(obj.on);
return { kind: "Tap", x: point?.x ?? 0, y: point?.y ?? 0 };
if (!point) {
console.warn("[sanderling] Tap target did not resolve to coordinates");
return null;
}
return { kind: "Tap", x: point.x, y: point.y };
}
case "InputText": {
const point = pointOf(obj.into);
if (!point) {
console.warn("[sanderling] InputText target did not resolve to coordinates");
return null;
}
return {
kind: "InputText",
x: point?.x ?? 0,
y: point?.y ?? 0,
x: point.x,
y: point.y,
text: obj.text ?? "",
};
}
case "Swipe": {
const from = pointOf(obj.from) ?? { x: 0, y: 0 };
const to = pointOf(obj.to) ?? { x: 0, y: 0 };
const from = pointOf(obj.from);
const to = pointOf(obj.to);
if (!from || !to) {
console.warn("[sanderling] Swipe endpoints did not resolve to coordinates");
return null;
}
return {
kind: "Swipe",
from_x: from.x,