Files
softharbor/playwright.config.ts
poli0981andClaude Opus 5.5 20e312b851
CI / gates (push) Successful in 49s
Reusable / Security / Secrets (gitleaks) (push) Successful in 14s
Reusable / Security / Rust (cargo-deny) (push) Skipped
Reusable / Security / .NET (NuGetAudit) (push) Skipped
Reusable / Security / SAST (Opengrep) (push) Successful in 33s
Reusable / Security / Dependencies (osv-scanner) (push) Successful in 18s
Security / security (push) Successful in 1m7s
Reusable / Qodana / Qodana (push) Successful in 3m23s
Qodana / qodana (push) Successful in 3m23s
CI / build (push) Successful in 5m29s
CI / record (push) Skipped
CI / deploy (push) Successful in 1m9s
chore(deps): upkeep 2026-12-05 — 16 non-major bumps, clear six dev-tooling advisories (#11)
Dependency upkeep for 2026-12-05. Supersedes #10.

* fix(deps): update all non-major dependencies (Renovate: actions/setup-node 7.2.0, @vite-pwa/astro 2.0.5)
* chore(deps): upkeep 2026-12-05 — 16 non-major bumps, clear six dev-tooling advisories
  astro 7.4.14, svelte 5.60.1, wrangler 4.171.0, eslint 10.16.0, knip 6.51.0, prettier 3.10.2, @playwright/test 1.65.2, @astrojs/rss 4.0.20, @astrojs/sitemap 3.7.7, eslint-plugin-astro 3.2.3, svelte-eslint-parser 1.13.0, globals 17.15.0, sharp 0.35.6, @iconify-json/lucide 1.2.163, @iconify-json/simple-icons 1.2.105.
  pnpm audit / osv-scanner now clean: cross-spawn 7.1.1 (GHSA-ghv9-86vm-4v8m critical, GHSA-m6qr-m48x-3xhh, GHSA-w3gc-668g-rf8f), ws >= 8.23.0 (GHSA-37g9-w4hg-h9qr), minimatch 11.0.10 (GHSA-3924-r96c-gp9w), terser gone from the lockfile (GHSA-6jpm-p5cq-9q44). All build/dev tooling; no override added.
* fix(e2e): size the Playwright pool by the container's CPU quota
  The ubuntu jobs moved to runner anon-docker (2026-12-04, `--cpus=4`), but os.cpus() reports the host's 28 cores, so 14 workers shared four CPUs and the axe tests timed out — main failed the same way (dispatched run 1565). playwright.config.ts reads /sys/fs/cgroup/cpu.max; no quota keeps Playwright's default.

No release: routine upkeep (docs/13 §1).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-05 03:36:07 +00:00

92 lines
3.9 KiB
TypeScript

// SPDX-License-Identifier: GPL-3.0-only
// Copyright (C) 2026 poli0981 (SkullMute)
//
// docs/11 — end-to-end smoke suite against the BUILT site (`astro preview`
// serves dist/ exactly as built, including the per-page meta CSP).
//
// What it exists to catch is the class of bug this project kept shipping with
// every unit test green: a script or style the CSP silently refused, a dialog
// the platform could dismiss, an island that threw on hydration. The shared
// fixture (e2e/fixtures.ts) fails any test whose page logged a console error
// or a CSP violation.
//
// `astro preview` applies neither _headers nor the Worker, so a second server
// does: `wrangler dev` on the same dist/ with the real wrangler.jsonc, for the
// `worker` project alone (e2e/worker.spec.ts — routing, the rate limits, the
// 429 page). Cloudflare's own edge is verified on production after each
// deploy (ci.yml `deploy`, docs/13 §3) — there are no preview versions since
// the move to Gitea (D38).
import { readFileSync } from 'node:fs';
import { defineConfig, devices } from '@playwright/test';
/**
* CPUs this process may actually use when a cgroup v2 quota caps it — the
* CI job container runs with `docker --cpus=4` (runner `anon-docker`, since
* 2026-12-04), yet `os.cpus()`, which Playwright sizes its pool by, still
* reports every core of the host (28). Fourteen workers on four CPUs made
* axe on /apps take over 30 s instead of ~9 s and time out. `undefined`
* (Playwright's own default) wherever no quota applies, laptops included.
*/
function cgroupCpuQuota(): number | undefined {
try {
const [quota, period] = readFileSync('/sys/fs/cgroup/cpu.max', 'utf8').trim().split(/\s+/);
if (quota === undefined || quota === 'max' || period === undefined) return undefined;
const cpus = Math.floor(Number(quota) / Number(period));
return Number.isFinite(cpus) ? Math.max(1, cpus) : undefined;
} catch {
return undefined;
}
}
const CPU_QUOTA = cgroupCpuQuota();
const PORT = 4321;
// Not wrangler's default 8787/8788: another project's `wrangler dev` may hold
// those, and reuseExistingServer would then test the wrong site.
const WORKER_PORT = 8799;
const WORKER_SPEC = /worker\.spec\.ts$/;
export default defineConfig({
testDir: 'e2e',
fullyParallel: true,
...(CPU_QUOTA === undefined ? {} : { workers: CPU_QUOTA }),
forbidOnly: Boolean(process.env['CI']),
retries: process.env['CI'] ? 1 : 0,
// `list` in CI too: Gitea shows no annotations, so the github reporter's
// terse `::error` lines would only hide the readable output.
reporter: process.env['CI'] ? [['list'], ['html', { open: 'never' }]] : 'list',
use: {
baseURL: `http://127.0.0.1:${PORT}`,
trace: 'retain-on-failure',
},
projects: [
{ name: 'desktop', use: { ...devices['Desktop Chrome'] }, testIgnore: WORKER_SPEC },
// Bottom sheets, the wrapped header and touch targets live here.
{ name: 'mobile', use: { ...devices['Pixel 7'] }, testIgnore: WORKER_SPEC },
{
name: 'worker',
testMatch: WORKER_SPEC,
use: { ...devices['Desktop Chrome'], baseURL: `http://127.0.0.1:${WORKER_PORT}` },
},
],
webServer: [
{
command: `pnpm exec astro preview --port ${PORT} --host 127.0.0.1`,
url: `http://127.0.0.1:${PORT}`,
reuseExistingServer: !process.env['CI'],
timeout: 60_000,
// Astro ≥ 7.2 backgrounds `astro preview` when it detects an AI agent or
// CI; Playwright needs it in the foreground to own its lifetime.
env: { ASTRO_PREVIEW_BACKGROUND: '0' },
},
{
command: `pnpm exec wrangler dev --port ${WORKER_PORT} --ip 127.0.0.1 --show-interactive-dev-session=false`,
// An asset-first path (a negative pattern), so the readiness probes
// spend nothing from the rate limit the tests measure.
url: `http://127.0.0.1:${WORKER_PORT}/favicon.svg`,
reuseExistingServer: !process.env['CI'],
timeout: 90_000,
env: { WRANGLER_SEND_METRICS: 'false' },
},
],
});