Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
refactor: share one test-Chrome and client-bundler resolver across browser suites (#12293)
[._.]/ Adam Eivy0d2f58a03a10
diff --git a/scripts/browser-fidelity.js b/scripts/browser-fidelity.jsindex 7638825bfd..116d6ac3d4 100644--- a/scripts/browser-fidelity.js+++ b/scripts/browser-fidelity.js@@ -1,9 +1,8 @@#!/usr/bin/env nodeimport { execFileSync } from 'node:child_process';-import { existsSync, lstatSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, rmSync, writeFileSync } from 'node:fs';+import { lstatSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, rmSync, writeFileSync } from 'node:fs';import { dirname, join, resolve } from 'node:path';-import { createRequire } from 'node:module';import { fileURLToPath } from 'node:url';import { tmpdir, platform, arch } from 'node:os';import { runNpm, toRunnerPath } from './run-ci-tests.js';@@ -40,18 +39,14 @@ export function fidelityChildEnv(env, diagnostics) {}async function fidelityToolchain(env) {- const require = createRequire(new URL('../server/package.json', import.meta.url));- const { chromium } = require('playwright-core');const { findFfmpeg } = await import('../server/lib/ffmpeg.js');const { _testChromeCaptureArgs } = await import('../server/services/htmlComposition/testBrowserCleanup.js');- const chromePath = [env.CHROME_PATH, chromium.executablePath(),- '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome', '/usr/bin/google-chrome',- '/usr/bin/chromium', '/usr/bin/chromium-browser'].find(path => path && existsSync(path));+ const chromePath = resolveTestChrome(env);const ffmpegPath = await findFfmpeg();if (!chromePath || !ffmpegPath) throw Error('Fidelity Chrome/FFmpeg toolchain unavailable.');// Surface the structured probe cause here: the suite's own prerequisite gate// reports through vitest output, which this command's refusal never relays.- const { probeChromeH264, describeH264Probe } = await import('../server/lib/browserSuiteGate.js');+ const { probeChromeH264, describeH264Probe, resolveTestChrome } = await import('../server/lib/browserSuiteGate.js');const probe = await probeChromeH264(chromePath);if (!probe.ok) throw Error(describeH264Probe(probe));const version = (path, args) => {diff --git a/scripts/browser-suite-registry.test.js b/scripts/browser-suite-registry.test.jsindex d60aab877c..c7f4483d5a 100644--- a/scripts/browser-suite-registry.test.js+++ b/scripts/browser-suite-registry.test.js@@ -11,7 +11,7 @@ const root = fileURLToPath(new URL('../', import.meta.url));// Scans the tracked tree, so it is registered in ALWAYS_RUN_TESTS (#10312).describe('cross-workspace browser suite registry', () => {it('lists exactly the suites that guard canRun with the browser suite gate', () => {- const gated = execFileSync('git', ['grep', '-l', 'browserSuiteGate', '--', 'server/**/*.browser.test.js'], { cwd: root, encoding: 'utf8' })+ const gated = execFileSync('git', ['grep', '-l', 'browserSuiteCanRun(', '--', 'server/**/*.browser.test.js'], { cwd: root, encoding: 'utf8' }).split('\n').filter(Boolean).sort();expect(gated).toEqual([...BROWSER_SUITES].sort());});diff --git a/scripts/lib/pregateResources.js b/scripts/lib/pregateResources.jsindex 29b6ea9955..7ee7d8d3a5 100644--- a/scripts/lib/pregateResources.js+++ b/scripts/lib/pregateResources.js@@ -9,13 +9,12 @@* never substitutes for the suite. A failed probe leaves the suite reported* as not covered, with the remedy, rather than a green stage that ran nothing.*/-import { existsSync } from 'node:fs';import { createRequire } from 'node:module';import { join } from 'node:path';import databaseSettings from './databaseSettings.cjs';import { parseEnvFile } from './envFile.js';import { findFfmpeg } from '../../server/lib/ffmpeg.js';-import { browserSuiteBlockReason, chromeWithH264 } from '../../server/lib/browserSuiteGate.js';+import { browserSuiteBlockReason, chromeWithH264, resolveClientBundler, resolveTestChrome } from '../../server/lib/browserSuiteGate.js';/** The only database the DB stage may target; `server/lib/db.js` refuses the rest. */export const TEST_DATABASE = 'portos_test';@@ -27,13 +26,6 @@ const ROUTING_ENV = ['PGHOSTADDR', 'PGSERVICE', 'PGSERVICEFILE', 'PGOPTIONS'];/** The suite whose guard also needs a Chrome that decodes H.264. */const H264_SUITE = 'server/services/musicVideo/documentRender.browser.test.js';-// The same candidate order every registered browser suite uses to find Chrome.-const CHROME_CANDIDATES = [- '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome',- '/usr/bin/google-chrome', '/usr/bin/chromium', '/usr/bin/chromium-browser',-];-const CLIENT_BUNDLER_PACKAGES = ['vite', '@vitejs/plugin-react', '@tailwindcss/postcss'];-/*** Environment for the DB stages, pinned to `portos_test`.*@@ -109,21 +101,8 @@ export async function probeTestDatabase(stageEnv, { repoRoot }) {* decode — and return the guards' own wording when something is missing.*/export async function probeBrowserPrerequisites(files, { repoRoot, env = process.env }) {- const requireServer = createRequire(join(repoRoot, 'server', 'package.json'));- let bundledChrome;- try {- bundledChrome = requireServer('playwright-core').chromium.executablePath();- } catch (error) {- if (error.code !== 'MODULE_NOT_FOUND') throw error;- }- const chrome = [env.CHROME_PATH, bundledChrome, ...CHROME_CANDIDATES].find((path) => path && existsSync(path));- let bundler;- try {- const requireClient = createRequire(join(repoRoot, 'client', 'package.json'));- bundler = CLIENT_BUNDLER_PACKAGES.map((name) => requireClient.resolve(name));- } catch (error) {- if (error.code !== 'MODULE_NOT_FOUND') throw error;- }+ const chrome = resolveTestChrome(env) ?? undefined;+ const bundler = resolveClientBundler(repoRoot);const prerequisites = {Chrome: chrome,ffmpeg: await findFfmpeg(),diff --git a/server/lib/README.md b/server/lib/README.mdindex f9905aafa3..d3fa347130 100644--- a/server/lib/README.md+++ b/server/lib/README.md@@ -777,7 +777,7 @@ The barrel `server/lib/index.js` is a machine-checkable enumeration of every pub| Module | Purpose ||---|---|-| `browserSuiteGate.js` | `probeChromeH264(path)` runs the H.264 probe as an owned, deadline-bound child (own process group, SIGTERM→SIGKILL ladder awaiting `close`) and resolves `{ ok }` or `{ ok:false, cause }` — `missing-executable`, `codec-unavailable`, `probe-timeout`, `teardown-failed` (answered, then exited nonzero: never trusted, never a missing codec), `no-answer`; `describeH264Probe` is its path/PID-free one-liner; `chromeWithH264(path)` (async) returns the path only when that Chrome decodes H.264, null when the executable or codec is genuinely absent, and `{ probeFailure }` when the probe itself failed (reported by `browserSuiteCanRun` as a lifecycle failure, not a missing prerequisite); `browserSuiteCanRun(label, prerequisites)` is the `canRun` guard for the cross-workspace `*.browser.test.js` suites (Chrome + ffmpeg + the client bundler). Pass `{ name: discoveredValue }`; a falsy value is missing. Returns `false` with a visible skip log locally, but throws naming the missing prerequisites when `PORTOS_REQUIRE_BROWSER_SUITES` is set; `browserSuiteBlockReason(prerequisites)` is that verdict alone (the same wording, or `null`) for a caller that only reports, such as `scripts/pregate.js` — the flag the CI `database` job sets for the browser suites the planner selected (#10312). `resolveTestChrome(env)` is the one Chrome candidate list (`CHROME_PATH`, Playwright's bundled Chromium, then the macOS app and the Linux package paths) shared by the suites, the pregate probe and the test memo's tool keying (#12293). |+| `browserSuiteGate.js` | `probeChromeH264(path)` runs the H.264 probe as an owned, deadline-bound child (own process group, SIGTERM→SIGKILL ladder awaiting `close`) and resolves `{ ok }` or `{ ok:false, cause }` — `missing-executable`, `codec-unavailable`, `probe-timeout`, `teardown-failed` (answered, then exited nonzero: never trusted, never a missing codec), `no-answer`; `describeH264Probe` is its path/PID-free one-liner; `chromeWithH264(path)` (async) returns the path only when that Chrome decodes H.264, null when the executable or codec is genuinely absent, and `{ probeFailure }` when the probe itself failed (reported by `browserSuiteCanRun` as a lifecycle failure, not a missing prerequisite); `browserSuiteCanRun(label, prerequisites)` is the `canRun` guard for the cross-workspace `*.browser.test.js` suites (Chrome + ffmpeg + the client bundler). Pass `{ name: discoveredValue }`; a falsy value is missing. Returns `false` with a visible skip log locally, but throws naming the missing prerequisites when `PORTOS_REQUIRE_BROWSER_SUITES` is set; `browserSuiteBlockReason(prerequisites)` is that verdict alone (the same wording, or `null`) for a caller that only reports, such as `scripts/pregate.js` — the flag the CI `database` job sets for the browser suites the planner selected (#10312). `resolveTestChrome(env)` is the one Chrome candidate list (`CHROME_PATH`, Playwright's bundled Chromium, then the macOS app and the Linux package paths) shared by the suites, the pregate probe and the test memo's tool keying, and `resolveClientBundler(repoRoot)` the one client bundler probe (resolved Vite, React plugin and Tailwind PostCSS paths, or `undefined` when any is missing; non-`MODULE_NOT_FOUND` errors throw) (#12293). || `dbTestGate.js` | `requireDbOrSkip(label, dbReady, reason)` keeps a missing local test database as a visible skipped suite, but throws when `PORTOS_REQUIRE_DB` is set so CI cannot pass after DB-backed suites disappear. || `gitTestRepo.js` | Shared real-git sandbox for integration tests (#4394): one initialized template (working tree + bare origin) per worker, then `fs.cp` into a fresh temp dir. `makeGitSandbox({ origin })`, `attachBareOrigin(scratch, repo)`, `materializeGitRepo(dest)`, `destroyGitSandbox`, plus `SKIP_HEAVY_INTEGRATION` (`VITEST_FAST=1`). `resetGitSandbox({ scratch, repo, initialHead })` / `resetGitWorktreeSandbox(repo, initialHead)` restore a sandbox in place (branches, worktrees, remote) so a `describe` can build one sandbox in `beforeAll` and reset between tests instead of paying the fs.cp/rm cycle per test (#5902). Every entry point runs `assertTempPath` first, so a path outside `os.tmpdir()` throws instead of `git init`-ing or `rm -rf`-ing a real checkout (#4554). Fixture-local maintenance/GC detachment is disabled so awaited Git operations retain their writers through teardown. Still real git — just not rebuilt from `init`+`commit`+`push` in every `beforeEach`. || `mirrorParity.js` | Source-extraction and comparison primitives for declaration-level contract tests: the vendored `aiToolkit/` copy of `TOOL_USE_RE` (`localModelHeuristics.mirror.test.js`), and the bootstrap sequence's body assertions (`bootstrap*.test.js`). A pure module the browser needs is imported by the client rather than mirrored, so no client↔server copy test should need these: `stripCommentsAndNormalize` (so per-side commentary may diverge but logic may not), `extractDeclaration(src, name)` (balanced `{}`/`()`/`[]` walk over `function` / `async function` / `const`), and `compareDeclaration(serverSrc, clientSrc, name)`. Use these instead of hand-rolling a brace-walker per mirror. Pure — no `vitest` import — so callers own the assertions. |diff --git a/server/lib/browserSuiteGate.js b/server/lib/browserSuiteGate.jsindex 877e0a64b7..48eac3f2c7 100644--- a/server/lib/browserSuiteGate.js+++ b/server/lib/browserSuiteGate.js@@ -30,6 +30,24 @@ export function resolveTestChrome(env = process.env, { exists = existsSync, bundreturn [env.CHROME_PATH, bundled(), ...TEST_CHROME_CANDIDATES].find((path) => path && exists(path)) ?? null;}+const CLIENT_BUNDLER_PACKAGES = Object.freeze(['vite', '@vitejs/plugin-react', '@tailwindcss/postcss']);++/**+ * The resolved paths of the client workspace's bundler packages (Vite, its+ * React plugin, Tailwind's PostCSS plugin), or undefined when any is missing —+ * the shape a `browserSuiteCanRun` prerequisite map treats as absent. Only+ * MODULE_NOT_FOUND counts as missing; any other resolution error throws.+ */+export function resolveClientBundler(repoRoot) {+ try {+ const requireClient = createRequire(join(repoRoot, 'client', 'package.json'));+ return CLIENT_BUNDLER_PACKAGES.map((name) => requireClient.resolve(name));+ } catch (error) {+ if (error.code !== 'MODULE_NOT_FOUND') throw error;+ return undefined;+ }+}+/*** Keep cross-workspace browser suites as visible skips on machines without* Chrome, ffmpeg or the client workspace, while letting the one CI job thatdiff --git a/server/lib/browserSuiteGate.test.js b/server/lib/browserSuiteGate.test.jsindex 191075f935..0b575976c5 100644--- a/server/lib/browserSuiteGate.test.js+++ b/server/lib/browserSuiteGate.test.js@@ -2,7 +2,13 @@ import { afterEach, describe, expect, it, vi } from 'vitest';import { chmodSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs';import { tmpdir } from 'node:os';import { join } from 'node:path';-import { browserSuiteCanRun, chromeWithH264, describeH264Probe, probeChromeH264, resolveTestChrome } from './browserSuiteGate.js';+import { browserSuiteCanRun, chromeWithH264, describeH264Probe, probeChromeH264, resolveClientBundler, resolveTestChrome } from './browserSuiteGate.js';++describe('resolveClientBundler', () => {+ it('returns undefined when the client workspace is absent', () => {+ expect(resolveClientBundler('/nonexistent/example-root')).toBeUndefined();+ });+});describe('resolveTestChrome', () => {it('prefers CHROME_PATH, then the bundled Chromium, then the first installed package path, and reports none', () => {diff --git a/server/lib/filmLook.browser.test.js b/server/lib/filmLook.browser.test.jsindex 51f0c8c13d..fe3fb68654 100644--- a/server/lib/filmLook.browser.test.js+++ b/server/lib/filmLook.browser.test.js@@ -1,11 +1,10 @@import { afterAll, beforeAll, describe, expect, it, vi } from 'vitest';-import { existsSync } from 'node:fs';import { mkdir, writeFile } from 'node:fs/promises';import { join } from 'node:path';import { chromium } from 'playwright-core';import { startOwnedBrowserFixture } from '../test/browserFixture.js';import sharp from 'sharp';-import { browserSuiteCanRun } from './browserSuiteGate.js';+import { browserSuiteCanRun, resolveTestChrome } from './browserSuiteGate.js';import { filmLookFilterMarkup, filmLookPreset, filmLookRuntimeSource } from './filmLook.js';import { cleanupTempDataRoots, lazyTempDataRoot, makePathsProxy } from './mockPathsDataRoot.js';@@ -15,9 +14,7 @@ vi.mock('./paths.js', async (original) => makePathsProxy(await original(), {vi.mock('../services/browserService.js', () => ({ loadConfig: async () => ({ chromePath: chrome }), cdpRequest: vi.fn() }));afterAll(() => cleanupTempDataRoots());-const chrome = [process.env.CHROME_PATH, chromium.executablePath(),- '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome', '/usr/bin/google-chrome', '/usr/bin/chromium',-].find((path) => path && existsSync(path));+const chrome = resolveTestChrome();const canRun = browserSuiteCanRun('film look runtime browser', { Chrome: chrome });const width = 390;const height = 219;diff --git a/server/lib/filmLookGpu.browser.test.js b/server/lib/filmLookGpu.browser.test.jsindex 54381eae71..ef0a07873f 100644--- a/server/lib/filmLookGpu.browser.test.js+++ b/server/lib/filmLookGpu.browser.test.js@@ -7,20 +7,18 @@*/import { afterAll, beforeAll, describe, expect, it } from 'vitest';import { execFileSync } from 'node:child_process';-import { existsSync, mkdtempSync, readFileSync, rmSync } from 'node:fs';+import { mkdtempSync, readFileSync, rmSync } from 'node:fs';import { tmpdir } from 'node:os';import { join } from 'node:path';import { chromium } from 'playwright-core';import sharp from 'sharp';import { startOwnedBrowserFixture } from '../test/browserFixture.js';import { _withTestPreviewLoadDiagnostics } from '../services/musicVideo/testPreviewLoadDiagnostics.js';-import { browserSuiteCanRun } from './browserSuiteGate.js';+import { browserSuiteCanRun, resolveTestChrome } from './browserSuiteGate.js';import { FILM_LOOK_CONTROLS, FILM_LOOK_PRESETS, filmLookFilterMarkup, filmLookPreset, normalizeFilmLook } from './filmLook.js';import { filmLookGpuRuntimeSource } from './filmLookGpu.js';-const chrome = [process.env.CHROME_PATH, chromium.executablePath(),- '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome', '/usr/bin/google-chrome', '/usr/bin/chromium',-].find((path) => path && existsSync(path));+const chrome = resolveTestChrome();const canRun = browserSuiteCanRun('film look GPU browser', { Chrome: chrome });const width = 320;const height = 180;diff --git a/server/lib/musicVideoTitleCard.browser.test.js b/server/lib/musicVideoTitleCard.browser.test.jsindex db1a23b88b..8e0db7fd39 100644--- a/server/lib/musicVideoTitleCard.browser.test.js+++ b/server/lib/musicVideoTitleCard.browser.test.js@@ -1,9 +1,9 @@import { afterAll, beforeAll, describe, expect, it } from 'vitest';-import { existsSync, readFileSync } from 'node:fs';+import { readFileSync } from 'node:fs';import { chromium } from 'playwright-core';import { startOwnedBrowserFixture } from '../test/browserFixture.js';import sharp from 'sharp';-import { browserSuiteCanRun } from './browserSuiteGate.js';+import { browserSuiteCanRun, resolveTestChrome } from './browserSuiteGate.js';import { filmLookRuntimeSource } from './filmLook.js';import { TITLE_CARD_FONT_FACES, titleCardRuntimeSource } from './musicVideoTitleCard.js';@@ -13,9 +13,7 @@ import { TITLE_CARD_FONT_FACES, titleCardRuntimeSource } from './musicVideoTitle* the card over the document's own frame inside its window and nothing outside* it, chaining the film look's seek wrapper rather than replacing it.*/-const chrome = [process.env.CHROME_PATH, chromium.executablePath(),- '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome', '/usr/bin/google-chrome', '/usr/bin/chromium',-].find((p) => p && existsSync(p));+const chrome = resolveTestChrome();const canRun = browserSuiteCanRun('title card browser', { Chrome: chrome });const W = 640;diff --git a/server/routes/musicVideoProductionReview.browser.test.js b/server/routes/musicVideoProductionReview.browser.test.jsindex 53198dfcc5..912826963c 100644--- a/server/routes/musicVideoProductionReview.browser.test.js+++ b/server/routes/musicVideoProductionReview.browser.test.js@@ -1,15 +1,13 @@/** Actual review controls + router/file store + Chrome/ffmpeg proof. No provider or live data. */import { afterAll, describe, expect, it, vi } from 'vitest';import express from 'express';-import { existsSync } from 'node:fs';import { mkdir, writeFile, copyFile } from 'node:fs/promises';import { join, resolve } from 'node:path';import { execFileSync, spawn } from 'node:child_process';import { chromium } from 'playwright-core';-import { createRequire } from 'node:module';import { makePathsProxy, lazyTempDataRoot, cleanupTempDataRoots } from '../lib/mockPathsDataRoot.js';import { errorMiddleware } from '../lib/errorHandler.js';-import { browserSuiteCanRun } from '../lib/browserSuiteGate.js';+import { browserSuiteCanRun, resolveTestChrome, resolveClientBundler } from '../lib/browserSuiteGate.js';vi.mock('../lib/paths.js', async original => makePathsProxy(await original(), { dataRoot: () => lazyTempDataRoot('mv-review-browser-') }));vi.mock('../services/instanceIdentity.js', () => ({ ensureInstanceId: async () => 'synthetic-instance' }));@@ -19,18 +17,12 @@ let endpoint;vi.mock('../services/browserService.js', () => ({ loadConfig: async () => ({ chromePath: chrome }), cdpRequest: path => fetch(`${endpoint}${path}`) }));const { findFfmpeg } = await import('../lib/ffmpeg.js');const { _testChromeCaptureArgs, _waitForTestChrome, _cleanupTestBrowser, _testBrowserCleanupSettled, _createTestArtifactsRoot } = await import('../services/htmlComposition/testBrowserCleanup.js');-const chrome = [process.env.CHROME_PATH, chromium.executablePath(), '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome', '/usr/bin/google-chrome'].find(p => p && existsSync(p));+const chrome = resolveTestChrome();const ffmpeg = await findFfmpeg();// Server-only CI intentionally does not install the client workspace. This// cross-workspace visual test runs when all three local QA prerequisites exist.const client = resolve(import.meta.dirname, '../../client');-const requireClient = createRequire(join(client, 'package.json'));-let clientBundler;-try {- clientBundler = ['vite', '@vitejs/plugin-react', '@tailwindcss/postcss'].map(name => requireClient.resolve(name));-} catch (error) {- if (error.code !== 'MODULE_NOT_FOUND') throw error;-}+const clientBundler = resolveClientBundler(resolve(client, '..'));// Dependency discovery can read the mocked PATHS through ffmpeg imports.// Vitest does not run afterAll when the whole suite is skipped.diff --git a/server/routes/musicVideoRichAuthoring.browser.test.js b/server/routes/musicVideoRichAuthoring.browser.test.jsindex c6d19ad714..59810abc02 100644--- a/server/routes/musicVideoRichAuthoring.browser.test.js+++ b/server/routes/musicVideoRichAuthoring.browser.test.js@@ -8,16 +8,14 @@ vi.mock('../services/promptRunner.js', () => ({resolveProviderAndModel: async () => ({ provider: { id: 'stub-provider', type: 'api', enabled: true }, selectedModel: 'fixture-model' }),runPromptThroughProvider: async ({ prompt }) => { author.prompt = prompt; return { text: JSON.stringify({ sections: [{ id: author.sectionId, source: richSceneSource }] }) }; },}));-import { existsSync } from 'node:fs';import { mkdir, writeFile, copyFile } from 'node:fs/promises';import { join, resolve } from 'node:path';import { execFileSync, spawn } from 'node:child_process';import { monitorEventLoopDelay } from 'node:perf_hooks';import { chromium } from 'playwright-core';-import { createRequire } from 'node:module';import { makePathsProxy, lazyTempDataRoot, cleanupTempDataRoots } from '../lib/mockPathsDataRoot.js';import { errorMiddleware } from '../lib/errorHandler.js';-import { browserSuiteCanRun } from '../lib/browserSuiteGate.js';+import { browserSuiteCanRun, resolveTestChrome, resolveClientBundler } from '../lib/browserSuiteGate.js';vi.mock('../lib/paths.js', async original => makePathsProxy(await original(), { dataRoot: () => lazyTempDataRoot('mv-rich-ui-browser-') }));vi.mock('../services/instanceIdentity.js', () => ({ ensureInstanceId: async () => 'synthetic-instance' }));@@ -29,18 +27,12 @@ let endpoint;vi.mock('../services/browserService.js', () => ({ loadConfig: async () => ({ chromePath: chrome }), cdpRequest: path => fetch(`${endpoint}${path}`) }));const { findFfmpeg } = await import('../lib/ffmpeg.js');const { _testChromeCaptureArgs, _waitForTestChrome, _cleanupTestBrowser, _testBrowserCleanupSettled, _createTestArtifactsRoot } = await import('../services/htmlComposition/testBrowserCleanup.js');-const chrome = [process.env.CHROME_PATH, chromium.executablePath(), '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome', '/usr/bin/google-chrome'].find(p => p && existsSync(p));+const chrome = resolveTestChrome();const ffmpeg = await findFfmpeg();// Server-only CI intentionally does not install the client workspace. This// cross-workspace visual test runs when all three local QA prerequisites exist.const client = resolve(import.meta.dirname, '../../client');-const requireClient = createRequire(join(client, 'package.json'));-let clientBundler;-try {- clientBundler = ['vite', '@vitejs/plugin-react', '@tailwindcss/postcss'].map(name => requireClient.resolve(name));-} catch (error) {- if (error.code !== 'MODULE_NOT_FOUND') throw error;-}+const clientBundler = resolveClientBundler(resolve(client, '..'));// Read-only dependency discovery can still initialize mocked path fixtures.// Vitest skips cleanup hooks when no browser test can run.diff --git a/server/routes/musicVideoSongRevision.browser.test.js b/server/routes/musicVideoSongRevision.browser.test.jsindex e9b9d19696..ffd57d3229 100644--- a/server/routes/musicVideoSongRevision.browser.test.js+++ b/server/routes/musicVideoSongRevision.browser.test.js@@ -2,25 +2,20 @@import { afterAll, describe, expect, it, vi } from 'vitest';import express from 'express';import { Server } from 'socket.io';-import { existsSync } from 'node:fs';import { mkdir, writeFile, symlink } from 'node:fs/promises';import { join, resolve } from 'node:path';import { spawn } from 'node:child_process';-import { createRequire } from 'node:module';import { chromium } from 'playwright-core';import { makePathsProxy, lazyTempDataRoot, cleanupTempDataRoots } from '../lib/mockPathsDataRoot.js';import { waitForAbort } from '../lib/testHelper.js';import { errorMiddleware } from '../lib/errorHandler.js';-import { browserSuiteCanRun } from '../lib/browserSuiteGate.js';+import { browserSuiteCanRun, resolveTestChrome, resolveClientBundler } from '../lib/browserSuiteGate.js';vi.mock('../lib/paths.js', async original => makePathsProxy(await original(), { dataRoot: () => lazyTempDataRoot('mv-song-browser-') }));vi.mock('../services/settings.js', () => ({ getSettings: async () => ({}) }));const { _testChromeCaptureArgs, _waitForTestChrome, _cleanupTestBrowser, _testBrowserCleanupSettled, _createTestArtifactsRoot } = await import('../services/htmlComposition/testBrowserCleanup.js');-const chrome = [process.env.CHROME_PATH, chromium.executablePath(), '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome', '/usr/bin/google-chrome'].find(p => p && existsSync(p));+const chrome = resolveTestChrome();const client = resolve(import.meta.dirname, '../../client');-const requireClient = createRequire(join(client, 'package.json'));-let bundler;-try { bundler = ['vite', '@vitejs/plugin-react', '@tailwindcss/postcss'].map(name => requireClient.resolve(name)); }-catch (err) { if (err.code !== 'MODULE_NOT_FOUND') throw err; }+const bundler = resolveClientBundler(resolve(client, '..'));const canRun = browserSuiteCanRun('song revision browser suite', { Chrome: chrome, 'client workspace dependencies': bundler }, { onUnavailable: cleanupTempDataRoots });// Prerequisite discovery may initialize mocked paths; skipped suites have no cleanup hooks.let browser, artifacts, proc, server, io, songs, musicVideoEvents;diff --git a/server/services/codeAnimation/export.realBrowser.test.js b/server/services/codeAnimation/export.realBrowser.test.jsindex 51e9e478a2..d66b6d5a7e 100644--- a/server/services/codeAnimation/export.realBrowser.test.js+++ b/server/services/codeAnimation/export.realBrowser.test.js@@ -2,7 +2,7 @@// the staged document runs in real Chrome, renderComposition encodes it with// real ffmpeg, and the MP4 is compared to direct renderFrame(t) screenshots.import { afterAll, beforeAll, describe, expect, it, vi } from 'vitest';-import { existsSync, readFileSync } from 'node:fs';+import { readFileSync } from 'node:fs';import { createHash } from 'node:crypto';import { execFileSync, spawn } from 'node:child_process';import { join } from 'node:path';@@ -10,6 +10,7 @@ import { chromium } from 'playwright-core';import { cleanupTempDataRoots, lazyTempDataRoot, makePathsProxy } from '../../lib/mockPathsDataRoot.js';import { findFfmpeg, findFfprobe } from '../../lib/ffmpeg.js';import { _cleanupTestBrowser, _createTestArtifactsRoot, _waitForTestChrome } from '../htmlComposition/testBrowserCleanup.js';+import { resolveTestChrome } from '../../lib/browserSuiteGate.js';const state = vi.hoisted(() => ({ html: '' }));let endpoint;@@ -31,10 +32,7 @@ const { renderComposition } = await import('../htmlComposition/index.js');const { openComposition } = await import('../htmlComposition/browser.js');const { PATHS } = await import('../../lib/fileUtils.js');-const chrome = [process.env.CHROME_PATH, chromium.executablePath(),- '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome',- '/usr/bin/google-chrome', '/usr/bin/chromium', '/usr/bin/chromium-browser',-].find(path => path && existsSync(path));+const chrome = resolveTestChrome();const ffmpeg = await findFfmpeg();const ffprobe = await findFfprobe();@@ -79,6 +77,7 @@ import { RenderPass } from 'three/addons/postprocessing/RenderPass.js';import { UnrealBloomPass } from 'three/addons/postprocessing/UnrealBloomPass.js';import { OutputPass } from 'three/addons/postprocessing/OutputPass.js';import { RoundedBoxGeometry } from 'three/addons/geometries/RoundedBoxGeometry.js';+import { resolveTestChrome } from '../../lib/browserSuiteGate.js';window.ANIMATION_META = { title: 'Three', duration: 1, fps: ${FPS}, width: ${WIDTH}, height: ${HEIGHT} };const film = document.getElementById('film');const renderer = new THREE.WebGLRenderer({ canvas: film, antialias: false, preserveDrawingBuffer: true });diff --git a/server/services/codeAnimation/stages.realBrowser.db.test.js b/server/services/codeAnimation/stages.realBrowser.db.test.jsindex 2c00019375..374536dd43 100644--- a/server/services/codeAnimation/stages.realBrowser.db.test.js+++ b/server/services/codeAnimation/stages.realBrowser.db.test.js@@ -11,7 +11,8 @@ import { join } from 'node:path';import { chromium } from 'playwright-core';import { cleanupTempDataRoots, lazyTempDataRoot, makePathsProxy } from '../../lib/mockPathsDataRoot.js';import { findFfmpeg, findFfprobe } from '../../lib/ffmpeg.js';-import { _cleanupTestBrowser, _createTestArtifactsRoot, _selectTestChrome, _waitForTestChrome, _testChromeCaptureArgs } from '../htmlComposition/testBrowserCleanup.js';+import { _cleanupTestBrowser, _createTestArtifactsRoot, _waitForTestChrome, _testChromeCaptureArgs } from '../htmlComposition/testBrowserCleanup.js';+import { resolveTestChrome } from '../../lib/browserSuiteGate.js';let endpoint;vi.mock('../browserService.js', () => ({ cdpRequest: path => fetch(`${endpoint}${path}`) }));@@ -35,15 +36,7 @@ const health = await checkHealth().catch(error => ({ connected: false, error: erconst dbReady = requireDbOrSkip('codeAnimation/stages.realBrowser.db.test', health.connected, health.error);if (dbReady) await ensureSchema();-const selected = _selectTestChrome([- { source: 'env', path: process.env.CHROME_PATH },- { source: 'playwright', path: chromium.executablePath() },- { source: 'mac-app', path: '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome' },- { source: 'system-google-chrome', path: '/usr/bin/google-chrome' },- { source: 'system-chromium', path: '/usr/bin/chromium' },- { source: 'system-chromium-browser', path: '/usr/bin/chromium-browser' },-]);-const chrome = selected?.path;+const chrome = resolveTestChrome();const ffmpeg = await findFfmpeg();const ffprobe = await findFfprobe();@@ -81,7 +74,7 @@ describe.skipIf(!dbReady || !chrome || !ffmpeg || !ffprobe)('Production stages wproc = spawn(chrome, _testChromeCaptureArgs(profile), { stdio: ['ignore', 'ignore', 'pipe'], detached: process.platform !== 'win32' });channel('portos.composition-browser.lifecycle').publish({ event: 'child', profile: root, child: proc });try {- const ws = await _waitForTestChrome(proc, 20000, { source: selected.source, executable: chrome, profile });+ const ws = await _waitForTestChrome(proc, 20000, { source: 'test-chrome', executable: chrome, profile });endpoint = new URL(ws).origin.replace('ws:', 'http:');artifacts = _createTestArtifactsRoot();browser = await chromium.connectOverCDP(endpoint, { artifactsDir: artifacts.path });diff --git a/server/services/htmlComposition/index.test.js b/server/services/htmlComposition/index.test.jsindex e3b44f72ff..3548f7b73f 100644--- a/server/services/htmlComposition/index.test.js+++ b/server/services/htmlComposition/index.test.js@@ -13,6 +13,7 @@ import { videoGenEvents } from '../videoGen/events.js';import { renderComposition, cancel } from './index.js';import { installMotionKit } from './motionKit.js';import { _cleanupTestBrowser, _createTestArtifactsRoot, _waitForTestChrome, _testChromeCaptureArgs } from './testBrowserCleanup.js';+import { resolveTestChrome } from '../../lib/browserSuiteGate.js';vi.mock('./encode.js', async importOriginal => {const actual = await importOriginal();@@ -29,10 +30,7 @@ vi.mock('../../lib/fileUtils.js', async importOriginal => makePathsProxy(await idataRoot: () => lazyTempDataRoot('portos-html-composition-'),}));-const chrome = [process.env.CHROME_PATH, chromium.executablePath(),- '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome',- '/usr/bin/google-chrome', '/usr/bin/chromium', '/usr/bin/chromium-browser',-].find(path => path && existsSync(path));+const chrome = resolveTestChrome();const ffmpeg = await findFfmpeg();let proc;let browser;diff --git a/server/services/musicVideo/animaticCapture.browser.test.js b/server/services/musicVideo/animaticCapture.browser.test.jsindex 884bcad4fb..f33f202d2e 100644--- a/server/services/musicVideo/animaticCapture.browser.test.js+++ b/server/services/musicVideo/animaticCapture.browser.test.js@@ -1,27 +1,22 @@import { afterAll, beforeAll, describe, expect, it } from 'vitest';-import { existsSync } from 'node:fs';import { mkdtemp, rm, symlink, writeFile } from 'node:fs/promises';import { tmpdir } from 'node:os';import { join, resolve } from 'node:path';-import { createRequire } from 'node:module';import { execFileSync } from 'node:child_process';import express from 'express';import sharp from 'sharp';import { chromium } from 'playwright-core';import { startOwnedBrowserFixture } from '../../test/browserFixture.js';-import { browserSuiteCanRun } from '../../lib/browserSuiteGate.js';+import { browserSuiteCanRun, resolveTestChrome, resolveClientBundler } from '../../lib/browserSuiteGate.js';import { findFfmpeg } from '../../lib/ffmpeg.js';import { filmLookPreset } from '../../lib/filmLook.js';import { buildLyricPlaythroughPreview } from './lyricPlaythrough.js';-const client = resolve(import.meta.dirname, '../../../client');// Bundled StoryboardAnimatic.jsx exercises musicVideoFrameCapture.js and FrameStepper.jsx.// These source references are the fixture's CI dependency contract: generated JSX has no static import edge.-const requireClient = createRequire(join(client, 'package.json'));-let bundlers;-try { bundlers = ['vite', '@vitejs/plugin-react', '@tailwindcss/postcss'].map((name) => requireClient.resolve(name)); }-catch (error) { if (error.code !== 'MODULE_NOT_FOUND') throw error; }-const chrome = [process.env.CHROME_PATH, chromium.executablePath(), '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome', '/usr/bin/google-chrome', '/usr/bin/chromium'].find((path) => path && existsSync(path));+const client = resolve(import.meta.dirname, '../../../client');+const bundlers = resolveClientBundler(resolve(client, '..'));+const chrome = resolveTestChrome();const ffmpeg = await findFfmpeg();const canRun = browserSuiteCanRun('animatic frame capture', { Chrome: chrome, ffmpeg, 'client dependencies': bundlers });diff --git a/server/services/musicVideo/compositionRender.test.js b/server/services/musicVideo/compositionRender.test.jsindex 63d869d774..d1a59103b4 100644--- a/server/services/musicVideo/compositionRender.test.js+++ b/server/services/musicVideo/compositionRender.test.js@@ -11,6 +11,7 @@ import { _cleanupTestBrowser, _createTestArtifactsRoot, _waitForTestChrome } froimport { beatSnapClips, buildMusicVideoFfmpegArgs, resolveSceneClips } from './render.js';import { composedLyricWindows, projectTypographyPlan, renderableCues, sectionCardCues } from './composition.js';import { COMPOSITION_SCRATCH_DIR, removeCompositionScratch, renderTypographyOverlays } from './compositionRender.js';+import { resolveTestChrome } from '../../lib/browserSuiteGate.js';let endpoint;vi.mock('../browserService.js', () => ({ cdpRequest: path => fetch(`${endpoint}${path}`) }));@@ -18,10 +19,7 @@ vi.mock('../../lib/fileUtils.js', async importOriginal => makePathsProxy(await idataRoot: () => lazyTempDataRoot('portos-mv-composition-'),}));-const chrome = [process.env.CHROME_PATH, chromium.executablePath(),- '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome',- '/usr/bin/google-chrome', '/usr/bin/chromium', '/usr/bin/chromium-browser',-].find(path => path && existsSync(path));+const chrome = resolveTestChrome();const ffmpeg = await findFfmpeg();// Vitest runs no hooks for a file whose every test is skipped, so on a runner// without Chrome or ffmpeg the afterAll below never fires — yet importingdiff --git a/server/services/musicVideo/documentRender.browser.test.js b/server/services/musicVideo/documentRender.browser.test.jsindex d143b18e7b..54a5357841 100644--- a/server/services/musicVideo/documentRender.browser.test.js+++ b/server/services/musicVideo/documentRender.browser.test.js@@ -16,7 +16,7 @@ import { execFileSync, spawn } from 'node:child_process';import { chromium } from 'playwright-core';import sharp from 'sharp';import { cleanupTempDataRoots, lazyTempDataRoot, makePathsProxy, ownTestBodies } from '../../lib/mockPathsDataRoot.js';-import { browserSuiteCanRun, chromeWithH264 } from '../../lib/browserSuiteGate.js';+import { browserSuiteCanRun, chromeWithH264, resolveTestChrome } from '../../lib/browserSuiteGate.js';const { it, drain } = ownTestBodies(vitestIt);const lifecycle = vi.hoisted(() => ({ diagnostics: null, chromeProcess: null, fixtureWritersSettled: false }));@@ -75,10 +75,7 @@ afterAll(() => {if (!lifecycle.chromeProcess || (lifecycle.fixtureWritersSettled && _testBrowserCleanupSettled(lifecycle.chromeProcess))) cleanupTempDataRoots();});-const chrome = [process.env.CHROME_PATH, chromium.executablePath(),- '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome',- '/usr/bin/google-chrome', '/usr/bin/chromium', '/usr/bin/chromium-browser',-].find((path) => path && existsSync(path));+const chrome = resolveTestChrome();const ffmpeg = await findFfmpeg();// Imported discovery helpers can initialize mocked paths even on a skip.const canRun = browserSuiteCanRun('documentRender browser suite', { 'Chrome with H.264': await chromeWithH264(chrome), ffmpeg }, { onUnavailable: cleanupTempDataRoots });diff --git a/server/services/musicVideo/documentTemplates/layered/engine.overlay.browser.test.js b/server/services/musicVideo/documentTemplates/layered/engine.overlay.browser.test.jsindex 72d8a7367b..c4adf1de7a 100644--- a/server/services/musicVideo/documentTemplates/layered/engine.overlay.browser.test.js+++ b/server/services/musicVideo/documentTemplates/layered/engine.overlay.browser.test.js@@ -1,17 +1,15 @@-import { existsSync, readFileSync } from 'node:fs';+import { readFileSync } from 'node:fs';import { afterAll, beforeAll, describe, expect, it } from 'vitest';import { chromium } from 'playwright-core';-import { browserSuiteCanRun } from '../../../../lib/browserSuiteGate.js';+import { browserSuiteCanRun, resolveTestChrome } from '../../../../lib/browserSuiteGate.js';import { startOwnedBrowserFixture } from '../../../../test/browserFixture.js';import { gateAutoReview } from '../../autoReviewJudge.js';const engine = readFileSync(new URL('./engine.js', import.meta.url), 'utf8');const lyricType = readFileSync(new URL('../shared/lyricType.js', import.meta.url), 'utf8');-const chrome = [process.env.CHROME_PATH, chromium.executablePath(),- '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome', '/usr/bin/google-chrome', '/usr/bin/chromium', '/usr/bin/chromium-browser',-].find(path => path && existsSync(path));+const chrome = resolveTestChrome();const canRun = browserSuiteCanRun('layered overlay browser', { Chrome: chrome });describe.skipIf(!canRun)('layered footage review through rendered browser pixels', () => {diff --git a/server/services/musicVideo/documentTemplates/shared/lyricType.browser.test.js b/server/services/musicVideo/documentTemplates/shared/lyricType.browser.test.jsindex 984660a9c2..7138521321 100644--- a/server/services/musicVideo/documentTemplates/shared/lyricType.browser.test.js+++ b/server/services/musicVideo/documentTemplates/shared/lyricType.browser.test.js@@ -1,8 +1,8 @@-import { existsSync, readFileSync } from 'node:fs';+import { readFileSync } from 'node:fs';import { afterAll, beforeAll, describe, expect, it } from 'vitest';import { chromium } from 'playwright-core';import { startOwnedBrowserFixture } from '../../../../test/browserFixture.js';-import { browserSuiteCanRun } from '../../../../lib/browserSuiteGate.js';+import { browserSuiteCanRun, resolveTestChrome } from '../../../../lib/browserSuiteGate.js';// A synthetic song: a verse line, a chorus line, a spoken direction, all word-timed.const words = (text, start, step = 0.3) => text.split(' ').map((w, i) => ({ text: w, startSec: start + i * step, endSec: start + i * step + 0.25 }));@@ -27,8 +27,7 @@ const MV = {],};-const chrome = [process.env.CHROME_PATH, chromium.executablePath(), '/usr/bin/google-chrome', '/usr/bin/chromium', '/usr/bin/chromium-browser',- '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome'].find((path) => path && existsSync(path));+const chrome = resolveTestChrome();const canRun = browserSuiteCanRun('lyric type browser', { Chrome: chrome });describe.skipIf(!canRun)('lyricType in the layered template (browser pixels)', () => {diff --git a/server/services/musicVideo/documentTemplates/shared/toonWorld.browser.test.js b/server/services/musicVideo/documentTemplates/shared/toonWorld.browser.test.jsindex da6bb03a70..46c9c61fb3 100644--- a/server/services/musicVideo/documentTemplates/shared/toonWorld.browser.test.js+++ b/server/services/musicVideo/documentTemplates/shared/toonWorld.browser.test.js@@ -1,17 +1,14 @@import { afterAll, beforeAll, describe, expect, it } from 'vitest';-import { existsSync } from 'node:fs';import { readFile } from 'node:fs/promises';import { dirname, join } from 'node:path';import { createRequire } from 'node:module';import { fileURLToPath } from 'node:url';import { chromium } from 'playwright-core';import { startOwnedBrowserFixture } from '../../../../test/browserFixture.js';-import { browserSuiteCanRun } from '../../../../lib/browserSuiteGate.js';+import { browserSuiteCanRun, resolveTestChrome } from '../../../../lib/browserSuiteGate.js';const require = createRequire(import.meta.url);-const chrome = [process.env.CHROME_PATH, chromium.executablePath(),- '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome', '/usr/bin/google-chrome', '/usr/bin/chromium',-].find(p => p && existsSync(p));+const chrome = resolveTestChrome();const canRun = browserSuiteCanRun('toon world browser', { Chrome: chrome });const root = dirname(fileURLToPath(import.meta.url));const threeRoot = dirname(require.resolve('three'));diff --git a/server/services/musicVideo/overlayTextService.browser.test.js b/server/services/musicVideo/overlayTextService.browser.test.jsindex 30fa7c06e2..dd567e80b3 100644--- a/server/services/musicVideo/overlayTextService.browser.test.js+++ b/server/services/musicVideo/overlayTextService.browser.test.js@@ -10,14 +10,12 @@* plated data readout included.*/import { afterAll, describe, expect, it, vi } from 'vitest';-import { existsSync } from 'node:fs';import { mkdir, writeFile } from 'node:fs/promises';import { join } from 'node:path';-import { chromium } from 'playwright-core';import { cleanupTempDataRoots, lazyTempDataRoot, makePathsProxy } from '../../lib/mockPathsDataRoot.js';+import { resolveTestChrome } from '../../lib/browserSuiteGate.js';-const chrome = [process.env.CHROME_PATH, chromium.executablePath(), '/usr/bin/google-chrome', '/usr/bin/chromium',- '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome'].find((path) => path && existsSync(path));+const chrome = resolveTestChrome();vi.mock('../../lib/paths.js', async (importOriginal) => makePathsProxy(await importOriginal(), { dataRoot: () => lazyTempDataRoot('mv-overlay-text-') }));vi.mock('../settings.js', () => ({ getSettings: vi.fn(async () => ({})) }));diff --git a/server/services/musicVideo/publish/linkedin.browser.test.js b/server/services/musicVideo/publish/linkedin.browser.test.jsindex 98e4cc7876..e5105a2283 100644--- a/server/services/musicVideo/publish/linkedin.browser.test.js+++ b/server/services/musicVideo/publish/linkedin.browser.test.js@@ -1,15 +1,12 @@import { afterAll, beforeAll, describe, expect, it } from 'vitest';-import { existsSync } from 'node:fs';import { writeFile } from 'node:fs/promises';import { join } from 'node:path';import { chromium } from 'playwright-core';-import { browserSuiteCanRun } from '../../../lib/browserSuiteGate.js';+import { browserSuiteCanRun, resolveTestChrome } from '../../../lib/browserSuiteGate.js';import { startOwnedBrowserFixture } from '../../../test/browserFixture.js';import { linkedinAdapter } from './linkedin.js';-const chrome = [process.env.CHROME_PATH, chromium.executablePath(),- '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome', '/usr/bin/google-chrome', '/usr/bin/chromium',-].find(path => path && existsSync(path));+const chrome = resolveTestChrome();const canRun = browserSuiteCanRun('LinkedIn draft browser', { Chrome: chrome });const POST_URL = 'https://www.linkedin.com/feed/update/urn:li:activity:123456789/';const text = 'Example film.\n\nA second paragraph.\n\n\nFinal paragraph.';diff --git a/server/services/musicVideo/publish/sunoHook.browser.test.js b/server/services/musicVideo/publish/sunoHook.browser.test.jsindex f7f02fd527..5315275770 100644--- a/server/services/musicVideo/publish/sunoHook.browser.test.js+++ b/server/services/musicVideo/publish/sunoHook.browser.test.js@@ -1,15 +1,12 @@import { afterAll, beforeAll, describe, expect, it } from 'vitest';-import { existsSync } from 'node:fs';import { writeFile } from 'node:fs/promises';import { join } from 'node:path';import { chromium } from 'playwright-core';-import { browserSuiteCanRun } from '../../../lib/browserSuiteGate.js';+import { browserSuiteCanRun, resolveTestChrome } from '../../../lib/browserSuiteGate.js';import { startOwnedBrowserFixture } from '../../../test/browserFixture.js';import { sunoHookAdapter } from './sunoHook.js';-const chrome = [process.env.CHROME_PATH, chromium.executablePath(),- '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome', '/usr/bin/google-chrome', '/usr/bin/chromium',-].find(path => path && existsSync(path));+const chrome = resolveTestChrome();const canRun = browserSuiteCanRun('Suno Hook draft browser', { Chrome: chrome });const ID = '12345678-abcd-4abc-8abc-123456789abc';