diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 0b1ac2afd61..f136eb87152 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -80,6 +80,10 @@ updates: bun: patterns: - "*" + ignore: + # Pinned to the root flake's Chromium (sh/js/playwright.py), so it moves + # with a nixpkgs bump rather than ahead of it. + - dependency-name: "playwright" - package-ecosystem: "uv" directory: "/" diff --git a/.github/workflows/interop.yml b/.github/workflows/interop.yml index 6cd6c34b1d6..0af1e97341d 100644 --- a/.github/workflows/interop.yml +++ b/.github/workflows/interop.yml @@ -52,13 +52,9 @@ jobs: access-key-id: ${{ secrets.MBX_R2_ACCESS_KEY_ID }} secret-access-key: ${{ secrets.MBX_R2_SECRET_ACCESS_KEY }} - # Playwright's Chromium isn't in the nix devShell. Install it plus its apt - # runtime libs (`--with-deps` needs the host package manager) so the - # browser client can launch headless Chromium. interop.sh's own - # `playwright install` then no-ops. - - name: Playwright Chromium + - name: Workspace dependencies id: setup - run: nix develop --command bash -c "bun install --frozen-lockfile && bunx playwright install --with-deps chromium" + run: nix develop --command bun install --frozen-lockfile shell: bash -leo pipefail {0} # Each suite reports independently after setup, while a failed step still fails the job. diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index c27ead98c8a..4b70bc57297 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -90,7 +90,7 @@ jobs: fail-fast: false matrix: # Unset keys default to the ARM runner, the plain dev shell, the Rust - # cache, no perf sampling, no Chromium, and nextest's default profile. + # cache, no perf sampling, and nextest's default profile. include: - name: Binding benchmark recipe: bench-ffi @@ -145,13 +145,11 @@ jobs: uncached: true - name: Browser backend baseline recipe: test wasm-baseline --uniffi - chromium: true artifact: wasm-backend-baseline artifact-path: target/test # Bounded: fails on crashes, missing output, or invalid samples, never on timing. - name: Browser benchmark smoke recipe: bench-browser --smoke - chromium: true artifact: bench-browser artifact-path: target/bench/browser - name: Audit @@ -202,12 +200,6 @@ jobs: if: matrix.perf run: sudo sysctl -w kernel.perf_event_paranoid=-1 - # Playwright's Chromium isn't in the nix devShell; `--with-deps` installs - # its apt runtime libs, and the recipe's own install then no-ops. - - name: Playwright Chromium - if: matrix.chromium - run: nix develop --command bash -c "bun install --frozen-lockfile && bunx playwright install --with-deps chromium" - - name: Run workload id: workload run: nix develop ${{ matrix.shell }} --command just ${{ matrix.recipe }} @@ -383,9 +375,9 @@ jobs: access-key-id: ${{ secrets.MBX_R2_ACCESS_KEY_ID }} secret-access-key: ${{ secrets.MBX_R2_SECRET_ACCESS_KEY }} - name: Install publisher and player engines - run: nix develop --command bash -c "bun install --frozen-lockfile && bunx playwright install --with-deps chromium firefox" + run: nix develop --command env PLAYWRIGHT_BROWSERS_PATH="${{ runner.temp }}/playwright" bash -c "bun install --frozen-lockfile && bunx playwright install --with-deps chromium firefox" - name: Media and negative controls - run: nix develop --command just test media --media-engines firefox + run: nix develop --command env PLAYWRIGHT_BROWSERS_PATH="${{ runner.temp }}/playwright" just test media --media-engines firefox env: MOQ_TEST_RUNS: ${{ runner.temp }}/moq-test-runs # Playwright checks a browser's libraries with the `ldd` on PATH, which in the @@ -428,11 +420,6 @@ jobs: with: access-key-id: ${{ secrets.MBX_R2_ACCESS_KEY_ID }} secret-access-key: ${{ secrets.MBX_R2_SECRET_ACCESS_KEY }} - # Playwright's Chromium isn't in the nix devShell; `--with-deps` installs - # its apt runtime libs, and run.sh's own install then no-ops. - - name: Playwright Chromium - run: nix develop --command bash -c "bun install --frozen-lockfile && bunx playwright install --with-deps chromium" - - name: WebSocket fallback startup benchmark run: nix develop --command just js qmux-bench diff --git a/.github/workflows/video.yml b/.github/workflows/video.yml index 431ba055041..7830b2b5a50 100644 --- a/.github/workflows/video.yml +++ b/.github/workflows/video.yml @@ -36,13 +36,6 @@ jobs: - uses: ./.github/actions/nix - # Playwright's Chromium isn't in the nix devShell. Install it plus its apt - # runtime libs (`--with-deps` needs the host package manager); the recipe's - # own `playwright install` then no-ops. - - name: Playwright Chromium - run: nix develop --command bash -c "bun install --frozen-lockfile && bunx playwright install --with-deps chromium" - shell: bash -leo pipefail {0} - - name: Video run: nix develop --command just test video shell: bash -leo pipefail {0} diff --git a/.github/workflows/wasm.yml b/.github/workflows/wasm.yml index 2e168ecbe0d..9e868cdb720 100644 --- a/.github/workflows/wasm.yml +++ b/.github/workflows/wasm.yml @@ -64,13 +64,6 @@ jobs: access-key-id: ${{ secrets.MBX_R2_ACCESS_KEY_ID }} secret-access-key: ${{ secrets.MBX_R2_SECRET_ACCESS_KEY }} - # Playwright's Chromium isn't in the nix devShell. Install it plus its apt - # runtime libs (`--with-deps` needs the host package manager); run.sh's own - # `playwright install` then no-ops. - - name: Playwright Chromium - run: nix develop --command bash -c "bun install --frozen-lockfile && bunx playwright install --with-deps chromium" - shell: bash -leo pipefail {0} - - name: Browser clock run: nix develop --command just rs wasm-test shell: bash -leo pipefail {0} diff --git a/bench/browser/package.json b/bench/browser/package.json index 17acecafb85..b48d9204666 100644 --- a/bench/browser/package.json +++ b/bench/browser/package.json @@ -14,6 +14,6 @@ "@moq/watch": "workspace:*" }, "devDependencies": { - "playwright": "^1.64.1" + "playwright": "1.64.1" } } diff --git a/bench/browser/run.sh b/bench/browser/run.sh index 64d28ca559e..95e4b894f4e 100755 --- a/bench/browser/run.sh +++ b/bench/browser/run.sh @@ -84,8 +84,7 @@ fi cd "$WORKSPACE" bun install --frozen-lockfile -# BROWSER_BIN runs an identified local browser instead of Playwright's Chromium. -[[ -n "${BROWSER_BIN:-}" ]] || bunx playwright install chromium +# BROWSER_BIN overrides the Chromium provided by the root devShell. cd "$HERE" bun test ./fixture.test.ts ./summary.test.ts diff --git a/bun.lock b/bun.lock index fc40ac452a4..2caa59e83e5 100644 --- a/bun.lock +++ b/bun.lock @@ -31,7 +31,7 @@ "@moq/watch": "workspace:*", }, "devDependencies": { - "playwright": "^1.64.1", + "playwright": "1.64.1", }, }, "demo/boy": { @@ -429,7 +429,7 @@ }, "devDependencies": { "@types/audioworklet": "^0.0.100", - "playwright": "^1.64.1", + "playwright": "1.64.1", "rolldown": "^1.2.13", "vite": "^8.3.4", }, @@ -452,7 +452,7 @@ "@moq/watch": "workspace:*", }, "devDependencies": { - "playwright": "^1.64.1", + "playwright": "1.64.1", "rolldown": "^1.2.13", "vite": "^8.3.4", }, @@ -481,7 +481,7 @@ "devDependencies": { "@types/bun": "^1.4.3", "@typescript/lib-dom": "npm:@types/web@^0.0.358", - "playwright": "^1.64.1", + "playwright": "1.64.1", "typescript": "7.0.2", "vite": "^8.3.4", }, @@ -511,7 +511,7 @@ "devDependencies": { "@types/bun": "^1.4.3", "@typescript/lib-dom": "npm:@types/web@^0.0.358", - "playwright": "^1.64.1", + "playwright": "1.64.1", "typescript": "7.0.2", "vite": "^8.3.4", }, @@ -526,7 +526,7 @@ "devDependencies": { "@ubjs/core": "0.31.0-6", "@ubjs/wasm": "0.31.0-6", - "playwright": "^1.64.1", + "playwright": "1.64.1", }, }, }, diff --git a/flake.nix b/flake.nix index fb8b8587e96..8dad6a53fa0 100644 --- a/flake.nix +++ b/flake.nix @@ -221,6 +221,8 @@ # JSR publishing. We call `deno publish` directly instead of `bunx jsr` # so the release doesn't race on a runtime binary download. deno + # One browser build for local and CI Playwright checks. + playwright-driver.browsers ]; # Python dependencies @@ -631,6 +633,10 @@ # fix`. IN_NIX_SHELL would also pass inside another project's shell. MOQ_DEV_SHELL = "1"; + PLAYWRIGHT_BROWSERS_PATH = "${pkgs.playwright-driver.browsers}"; + PLAYWRIGHT_VERSION = pkgs.playwright-driver.version; + PLAYWRIGHT_SKIP_VALIDATE_HOST_REQUIREMENTS = "true"; + # Where `just obs compile` and `just obs test` look for libobs. Set # on every platform so the plugin type-checks against the pinned OBS # release everywhere, rather than whatever the host happens to have. diff --git a/js/justfile b/js/justfile index 6cab4e0a74f..8783ca01f66 100644 --- a/js/justfile +++ b/js/justfile @@ -60,7 +60,7 @@ bench name: bun install --frozen-lockfile bun net/bench/{{ name }}.ts -# Sweep browser publisher fairness over backlog x viewers; requires installed Chromium. +# Sweep browser publisher fairness over backlog x viewers using the devShell's Chromium. serve-bench: bun install --frozen-lockfile bunx tsc --noEmit --project net/bench/tsconfig.json diff --git a/quest/m1/README.md b/quest/m1/README.md index f8e39fa89a9..41e793d6fad 100644 --- a/quest/m1/README.md +++ b/quest/m1/README.md @@ -124,7 +124,6 @@ lite-07 stream type here. - [Interop audio delivery](/quest/m1/interop-audio.md) - every interop subscriber decodes and checks the publishers' 440 Hz tone, and the Rust publisher sends Opus - [AAC in the native JS fallback](/quest/m1/libav-aac.md) - Node and Bun players decode AAC, and the Rust interop publisher adds an AAC track - [Native audio decode conformance](/quest/m1/audio-decode-conformance.md) - Opus and AAC decode through every moq-audio backend, moq-c, and moq-ffi is checked against known tones and clips, like moq-video's suite -- [Playwright browsers from Nix](/quest/m1/playwright-nix.md) - every Playwright check runs on Nix's Chromium locally and in CI, with npm pinned to match - [Allocation-free single-range subscriber window](/quest/m1/window-alloc.md) - a one-range subscribe resolves its window without a heap allocation, recovering the join cost per-subscriber ranges added - [moq-net internals](/quest/m1/net-internals.md) - no per-group session clones, no transport type parameter in lite and IETF internals, and the `Local` check measured - [Main is no slower than release](/quest/m1/release-perf/README.md) - every benchmark where main is slower than release is fixed or accepted with a reason, checked by a final paired run before the cut diff --git a/quest/m1/playwright-nix.md b/quest/m1/playwright-nix.md deleted file mode 100644 index 2e37fd2feab..00000000000 --- a/quest/m1/playwright-nix.md +++ /dev/null @@ -1,57 +0,0 @@ -# [M] Playwright browsers from Nix - -## Goal - -Every Playwright check runs in the root devShell, locally on NixOS and in CI, -against the Chromium build that Nix provides. No check needs a hand-set -`LD_LIBRARY_PATH` or a `playwright install`, and no contributor doc tells -anyone to run one. - -Inventory on `main` (2026-10-21). Recheck with `git grep -n -i chromium` -outside `quest/` and `test/smoke/`, keeping the hits that install, download, or -say where Chromium comes from (comments included), and with every -`package.json` that depends on `playwright`: - -- Packages: `test/interop/clients/js`, `test/video`, `test/p2p`, `test/wasm`, - `test/audio-quality/clients/js`, `bench/browser`. -- Scripts: `test/interop/interop.sh`, `test/portrait/run.sh` (run in CI as - `just test portrait`), `test/wasm/run.sh`, - `test/audio-quality/{run,record}.sh`, `bench/browser/run.sh`, and the - `test/justfile` recipes. -- Workflows: `interop.yml`, `video.yml`, `wasm.yml`, `nightly.yml`, including - their comments that the devShell lacks Chromium. -- Docs and comments: `test/interop/README.md` (says the devShell lacks - Chromium), `test/wasm/README.md` (says to run - `bunx playwright install chromium`), `rs/justfile`'s browser clock recipe - (says `wasm.yml` installs it), `js/justfile`'s fairness sweep ("requires - installed Chromium"), and `test/video/renderer.browser.ts` (says - `just test video` installs it). - -Out of scope: the Firefox player row, whose `media-firefox` job in -`nightly.yml` keeps installing its engines with `--with-deps`, and -`test/smoke`, which keeps its own flake on purpose. - -## Plan - -Decided 2026-10-20 with the maintainer: - -- **Nix browsers, with npm pinned to match.** Today each package pins npm - `playwright ^1.64`, and the Chromium it downloads cannot load - `libglib-2.0.so.0` on NixOS (found while landing the browser rename check). - The root devShell exports `PLAYWRIGHT_BROWSERS_PATH` from - `playwright-driver.browsers`, `PLAYWRIGHT_VERSION` from - `playwright-driver.version`, and `PLAYWRIGHT_SKIP_VALIDATE_HOST_REQUIREMENTS`, - as `test/smoke/flake.nix` already does; without the last, Playwright's host - check rejects the Nix browser on NixOS. Every - package pins npm `playwright` to exactly that version, even when this - downgrades it (1.64 to nixpkgs' 1.63 today). The alternatives were rejected: - supplying host libraries to a downloaded Chromium (nix-ld or an FHS env) - depends on the host's library compatibility, and building playwright 1.64 - in the repo's overlay is maintenance for a gap nixpkgs closes on its own. -- **CI switches too.** Every workflow, script, and recipe in the inventory - drops its Chromium install, so CI and local runs share one Chromium. -- **The pin is enforced.** A check in `just check` fails when any package's - npm `playwright` differs from `PLAYWRIGHT_VERSION`, like - `test/smoke/freshness.sh`, so a nixpkgs bump cannot silently drift. -- The docs and comments in the inventory say the devShell provides Chromium. - No new user-facing docs: this changes only contributor tooling. diff --git a/rs/justfile b/rs/justfile index 890c2934ceb..673fc90f624 100644 --- a/rs/justfile +++ b/rs/justfile @@ -197,7 +197,7 @@ android *args: wasm *args: cargo clippy --locked -p moq-wasm -p moq-mux -p moq-ffi -p moq-clock --target wasm32-unknown-unknown --lib "$@" -- -D warnings -# Run the browser clock backend on the Playwright Chromium installed by wasm.yml, +# Run the browser clock backend on the root devShell's Playwright Chromium, # with the runtime and with reads alone. wasm-test: CARGO_TARGET_WASM32_UNKNOWN_UNKNOWN_RUNNER="bun {{ justfile_directory() }}/test/wasm/rust.ts" cargo test --locked -p moq-clock --lib --target wasm32-unknown-unknown diff --git a/sh/dispatch-query.test.py b/sh/dispatch-query.test.py index f59b19d54dc..212eb471d57 100644 --- a/sh/dispatch-query.test.py +++ b/sh/dispatch-query.test.py @@ -79,6 +79,11 @@ def test_rust_cache_follows_modules_that_compile_rust(self): (self.repo / path).unlink() self.expect(True, base="--all", rust=True) + def test_nixpkgs_updates_check_browser_pins(self): + # JS selection also builds wasm, which is reflected in the Rust cache query. + self.change("flake.lock") + self.expect(True, rust=True) + def test_empty_diff_keeps_repository_lints(self): self.expect(True) diff --git a/sh/dispatch.sh b/sh/dispatch.sh index 41e24667ece..0b011cd38f3 100755 --- a/sh/dispatch.sh +++ b/sh/dispatch.sh @@ -56,7 +56,8 @@ declare -A scope=( # The JS tests also read Rust's shared JSON vectors; sh/js/workspace.py # fails a check that reads a cross-tree input this pattern misses. # demo/pub is a Worker outside the Bun workspace, listed so Biome lints it. - [js]='^(js/|bench/browser/|doc/|drafts/|demo/(boy|pub|web|carla/web)/|test/|rs/moq-wasm/|rs/.*\.json$|sh/js/|sh/rs/stats-docs\.py$|package\.json$|bun\.lock(b)?$|biome\.jsonc$)' + # Root Nix inputs own the browser version every npm Playwright pin matches. + [js]='^(js/|bench/browser/|doc/|drafts/|demo/(boy|pub|web|carla/web)/|test/|rs/moq-wasm/|rs/.*\.json$|sh/js/|sh/rs/stats-docs\.py$|package\.json$|bun\.lock(b)?$|biome\.jsonc$|flake\.(nix|lock)$)' # Workers with lockfiles outside the Bun workspace. [workers]='^(infra/|demo/pub/|sh/js/workers\.sh$)' [moq_sh]='^infra/moq-sh/' diff --git a/sh/js/README.md b/sh/js/README.md index 9a90eeadc58..12d7ff9b184 100644 --- a/sh/js/README.md +++ b/sh/js/README.md @@ -31,6 +31,12 @@ fallback keeps the whole harness check. Shared dependency validation, environmen common helper tests continue to run. The CI setup query still uses the common module map, without requiring a JS toolchain before setup. +The root devShell supplies Chromium and exports its Playwright version. Checks +require every npm `playwright` dependency outside `test/smoke` to pin that exact +version. A root `flake.nix` or `flake.lock` change selects JS checks too: when +nixpkgs moves Playwright, update the reported manifests and regenerate `bun.lock` +with `bun install` in the new shell. Smoke has its own flake and freshness check. + Run `python3 sh/js/workspace.test.py` for graph and execution regressions. The same suite runs in `just gh test` nightly. To inspect work without executing it, pass a file containing relevant paths, one per line, to diff --git a/sh/js/playwright.py b/sh/js/playwright.py new file mode 100644 index 00000000000..80dec97d238 --- /dev/null +++ b/sh/js/playwright.py @@ -0,0 +1,46 @@ +#!/usr/bin/env python3 +"""Keep every in-tree npm Playwright client on the root Nix browser's version.""" + +import json +import os +from pathlib import Path +import re +import subprocess + + +ROOT = Path(__file__).resolve().parents[2] +DEPENDENCIES = ("dependencies", "devDependencies", "peerDependencies", "optionalDependencies") + + +def check(root, version): + files = subprocess.check_output( + ["git", "ls-files", "--cached", "--others", "--exclude-standard", "--", "package.json", "**/package.json"], + cwd=root, text=True + ).splitlines() + problems = [] + for name in files: + if name.startswith("test/smoke/"): + continue # Smoke deliberately owns a separate flake and freshness check. + path = root / name + if not path.exists(): + continue # A staged or working-tree manifest deletion removes its pin. + package = json.loads(path.read_text()) + for field in DEPENDENCIES: + pin = package.get(field, {}).get("playwright") + if pin is not None and pin != version: + problems.append(f"{name}: {field}.playwright is {pin!r}, expected exact {version!r}") + return problems + + +def main(): + version = os.environ.get("PLAYWRIGHT_VERSION", "") + if not re.fullmatch(r"[0-9]+\.[0-9]+\.[0-9]+", version): + raise SystemExit("PLAYWRIGHT_VERSION is missing or malformed; run inside the root nix develop shell") + problems = check(ROOT, version) + if problems: + raise SystemExit("Playwright must match the root Nix browser:\n" + "\n".join(problems)) + print(f"Playwright pins match the root Nix browser: {version}") + + +if __name__ == "__main__": + main() diff --git a/sh/js/playwright.test.py b/sh/js/playwright.test.py new file mode 100644 index 00000000000..bbf05ad33fe --- /dev/null +++ b/sh/js/playwright.test.py @@ -0,0 +1,56 @@ +#!/usr/bin/env python3 +"""Check all manifests without inspecting installed or smoke-owned dependencies.""" + +import json +from pathlib import Path +import subprocess +import tempfile +import unittest + +from playwright import check + + +class PlaywrightTests(unittest.TestCase): + def setUp(self): + self.temp = tempfile.TemporaryDirectory() + self.addCleanup(self.temp.cleanup) + self.root = Path(self.temp.name) + subprocess.run(["git", "init", "--quiet", str(self.root)], check=True) + (self.root / ".gitignore").write_text("node_modules/\n") + + def package(self, name, **fields): + path = self.root / name / "package.json" + path.parent.mkdir(parents=True, exist_ok=True) + path.write_text(json.dumps(fields)) + + def test_exact_pin_matches(self): + self.package("test/video", devDependencies={"playwright": "1.63.0"}) + self.assertEqual(check(self.root, "1.63.0"), []) + + def test_all_dependency_fields_and_new_packages_are_checked(self): + for field in ["dependencies", "devDependencies", "peerDependencies", "optionalDependencies"]: + with self.subTest(field=field): + self.package("new/package", **{field: {"playwright": "^1.63.0"}}) + problems = check(self.root, "1.63.0") + self.assertEqual(len(problems), 1) + self.assertIn(f"{field}.playwright", problems[0]) + + def test_nix_bump_refuses_an_old_exact_pin(self): + self.package("test/video", devDependencies={"playwright": "1.63.0"}) + self.assertEqual(len(check(self.root, "1.64.0")), 1) + + def test_deleted_manifest_does_not_leave_a_pin(self): + self.package("test/removed", devDependencies={"playwright": "1.1.0"}) + subprocess.run(["git", "add", "test/removed/package.json"], cwd=self.root, check=True) + (self.root / "test/removed/package.json").unlink() + self.assertEqual(check(self.root, "1.63.0"), []) + + def test_smoke_and_installed_dependencies_are_independent(self): + self.package("test/smoke/clients/js", devDependencies={"playwright": "1.1.0"}) + self.package("node_modules/fixture", dependencies={"playwright": "1.1.0"}) + self.package("test/video", devDependencies={"playwright": "1.63.0"}) + self.assertEqual(check(self.root, "1.63.0"), []) + + +if __name__ == "__main__": + unittest.main() diff --git a/sh/js/workspace.py b/sh/js/workspace.py index 19cf4f73f18..70115f5c5a4 100644 --- a/sh/js/workspace.py +++ b/sh/js/workspace.py @@ -142,6 +142,7 @@ def scripts(verb): command("bun", "install", "--frozen-lockfile") if action == "test": + command("python3", "sh/js/playwright.test.py") command("bun", "test", "js/common/declarations.test.ts", "js/common/deps.test.ts", "js/common/docs.test.ts", "js/common/worklet.test.ts") scripts("test") @@ -163,6 +164,7 @@ def scripts(verb): r"import\.meta\.env", "js"]) if result.returncode != 1: raise RuntimeError("import.meta.env scan found a reference or failed") + command("python3", "sh/js/playwright.py") command("bun", "js/common/deps.ts") if plan["wasm"]: command("just", "js", "wasm", "dev") diff --git a/test/audio-quality/clients/js/package.json b/test/audio-quality/clients/js/package.json index 4c14628e261..c4f3c633a7e 100644 --- a/test/audio-quality/clients/js/package.json +++ b/test/audio-quality/clients/js/package.json @@ -16,7 +16,7 @@ }, "devDependencies": { "@types/audioworklet": "^0.0.100", - "playwright": "^1.64.1", + "playwright": "1.64.1", "rolldown": "^1.2.13", "vite": "^8.3.4" } diff --git a/test/audio-quality/record.sh b/test/audio-quality/record.sh index 22114369693..687856046f1 100755 --- a/test/audio-quality/record.sh +++ b/test/audio-quality/record.sh @@ -53,7 +53,6 @@ echo "building the pages..." ( cd "$CLIENT" bun install --frozen-lockfile - bunx playwright install chromium bunx vite build --outDir "$HARNESS_RUN/page" --emptyOutDir ) diff --git a/test/audio-quality/run.sh b/test/audio-quality/run.sh index e72442f5f45..6b7ab359878 100755 --- a/test/audio-quality/run.sh +++ b/test/audio-quality/run.sh @@ -273,7 +273,6 @@ if [[ ${#ROWS[@]} -gt 0 ]]; then echo "building the page..." ( cd "$CLIENT" - bunx playwright install chromium bunx vite build --outDir "$HARNESS_RUN/page" --emptyOutDir ) fi diff --git a/test/interop/README.md b/test/interop/README.md index f84960facdb..37165dcac3f 100644 --- a/test/interop/README.md +++ b/test/interop/README.md @@ -130,9 +130,8 @@ delivers them as minted: a publisher is granted its exact broadcast, a subscribe ## Running locally You need the workspace toolchain on `PATH` (cargo, ffmpeg, bun, uv, go, -uniffi-bindgen-go, cmake, uniffi-bindgen-cpp, a C/C++ compiler). `nix develop` provides all of it except -Playwright's Chromium, which -`interop.sh` fetches on first run (`bunx playwright install chromium`). +uniffi-bindgen-go, cmake, uniffi-bindgen-cpp, a C/C++ compiler). `nix develop` provides +all of it, including the Chromium build matching the workspace's exact npm Playwright pins. ```bash # Default: rust publishes, rust subscribes (a fast sanity check). @@ -233,9 +232,9 @@ The matrix asks "did bytes arrive and did a pixel light up". That passes on a frozen picture, on silence, and on audio a second out of step, so `just test media` measures the media itself, browser to browser. Use `just test media --media-engines chromium,firefox,webkit` to run each pinned -Playwright player against a Chromium publisher. The harness installs the requested -engines and runs the same lifecycle cases, content tolerances, and five negative -controls per engine. A missing runtime or required API fails that engine by name. +Playwright player against a Chromium publisher. Chromium comes from the root devShell; +the dedicated Firefox CI job provides its other engines. The harness runs the same +lifecycle cases, content tolerances, and five negative controls per engine. A missing runtime or required API fails that engine by name. Firefox and WebKit players explicitly use WebSocket; Chromium keeps normal transport selection. This does not measure Firefox's QUIC path. diff --git a/test/interop/clients/js/package.json b/test/interop/clients/js/package.json index 3638c082a70..2529e6b67b3 100644 --- a/test/interop/clients/js/package.json +++ b/test/interop/clients/js/package.json @@ -15,7 +15,7 @@ "@moq/watch": "workspace:*" }, "devDependencies": { - "playwright": "^1.64.1", + "playwright": "1.64.1", "rolldown": "^1.2.13", "vite": "^8.3.4" } diff --git a/test/interop/interop.sh b/test/interop/interop.sh index 99d3ece29ef..5fd736a43b4 100755 --- a/test/interop/interop.sh +++ b/test/interop/interop.sh @@ -431,11 +431,7 @@ prepare_js() { return fi if needs js; then - # Nix provides Chromium via PLAYWRIGHT_BROWSERS_PATH; otherwise fetch it. - if [[ -z "${PLAYWRIGHT_BROWSERS_PATH:-}" ]] && ! (cd "$CLIENTS/js" && bunx playwright install chromium "${MEDIA_ENGINE_LIST[@]}") >"$HARNESS_RUN/js-chromium.log" 2>&1; then - mark_broken js "requested Playwright engine install failed" - sed 's/^/ /' "$HARNESS_RUN/js-chromium.log" >&2 || true - elif ! (cd "$CLIENTS/js" && bun run check) >"$HARNESS_RUN/js-check.log" 2>&1; then + if ! (cd "$CLIENTS/js" && bun run check) >"$HARNESS_RUN/js-check.log" 2>&1; then mark_broken js "type check failed" sed 's/^/ /' "$HARNESS_RUN/js-check.log" >&2 || true # Into the run directory, where harness.ts serves it from: vite empties its output diff --git a/test/justfile b/test/justfile index 4c3cec9d6e9..57a88b1e447 100644 --- a/test/justfile +++ b/test/justfile @@ -21,15 +21,14 @@ default: @just --justfile {{ quote(justfile()) }} --list test # Port isolation across private temp roots, plus Chromium checks of the watch and publish controls. -# The browser check is not `*.test.ts`: plain `bun test` runs lack Playwright Chromium, -# which this recipe installs, as the interop and wasm harnesses do. +# The root devShell provides Chromium for the browser checks, which stay separate +# from plain `bun test` so unit tests do not launch a browser. harness: ./lib/harness.test.sh ./interop/relay-log.test.sh python3 interop/report.test.py cd .. && bun test test/interop/compat/resolve.test.ts test/interop/compat/claims.test.ts cd .. && bun install --frozen-lockfile - cd interop/clients/js && bunx playwright install chromium cd interop/clients/js && bun test ./harness.browser.ts ./signals-dom.browser.ts ./publish-ui.browser.ts ./capture-channel-count.browser.ts ./open-gop.browser.ts ./src/contract.test.ts ./src/resume.test.ts # Cross-language media interop test, built from this checkout. Stands up a @@ -213,8 +212,8 @@ wasm *args: # The @moq/video renderer in headless Chromium: WebGPU, a lost device, and the Canvas2D fallback. video: cd .. && bun install --frozen-lockfile - cd video && bunx playwright install chromium - cd video && bun test ./renderer.browser.ts + # A desktop display makes software Vulkan request unsupported window surfaces. + cd video && env -u DISPLAY -u WAYLAND_DISPLAY bun test ./renderer.browser.ts # Optional publisher retention across Rust/JS sessions through a Rust relay. max-age: @@ -241,7 +240,6 @@ qmux: # Complete MoQ SETUP and transfer a frame over a real browser data-channel pair. p2p: cd .. && bun install --frozen-lockfile - cd p2p && bunx playwright install chromium cd p2p && bun test ./transport.browser.ts # Retain complete backend assets, parity, and raw alternating browser samples. diff --git a/test/p2p/package.json b/test/p2p/package.json index c8e8322d045..826ba38b6e0 100644 --- a/test/p2p/package.json +++ b/test/p2p/package.json @@ -12,7 +12,7 @@ "devDependencies": { "@types/bun": "^1.4.3", "@typescript/lib-dom": "npm:@types/web@^0.0.358", - "playwright": "^1.64.1", + "playwright": "1.64.1", "typescript": "7.0.2", "vite": "^8.3.4" } diff --git a/test/portrait/run.sh b/test/portrait/run.sh index 46751493771..d47b719f4e4 100755 --- a/test/portrait/run.sh +++ b/test/portrait/run.sh @@ -9,7 +9,7 @@ harness_begin portrait 'just test portrait' cd "$WORKSPACE" cargo build --locked -p moq-relay -p moq-cli --features moq-cli/transcode,moq-cli/openh264 bun install --frozen-lockfile -(cd test/interop/clients/js && bunx vite build --outDir "$HARNESS_RUN/js-dist" && bunx playwright install chromium) +(cd test/interop/clients/js && bunx vite build --outDir "$HARNESS_RUN/js-dist") harness_port relay URL="http://127.0.0.1:$HARNESS_PORT" sed "s/4443/$HARNESS_PORT/g" "$DIR/relay.toml" >"$HARNESS_RUN/relay.toml" diff --git a/test/video/package.json b/test/video/package.json index dbbbabbe138..a2a40cdbf17 100644 --- a/test/video/package.json +++ b/test/video/package.json @@ -17,7 +17,7 @@ "devDependencies": { "@types/bun": "^1.4.3", "@typescript/lib-dom": "npm:@types/web@^0.0.358", - "playwright": "^1.64.1", + "playwright": "1.64.1", "typescript": "7.0.2", "vite": "^8.3.4" } diff --git a/test/video/renderer.browser.ts b/test/video/renderer.browser.ts index f49d72b7f6e..728f1fa58e7 100644 --- a/test/video/renderer.browser.ts +++ b/test/video/renderer.browser.ts @@ -4,7 +4,7 @@ * paints through Canvas2D. Once against the renderer directly and once through ``, * which swaps its own canvas. * - * Not `*.test.ts`: plain `bun test` runs lack Playwright Chromium, which `just test video` installs. + * Not `*.test.ts`: `just test video` launches the Chromium provided by the root devShell. * * @module */ diff --git a/test/wasm/README.md b/test/wasm/README.md index 28214e3d1fb..7e5baf47606 100644 --- a/test/wasm/README.md +++ b/test/wasm/README.md @@ -34,11 +34,10 @@ failing page, and CI uploads it; a passing run deletes its own. See ## Rust clock `moq-clock`'s browser backend also runs here, using `wasm-bindgen-test` and the -same Playwright Chromium installation: +same Chromium supplied by the root devShell: ```bash bun install --frozen-lockfile -bunx playwright install chromium just rs wasm-test ``` diff --git a/test/wasm/package.json b/test/wasm/package.json index 7fbfe1f432f..124d8ef6178 100644 --- a/test/wasm/package.json +++ b/test/wasm/package.json @@ -10,6 +10,6 @@ "devDependencies": { "@ubjs/core": "0.31.0-6", "@ubjs/wasm": "0.31.0-6", - "playwright": "^1.64.1" + "playwright": "1.64.1" } } diff --git a/test/wasm/run.sh b/test/wasm/run.sh index 4d2037392a5..18f4582d0ea 100755 --- a/test/wasm/run.sh +++ b/test/wasm/run.sh @@ -120,9 +120,7 @@ TARGET_BASE="${CARGO_TARGET_DIR:-$WORKSPACE/target}" cd "$WASM_DIR" bun install --frozen-lockfile -# Playwright ships its own Chromium; PLAYWRIGHT_BROWSERS_PATH means CI installed -# it already, in which case this is a no-op anyway. -bunx playwright install chromium +# The root devShell provides the matching Playwright Chromium. # Type-check against wasm-bindgen's generated .d.ts, as the shared harness check does. # wasm-bindgen resolves a type in a signature by its Rust identifier alone, so a