//#region src/shared/fileapi-client.d.ts /** * Client side of the cmd.txt / cmd-result.txt file API, shared by the Node * driver and the MCP server's degraded-mode proxy. * * One logical request = write `# ` to `/cmd.txt`, then poll * `/cmd-result.txt` until the server echoes that reqId back. Correlation is * strictly by reqId — the old mtime-only matching could hand a caller a stale or * foreign result (another process's command, a late write from a slow previous * command). The mtime check stays as a cheap pre-filter. */ /** * Next result-poll interval: ramp from a tight initial gap up to a cap. A fast * command's result is picked up in ~15ms instead of waiting a flat 120ms, while * a slow one still backs off so we don't busy-spin the filesystem. Pure helper * so the ramp is unit-tested independently of real I/O timing. */ declare const nextPollDelay: (current: number) => number; /** * A request id unique across processes and attempts: pid (multi-process safety — * two clients share one cmd.txt) + random (pid reuse) + a monotonic seq. * Generate ONCE per logical command and reuse it across retries — the server * dedups by it, so a resend of a command it already ran replays the recorded * result instead of executing it again. */ declare const newReqId: () => string; //#endregion //#region src/driver/helpers.d.ts /** Eval a JS *expression* in the page and JSON-parse the result. */ declare const read: (expr: string) => Promise; /** * Poll `cond` until it returns true, returning whether it ever did. The * building block for replacing fixed sleeps with condition gates: wait for the * RESULT (a URL param, a rendered row, a closed dialog), never for a guessed * duration — a fast page proceeds immediately, a slow one gets the full window. */ declare function pollUntil(cond: () => Promise, tries?: number, gap?: number): Promise; declare const bodyText: () => Promise; declare const headings: () => Promise; declare const count: (selector: string) => Promise; declare const exists: (selector: string) => Promise; declare const urlSearch: () => Promise; declare const dialogOpen: () => Promise; declare const dialogText: () => Promise; /** Labels of the currently-active tabs (Radix `[role=tab][data-state=active]`). */ declare const activeTabs: () => Promise; /** Value of an input by name — prefers one inside an open dialog, else page-wide. */ declare const fieldValue: (name: string) => Promise; /** Poll an input's value until it's non-empty (edit dialogs hydrate a tick late). */ declare function waitFieldValue(name: string, tries?: number, gap?: number): Promise; declare const bodyHas: (needle: string) => Promise; /** Poll the body for a substring (detail pages hydrate a beat after navigation). */ declare function waitBodyHas(needle: string, tries?: number, gap?: number): Promise; /** * Click the first element matching `selector` whose text passes `match`, in-page * (`el.click()` — position-independent, immune to occlusion/zero-rect targets and * to hidden-tab input throttling). For triggers/options a snapshot doesn't * surface (Radix select items, filter triggers). Returns whether one was clicked. */ declare function clickByText(selector: string, match: RegExp, opts?: { not?: boolean; quiet?: boolean; }): Promise; /** * Ids of the currently-active toasts. Capture immediately BEFORE the mutation * click and pass to {@link expectSuccessToast} so a toast that predates the * mutation can neither satisfy the success match (a lingering "X added" from an * earlier step) nor fail the wait (a stale unrelated error toast). Best-effort: * an unreadable adapter yields an empty baseline (no filtering). */ declare function toastBaseline(): Promise>; /** Options form of {@link expectSuccessToast}'s tail parameters. */ type ExpectToastOpts = { /** Toast ids captured before the mutation — only NEWER toasts count. */ baseline?: Set; tries?: number; gap?: number; }; /** * Wait for the success toast matching `successRe`, failing FAST (with its text) * if an error toast appears first — sonner auto-dismisses an error toast after a * few seconds, so by the time a success-wait times out the error that explains * the failure is gone. The transport is single-in-flight (file API), so a * background watcher would corrupt the test's own commands; instead this one * loop reads ALL active toasts each tick and decides. Use it for any mutation * that should toast on success. Needs the sonner adapter. * * Accepts either the legacy positional `(re, tries, gap)` or an options object * `(re, { baseline, tries, gap })` — pass a {@link toastBaseline} captured just * before the mutation click to scope both the error check and the success match * to toasts the mutation itself produced. */ declare function expectSuccessToast(successRe: RegExp, triesOrOpts?: number | ExpectToastOpts, gapArg?: number): Promise; /** Open a dialog by its trigger button and wait for the dialog to mount. */ declare function openDialog(button: string | RegExp): Promise; /** * Wait for an input by name to mount, type into it, then VERIFY the value stuck — * re-typing on a mismatch. `type` selects-all before inserting, so a re-type * REPLACES (never appends), which self-corrects both an empty field (raced * hydration) and a doubled value (a transport hiccup that re-ran the insert). We * check the value rather than trusting the type's return, because a mis-correlated * result can report success on a fill that didn't land as intended. */ declare function fillField(name: string, value: string): Promise; /** Submit the open dialog via its primary button. */ declare const submitDialog: (label?: RegExp) => Promise; /** Poll until no dialog is mounted (a create/save mutation closes it shortly after). */ declare function waitDialogClosed(tries?: number, gap?: number): Promise; /** * Create an entity via its dialog: open → fill fields → submit → wait closed. * Gates the submit on the form's `canSubmit` (via the tanstack-form adapter) * instead of a blind sleep; pass `expectToast` to also assert the success toast * (via the sonner adapter) before the dialog closes. */ declare function createViaDialog(opts: { button: string | RegExp; fields: Record; submit?: RegExp; expectToast?: RegExp; }): Promise; /** * Open a Select trigger (a `