Member Junction
    Preparing search index...

    Hierarchy (View Summary)

    Index

    Constructors

    Accessors

    Methods

    • Capture ONE frame on demand and push it through the active screencast's frame callback.

      CDP's Page.screencastFrame only fires on a viewport REPAINT, so the very first navigation (and navigations to pages that paint identically) can leave the live view blank until some later change. This grabs the current viewport via a screenshot (encoded to match the screencast format) and emits it as the next sequence-numbered frame, so callers can force an immediate refresh right after starting the stream and after a navigation settles.

      No-op (resolves) when no screencast is running or no page is open — safe to call opportunistically.

      Returns Promise<void>

    • Reset per-session state for the given origin while preserving auth tokens.

      Intended for shared-context adapters: between tests in the same browser context, cached state from the previous test (IndexedDB metadata cache, sessionStorage, service workers, non-auth localStorage entries) can deadlock the next test's app initialization. This method clears that state so the next test starts clean — but preserves Auth0 / OAuth tokens in localStorage so the user stays logged in.

      Default implementation is a no-op. Adapters that own a context across test boundaries (e.g., SharedContextBrowserAdapter) override this.

      Best-effort: never throws — all errors are swallowed.

      Parameters

      • _origin: string

      Returns Promise<void>

    • Set extra HTTP headers for all requests to a specific domain.

      Uses Playwright's page.route() to intercept requests and inject headers for matching domains. The interceptor is set up once on the first call; subsequent calls just update the headers map.

      Headers are additive — calling this multiple times for the same domain merges headers (later calls override conflicting keys).

      Parameters

      • domain: string
      • headers: Record<string, string>

      Returns Promise<void>

    • Set localStorage entries for a specific domain.

      If the page is already on the target domain, entries are set directly via page.evaluate(). If not (e.g. on about:blank before first navigation), entries are deferred via page.addInitScript() so they run before page scripts on the next navigation — this avoids the origin mismatch that would occur from navigating to https://{domain} when the actual target is a different origin (e.g. http://localhost:4201).

      Parameters

      • domain: string
      • entries: Record<string, string>

      Returns Promise<void>

    • Start capturing the audio playing inside the browser tab and invoke onChunk for each encoded slice.

      Mechanism (in-page, headless-safe, no OS audio device, no extension): a capture agent is injected via Playwright page.exposeBinding('__mjAudioChunk', …)

      • page.addInitScript(…). The agent watches the DOM for <video> / <audio> elements (a MutationObserver plus an initial scan), taps the FIRST one that is actively playing with element.captureStream(), and feeds its audio tracks to an in-page MediaRecorder({ mimeType: 'audio/webm;codecs=opus' }) with a ~250ms timeslice. Each dataavailable blob is base64-encoded and sent back through the binding, which lands here and is mapped to an AudioCaptureChunk. The agent restarts the recorder when the active element swaps / plays / pauses.

      Calling start while a capture is already running is a no-op (the existing capture keeps feeding chunks).

      Limitation: only audio routed through a media ELEMENT is captured (covers YouTube and most video/audio sites). Pure Web-Audio-API sound and DRM/EME media (where captureStream() is blocked) are NOT captured — a server-side virtual audio sink is the documented future path for full-fidelity / DRM audio.

      Parameters

      • onChunk: (chunk: AudioCaptureChunk) => void

        Callback invoked with each captured audio chunk.

      Returns Promise<void>