/** * Drive the iOS Simulator through a sequence of UI actions to amplify a * suspected leak before capturing a memgraph. Tied to the leak/perf workflow: * the only reason this tool exists is to make verify-fix loops reproducible * (same scenario before/after a fix) and to surface leaks that only manifest * after N iterations of a flow. * * Soft dependency on `axe` (https://github.com/cameroncooke/AXe). When axe is * not on PATH, this tool returns ok:false with a structured workaroundNotice * pointing the caller at the install instructions, instead of throwing. */ import { z } from "zod"; import { type TapTarget } from "../runtime/axe.js"; declare const actionSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{ type: z.ZodLiteral<"tap">; label: z.ZodOptional; elementId: z.ZodOptional; coords: z.ZodOptional>; }, "strip", z.ZodTypeAny, { type: "tap"; label?: string | undefined; elementId?: string | undefined; coords?: [number, number] | undefined; }, { type: "tap"; label?: string | undefined; elementId?: string | undefined; coords?: [number, number] | undefined; }>, z.ZodObject<{ type: z.ZodLiteral<"swipe">; from: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>; to: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>; durationMs: z.ZodDefault; }, "strip", z.ZodTypeAny, { type: "swipe"; durationMs: number; from: [number, number]; to: [number, number]; }, { type: "swipe"; from: [number, number]; to: [number, number]; durationMs?: number | undefined; }>, z.ZodObject<{ type: z.ZodLiteral<"wait">; seconds: z.ZodNumber; }, "strip", z.ZodTypeAny, { type: "wait"; seconds: number; }, { type: "wait"; seconds: number; }>, z.ZodObject<{ type: z.ZodLiteral<"type">; text: z.ZodString; }, "strip", z.ZodTypeAny, { type: "type"; text: string; }, { type: "type"; text: string; }>]>; export type ReplayAction = z.infer; export declare const replayScenarioShape: { readonly simulatorUDID: z.ZodString; readonly actions: z.ZodArray; label: z.ZodOptional; elementId: z.ZodOptional; coords: z.ZodOptional>; }, "strip", z.ZodTypeAny, { type: "tap"; label?: string | undefined; elementId?: string | undefined; coords?: [number, number] | undefined; }, { type: "tap"; label?: string | undefined; elementId?: string | undefined; coords?: [number, number] | undefined; }>, z.ZodObject<{ type: z.ZodLiteral<"swipe">; from: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>; to: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>; durationMs: z.ZodDefault; }, "strip", z.ZodTypeAny, { type: "swipe"; durationMs: number; from: [number, number]; to: [number, number]; }, { type: "swipe"; from: [number, number]; to: [number, number]; durationMs?: number | undefined; }>, z.ZodObject<{ type: z.ZodLiteral<"wait">; seconds: z.ZodNumber; }, "strip", z.ZodTypeAny, { type: "wait"; seconds: number; }, { type: "wait"; seconds: number; }>, z.ZodObject<{ type: z.ZodLiteral<"type">; text: z.ZodString; }, "strip", z.ZodTypeAny, { type: "type"; text: string; }, { type: "type"; text: string; }>]>, "many">; readonly repeat: z.ZodDefault; readonly settleBetweenActionsMs: z.ZodDefault; readonly finalUITreePath: z.ZodOptional; readonly screenshotDir: z.ZodOptional; }; export declare const replayScenarioSchema: z.ZodObject<{ readonly simulatorUDID: z.ZodString; readonly actions: z.ZodArray; label: z.ZodOptional; elementId: z.ZodOptional; coords: z.ZodOptional>; }, "strip", z.ZodTypeAny, { type: "tap"; label?: string | undefined; elementId?: string | undefined; coords?: [number, number] | undefined; }, { type: "tap"; label?: string | undefined; elementId?: string | undefined; coords?: [number, number] | undefined; }>, z.ZodObject<{ type: z.ZodLiteral<"swipe">; from: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>; to: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>; durationMs: z.ZodDefault; }, "strip", z.ZodTypeAny, { type: "swipe"; durationMs: number; from: [number, number]; to: [number, number]; }, { type: "swipe"; from: [number, number]; to: [number, number]; durationMs?: number | undefined; }>, z.ZodObject<{ type: z.ZodLiteral<"wait">; seconds: z.ZodNumber; }, "strip", z.ZodTypeAny, { type: "wait"; seconds: number; }, { type: "wait"; seconds: number; }>, z.ZodObject<{ type: z.ZodLiteral<"type">; text: z.ZodString; }, "strip", z.ZodTypeAny, { type: "type"; text: string; }, { type: "type"; text: string; }>]>, "many">; readonly repeat: z.ZodDefault; readonly settleBetweenActionsMs: z.ZodDefault; readonly finalUITreePath: z.ZodOptional; readonly screenshotDir: z.ZodOptional; }, "strip", z.ZodTypeAny, { repeat: number; simulatorUDID: string; actions: ({ type: "tap"; label?: string | undefined; elementId?: string | undefined; coords?: [number, number] | undefined; } | { type: "swipe"; durationMs: number; from: [number, number]; to: [number, number]; } | { type: "wait"; seconds: number; } | { type: "type"; text: string; })[]; settleBetweenActionsMs: number; finalUITreePath?: string | undefined; screenshotDir?: string | undefined; }, { simulatorUDID: string; actions: ({ type: "tap"; label?: string | undefined; elementId?: string | undefined; coords?: [number, number] | undefined; } | { type: "swipe"; from: [number, number]; to: [number, number]; durationMs?: number | undefined; } | { type: "wait"; seconds: number; } | { type: "type"; text: string; })[]; repeat?: number | undefined; settleBetweenActionsMs?: number | undefined; finalUITreePath?: string | undefined; screenshotDir?: string | undefined; }>; export type ReplayScenarioInput = z.infer; export interface ReplayScenarioFailure { iteration: number; stepIndex: number; reason: string; } export interface ReplayScenarioWorkaroundNotice { issue: "axe-not-found"; message: string; } export interface ReplayScenarioResult { ok: boolean; executedSteps: number; failures: ReplayScenarioFailure[]; totalDurationMs: number; finalUITreePath?: string; /** v1.15+. When screenshotDir was provided, the absolute paths of the captured PNGs in order. Empty array when screenshotDir was omitted. */ screenshotPaths?: string[]; workaroundNotice?: ReplayScenarioWorkaroundNotice; } export declare function replayScenario(input: ReplayScenarioInput): Promise; /** * v1.15+. Run `xcrun simctl io screenshot ` to capture the * current simulator state. Returns `true` on success, `false` on any * failure (we surface failures via the `failures[]` array on the * result, no exceptions thrown so the scenario continues). * * Exported so callers / tests can drive screenshot capture independently * of the scenario loop. */ export declare function captureSimulatorScreenshot(udid: string, outputPath: string): Promise; /** Pure: convert a tap-action input shape into the runtime TapTarget union. Exposed for tests. */ export declare function resolveTapTarget(action: { label?: string; elementId?: string; coords?: [number, number]; }): TapTarget; export {};