StepScreenshotOptions.beforeAction constructor
StepScreenshotOptions.beforeAction({})
Before tap/toggle/etc.: wait for paint, short settle when the executor has not already resolved the target. A resolved tap is captured at the executor boundary without advancing another frame, so the evidence stays on the pre-action screen and avoids a redundant stability pump.
requireVisibleActionHighlight is only for optional taps — it drops
frames whose highlight lands on flat empty pixels (loading chrome).
Required actions must keep the shot even when the control was off-screen
and just scrolled into view (low-contrast rows / partial paints).
Implementation
factory StepScreenshotOptions.beforeAction({
bool requireVisibleActionHighlight = false,
bool targetAlreadyResolved = false,
}) =>
StepScreenshotOptions(
// Tap execution already pumps immediately before this callback
// (`tap.beforeTap` or `tap.ensureVisible`). Avoid advancing one more
// frame and keep the captured image at the executor boundary.
pumpBeforeCapture: !targetAlreadyResolved,
// The tap path resolves a unique hit-testable target immediately
// before invoking this callback. Re-running visibility recovery here
// would perform another finder walk, Scrollable.ensureVisible, and
// pump on every tap. Other actions keep the defensive visibility pass.
ensureTargetVisible: !targetAlreadyResolved,
// Action execution has already resolved the target immediately
// before this callback. Waiting for it again duplicates the action
// configured action timeout and makes the first-step capture appear
// missing while adding the same delay to every tap.
waitForTarget: false,
waitForLottie: false,
stabilize: !targetAlreadyResolved,
requireVisibleActionHighlight: requireVisibleActionHighlight,
);