Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
chore(e2e): auto-install version-matched Playwright browser in globalSetup
zchpeter843db454b6b3
diff --git a/frontend/package.json b/frontend/package.jsonindex dbd4cd0b57..c599294f6f 100644--- a/frontend/package.json+++ b/frontend/package.json@@ -17,6 +17,7 @@"type-check": "export NODE_OPTIONS=--max_old_space_size=8000 && tsc --build --force","pretest": "pnpm run prepare:artifacts","test": "vitest run --passWithNoTests",+ "test:e2e:install": "playwright install chromium","precoverage": "pnpm run prepare:artifacts","coverage": "vitest --coverage","i18n": "TS_NODE_PROJECT='./tsconfig.i18n.json' ts-node --compiler typescript-6 i18n.ts && pnpm fix",diff --git a/frontend/tests/e2e/README.md b/frontend/tests/e2e/README.mdindex 66453c7b19..14bef6acbb 100644--- a/frontend/tests/e2e/README.md+++ b/frontend/tests/e2e/README.md@@ -12,6 +12,16 @@ Playwright-based end-to-end tests for Bytebase. Starts a disposable Bytebase ser2. **`psql` client** on PATH — required for DDL setup (the Bytebase query API is read-only; tests connect directly to the sample Postgres via Unix socket).+3. **Playwright Chromium** — installed automatically. `globalSetup` runs+ `playwright install chromium` before booting the server, so a fresh checkout+ or a `@playwright/test` version bump (which invalidates the cached browser)+ self-heals on the next run. Playwright browsers live in a global cache keyed+ to the package version, outside `node_modules`, so `pnpm i` never fetches+ them. To pre-install (or fix a failed auto-install) manually:+ ```bash+ pnpm --dir frontend test:e2e:install # or: pnpm exec playwright install chromium+ ```+## Running Tests```bashdiff --git a/frontend/tests/e2e/framework/global-setup.ts b/frontend/tests/e2e/framework/global-setup.tsindex 6819f0cb46..c99e833075 100644--- a/frontend/tests/e2e/framework/global-setup.ts+++ b/frontend/tests/e2e/framework/global-setup.ts@@ -1,7 +1,21 @@+import { execFileSync } from "node:child_process";import { saveTestEnv } from "./env";import { cleanupOrphans, startServer, stopServer } from "./mode-start-new-bytebase";+// Playwright browsers live in a global cache (e.g. ~/Library/Caches/ms-playwright)+// keyed to the @playwright/test version, NOT in node_modules — so `pnpm i` never+// fetches them, and bumping @playwright/test silently invalidates the cache+// (the matching Chromium build simply isn't there until re-downloaded). Ensure+// the version-matched Chromium is present before any spec launches it. This is+// idempotent: a no-op with no download when the correct build is already cached.+function ensureBrowser() {+ execFileSync("pnpm", ["exec", "playwright", "install", "chromium"], {+ stdio: "inherit",+ });+}+async function globalSetup() {+ ensureBrowser();cleanupOrphans();let server: Awaited<ReturnType<typeof startServer>>;