#!/usr/bin/env node import { ConfigurationSettings, ProgramChoices } from './types'; export type SummaryObject = { tests?: number; passing?: number; failing?: number; pending?: number; skipped?: number; duration?: number; }; export type EndpointTestResult = { testTitle: string; errorMessage?: string; endpointTitle: string; viewport: string; }; export type EndpointTestResultsGroup = { passing: EndpointTestResult[]; failing: EndpointTestResult[]; skipped: EndpointTestResult[]; unchanged: EndpointTestResult[]; }; /** * Snapshot of the currently running suite queue, exposed via * GET /api/test/queue-status so the web UI can restore the * queue view after a page refresh. */ export type QueueSuiteProgress = { suite: string; status: 'pending' | 'running' | 'complete' | 'skipped' | 'stopped'; diffs: string[]; failed: boolean; }; export type LiveQueueState = { active: boolean; testType: string | null; suites: string[]; currentIndex: number; suiteResults: QueueSuiteProgress[]; /** * Server-generated id for the current queue run. Clients restoring * mid-queue use this with the WebSocket `attach-stream` command to prove * they own the run before the server rebinds the live output stream. */ runId: string | null; }; export declare const getLiveQueueState: () => LiveQueueState; /** * Mark a set of diff files as no longer outstanding for a given suite in the * live queue state. Called after an assessment finalizes (mid-queue or * post-queue) so the home page's restored view no longer offers the user a * chance to re-enter assessment for files that have already been handled — * which would otherwise 500 on `/diffs-data` because the received images * have been deleted (on approve) or no longer correspond to a live diff. */ export declare const markDiffsAssessed: (suiteSlug: string, handledImageNames: string[]) => void; /** * Snapshot of a currently running single-suite scan (i.e. not driven by the * queue runner). Exposed via GET /api/test/live-state so the web UI can * restore the run-test page after a refresh. */ export type LiveScanState = { active: boolean; suite: string | null; testType: string | null; targetEndpointTitles: string[]; targetViewports: (string | number[])[]; startedAt: string | null; /** * Server-generated id for the current scan run. Clients restoring * mid-scan use this with the WebSocket `attach-stream` command to prove * they own the run before the server rebinds the live output stream. */ runId: string | null; }; export declare const getLiveScanState: () => LiveScanState; /** * Rolling buffer of stdout / status events produced by the currently running * (or most-recently-finished) scan or queue. Lets a client that joined late * (e.g. after a page refresh) replay the terminal output up to the point of * reconnect. Cleared when a new run starts; capped so it can't grow without * bound during a long-running queue. */ type LiveOutputEntry = { stdout: string; color?: string; }; export declare const getLiveOutputBuffer: () => LiveOutputEntry[]; export declare const getLastSummaryPayload: () => any; export declare const getActiveRunId: () => string | null; /** * Attempt to bind a freshly-connected WebSocket as the live-output stream * target. Only succeeds when the caller proves it owns the current run by * passing a matching `runId`. Stale tabs, second windows, and incidental * sockets cannot rebind because they don't know the runId of the active run. */ export declare const setActiveStreamWs: (ws: WebSocket, runId: string) => { ok: boolean; reason?: string; }; export declare const getActiveStreamWs: () => WebSocket | null; export declare const getVersion: () => any; export declare const getDiffsForWeb: (suiteSlug: string, conf?: ConfigurationSettings) => import("./diff-assessment-web").DiffObject[]; /** * Stop the currently running suite queue. Kills the active Cypress process * and prevents further suites from starting. */ export declare const stopSuiteQueue: () => void; /** * Run a queue of suites via the web UI, streaming progress over WebSocket. */ export declare const startWebSuiteQueue: (ws: WebSocket, suites: string[], testType: string, progChoices: Partial, conf?: ConfigurationSettings) => Promise; export declare const startWebTest: (ws: WebSocket, progChoices: Partial, conf?: ConfigurationSettings) => Promise; export {};