Luxar Viewer API Documentation - v2026.9.22
    Preparing search index...

    Function getConsoleMessages

    • Get browser console messages (CRITICAL for E2E validation)

      Retrieves all console messages from the browser's console interceptor. This is ESSENTIAL for detecting errors in data loading, decoding, and rendering.

      Deadline-bounded (#1651). WHO CALLS IT: the specs that call it directly (all-examples-smoke-test, test-fixtures-rendering, worker-wasm-integration), plus assertNoConsoleErrors, assertConsoleContains, assertConsoleDoesNotContain and assertNoShaderErrors and the specs that call those — some of them from their own test.afterEach. The shared fixture's teardown does NOT (#1760): it gates on page.on('console') + page.on('pageerror'), which covers the ERROR verdict from a strictly wider source, so the probe there was a narrower second opinion charging up to 45 s to each of the 59 of 67 specs that import test from ./fixtures. Before the bound, an unanswered probe burned the ENTIRE remaining test budget and was reported as Tearing down "page" exceeded the test timeout pending on the evaluate below. Failing in timeout ms with a message that says what went unanswered is strictly more informative.

      WHAT THE DEFAULT COSTS, honestly: a deadline here cannot distinguish a page that will never answer from one that would have answered late, so ANY value can cut short a stall that would have ended, turning a test that used to pass into one that fails. That is a real cost rather than a hypothetical — the stalls measured for #1651 lasted tens of seconds (a trivial page.evaluate unanswered for 5 s twelve times running, ~78 s in all, while the page went on rendering), and #1760 reproduced 95 s without one serviced round trip on a 2-CPU browser while Playwright's own page.on('console') stream kept delivering — the two channels starve independently. The bound is worth paying anyway because the alternative failure is opaque, and because every remaining caller asked for the in-page buffer specifically — its warnings / logs buckets have no Playwright-side gate at all — so learning the buffer could not be read beats proceeding on empty ones. It is a trade, not a free win.

      WHY 45 s: Playwright gives the After Hooks phase a FRESH timeout slot (afterHooksSlot = { timeout: calculateMaxTimeout(project.timeout, testInfo.timeout) } in its worker), so an afterEach gate always has the full per-test timeout available — the config's 60 s, or more in a file that raises its own — no matter how much the test body already used. 45 s lands inside that slot — which is what makes the failure attributable to this probe by name instead of arriving as Tearing down "page" exceeded the test timeout — while still leaving a wide margin for a page that recovers late. It also bounds the mid-test call sites, where the probe shares the body's budget rather than getting a fresh slot. The work itself is a walk over at most DEFAULT_MAX_BUFFER_SIZE buffered messages (src/utils/console-interceptor.ts), so a live page answers in milliseconds and never approaches this.

      Parameters

      • page: Page

        Playwright page

      • timeout: number = 45000

        Deadline for the in-page probe, in ms

      Returns Promise<{ errors: string[]; warnings: string[]; logs: string[]; all: string[] }>

      Object with errors, warnings, and info messages

      If the page does not answer the probe within timeout ms