Member Junction
    Preparing search index...
    interface TestHarnessOptions {
        componentLibraries?: any[];
        connect?: string;
        connectType?: "cdp" | "server" | "auto";
        debug?: boolean;
        deviceScaleFactor?: number;
        headless?: boolean;
        locale?: string;
        reuseExistingContext?: boolean;
        screenshotOnError?: boolean;
        screenshotPath?: string;
        timezoneId?: string;
        userAgent?: string;
        viewport?: { height: number; width: number };
    }

    Hierarchy (View Summary)

    Index

    Properties

    componentLibraries?: any[]
    connect?: string

    Attach to an already-running browser instead of launching a new one. The connect method is auto-detected from the endpoint scheme:

    • http(s)://… → Chrome DevTools Protocol (chromium.connectOverCDP), e.g. a real Chrome started with --remote-debugging-port=9222.
    • ws(s)://… → a Playwright browser server (chromium.connect), e.g. one started via chromium.launchServer() (local pool / Docker / remote). Falls back to the MJ_REACT_TEST_HARNESS_CONNECT env var when unset. When attaching, headless is ignored — the external browser already decided.
    connectType?: "cdp" | "server" | "auto"

    Disambiguate the connect method. A raw CDP websocket also uses ws://, which auto-detect would treat as a Playwright server; set 'cdp' to force CDP. Defaults to 'auto' (scheme-based detection).

    debug?: boolean
    deviceScaleFactor?: number
    headless?: boolean
    locale?: string
    reuseExistingContext?: boolean

    When attached, reuse the running browser's existing default context so its cookies / auth / session are shared (the point of attaching to YOUR browser), instead of creating a fresh isolated context. Defaults to false. Falls back to the MJ_REACT_TEST_HARNESS_REUSE_CONTEXT env var (1/true/yes).

    Note: this breaks per-test isolation — parallel harness instances would share one context. Viewport/locale/userAgent options are ignored when reusing a context (they only apply to contexts the harness creates).

    screenshotOnError?: boolean
    screenshotPath?: string
    timezoneId?: string
    userAgent?: string
    viewport?: { height: number; width: number }