Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
101 commits
Select commit Hold shift + click to select a range
7b6aa23
Plan the migration of the site build to Douze
sebastienros Oct 22, 2026
b22e067
Fold the plan review into the migration plan: content tree at the url…
sebastienros Oct 22, 2026
84636d8
Add the API route index, cross-reference and search data built from t…
sebastienros Oct 22, 2026
00981e2
Add the structural diff tool comparing two site outputs route by route
sebastienros Oct 22, 2026
cc09067
Record the native-tools-first choices: lightningcss, esbuild, Pagefin…
sebastienros Oct 22, 2026
55d5e02
Convert the articles from MDX to Markdown with Liquid shortcodes (scr…
sebastienros Oct 22, 2026
ddb26e1
Add the code highlighting worker: the Expressive Code engine with two…
sebastienros Oct 22, 2026
a82ae8e
Converter: strip byte order marks, wrap leftover JSX in raw blocks
sebastienros Oct 22, 2026
8d0abff
Port the Starlight chrome to Liquid: layouts, partials, shortcodes, s…
sebastienros Oct 22, 2026
4dad266
Site: api shortcode, server-side tab lists, api_page flag, View in Ma…
sebastienros Oct 22, 2026
507b642
Site: shared server-side tab markup for tabs and os_tabs, compact pag…
sebastienros Oct 22, 2026
d2022ce
Site: install and AppHost code shortcodes use the shared tab markup
sebastienros Oct 22, 2026
0d01ff7
StaticHost serves the Douze output of wwwroot; Playwright config for …
sebastienros Oct 22, 2026
14b2a66
Site: social image card template rendered by the social-image step; P…
sebastienros Oct 22, 2026
a91448a
Render the API reference with Douze: route templates over the route i…
sebastienros Oct 22, 2026
5f8d3b7
The full site workflow: articles, API reference, social images, code …
sebastienros Oct 22, 2026
3a1c438
Site: redirect stub pages and the redirects manifest; Markdown twins …
sebastienros Oct 22, 2026
4348ca7
Site: CLI schema routes, RSS items of the root locale, Playwright wit…
sebastienros Oct 22, 2026
2617727
Site: inline banner pre-paint script, home reveal contrast, git-commi…
sebastienros Oct 22, 2026
4fbf6d5
Site: home pages with the AppHost builder examples, testimonials, loc…
sebastienros Oct 22, 2026
53b9398
Site: external links keep their accessible names, as before
sebastienros Oct 22, 2026
e3b9a41
Site: no cross-document view transitions
sebastienros Oct 22, 2026
b0d0575
Site: API pages on the base layout with the page chrome; search contr…
sebastienros Oct 22, 2026
d54ff1b
Site: inline pre-paint scripts as partials, hreflang and component st…
sebastienros Oct 22, 2026
ffcc4b5
Site: the manual-queue pages converted with their components as short…
sebastienros Oct 22, 2026
99e76c1
Site: non-first tab panels start hidden
sebastienros Oct 22, 2026
56cef02
Site: headings inside components (not-content) get no anchors
sebastienros Oct 22, 2026
961ad0b
Site: the API pages do not need the collections step (its pass-throug…
sebastienros Oct 22, 2026
3003c1f
Site: paginated templates are not localized
sebastienros Oct 22, 2026
7e755a0
Site: Pagefind index built from the CLI, Expressive Code base styles …
sebastienros Oct 22, 2026
287119b
Site: the api shortcode carries its component class
sebastienros Oct 22, 2026
e723768
Site: strikethrough
sebastienros Oct 22, 2026
82a251f
Site: home twins per locale; no locale copies of the 404 page, the ex…
sebastienros Oct 22, 2026
283349e
Site: Dev Hub and samples pages
sebastienros Oct 22, 2026
5da837c
Site: the glossary twins match the terms' paths after permalink
sebastienros Oct 22, 2026
62fbea1
Site: glossary return links and legacy route, the resource browser as…
sebastienros Oct 22, 2026
261b9eb
Site: the samples gallery as a shortcode
sebastienros Oct 22, 2026
9525cc3
Site: API pages load their search controller as a module, inline side…
sebastienros Oct 22, 2026
711f3fb
Site: no Markdown twins of the fallback locale copies, of the hub twi…
sebastienros Oct 22, 2026
e94bb2a
Douze migration: the morning report
sebastienros Oct 22, 2026
32d9587
Site: the samples' social images, a second social-image step over the…
sebastienros Oct 22, 2026
f91d077
Site: the diagnostics "Learn more" links of experimental API types, f…
sebastienros Oct 22, 2026
3cdd5bf
Site: linked return types of API member cards wrap on narrow screens
sebastienros Oct 22, 2026
cd5fd57
Site: the locale 404 pages, the 404 and home twins, the agent skills …
sebastienros Oct 22, 2026
fd3894e
Site: sidebar topics as data/sidebars (pages with sidebar front matte…
sebastienros Oct 22, 2026
ac56e32
Site: the first-app CLI flags asides (indented as code), Dev Hub cata…
sebastienros Oct 22, 2026
46e6665
Site: Pagefind as a batch step over the laid out articles, concurrent…
sebastienros Oct 22, 2026
7f8f3de
Douze migration report: the second pass
sebastienros Oct 22, 2026
83e6e4f
Douze migration report: memory of the Astro and Douze builds
sebastienros Oct 22, 2026
6cbe2f7
Douze migration report: Satori against the standard GC
sebastienros Oct 22, 2026
1b7b1a4
Site: twoslash from Douze's native step, C# and Go hovers wired opt-in
sebastienros Oct 22, 2026
ffd3817
Douze migration report: native twoslash, build time and memory
sebastienros Oct 22, 2026
e6bffaf
Site: Node twoslash as the default for now, the native step one word …
sebastienros Oct 22, 2026
5de5b5d
Douze migration report: before and after the twoslash step, the nativ…
sebastienros Oct 22, 2026
008bf81
Douze migration report: popup difference counts
sebastienros Oct 22, 2026
b3cfc89
Douze build: drop the Go hover step, the site has no Go hovers
sebastienros Oct 22, 2026
a54f721
Douze build: use the renamed hover steps (hover-typescript, hover-csh…
sebastienros Oct 22, 2026
c9ca8ca
Document building the site with Douze (src/site/README.md)
sebastienros Oct 22, 2026
62b35e6
Douze build: native code highlighting, Pagefind and Lightning CSS, no…
sebastienros Oct 23, 2026
edde1fc
Douze migration report: code blocks, build time and Node after the na…
sebastienros Oct 23, 2026
eefd579
Douze build: name the hover steps after what they use (hover-typescri…
sebastienros Oct 23, 2026
d13ec62
Douze build: douze.yml in block style
sebastienros Oct 23, 2026
dc91b37
Douze build: the data a fresh clone was missing
sebastienros Oct 23, 2026
05e3685
Douze build: style the image zoom dialog
sebastienros Oct 23, 2026
31df046
Douze build: light and dark images follow the site's theme
sebastienros Oct 23, 2026
e0a6a2c
Douze build: highlight the install CLI modal's commands
sebastienros Oct 23, 2026
180ab4a
Douze build: install Douze as a .NET tool only
sebastienros Oct 23, 2026
7954011
Douze build: note the font sample-og shares with og
sebastienros Oct 23, 2026
c6b8307
Douze build: Douze 0.3.0 from nuget.org, a chrome highlight step per …
sebastienros Oct 26, 2026
88a91bf
Douze build: Douze 0.3.1
sebastienros Oct 26, 2026
eff3c46
Douze build: Douze 0.3.2
sebastienros Oct 26, 2026
11994be
Douze build: Douze 0.3.3
sebastienros Oct 26, 2026
3f8750b
Douze build: Douze 0.4.0
sebastienros Nov 6, 2026
c2bf80b
Merge main into sebros/douze-migration
sebastienros Nov 11, 2026
3e38a8e
Douze build: port the upstream changes merged from main
sebastienros Nov 11, 2026
2881702
Douze build: copy the data files the main merge missed
sebastienros Nov 12, 2026
4f2f4f7
Douze build: write the chrome's code blocks highlighted
sebastienros Nov 12, 2026
e625f0b
Douze build: follow Liquid's include and render rules
sebastienros Nov 12, 2026
0700901
Douze build: Douze 0.5.0
sebastienros Nov 12, 2026
38957e9
Douze build: no Pagefind warnings
sebastienros Nov 12, 2026
719673e
Douze build: build times measured with Douze 0.5.0
sebastienros Nov 12, 2026
b1c7772
Douze 0.5.1
sebastienros Nov 14, 2026
6bd8e98
Build the site with Douze in CI
sebastienros Nov 14, 2026
20239c1
Build and test the site with Douze in the frontend workflow
sebastienros Nov 14, 2026
cd43917
Copy the integration data to the Douze site too
sebastienros Nov 14, 2026
4b34a4f
Douze 0.5.2: the cache survives a fresh checkout
sebastienros Nov 14, 2026
74c1fa4
Fix the site gaps the E2E suite found on the Douze build
sebastienros Nov 14, 2026
e1e68a2
Adapt the E2E specs to the full page loads of the Douze site
sebastienros Nov 14, 2026
69bb7e2
Build StaticHost while Playwright installs Chromium in the E2E jobs
sebastienros Nov 14, 2026
3f1925c
Don't raise the specificity of global rules whose subject is only :wh…
sebastienros Nov 14, 2026
e2e7967
Fix three E2E tests that depended on CI timing
sebastienros Nov 14, 2026
ba20585
Import search-controls.css after the component styles, as the Astro b…
sebastienros Nov 14, 2026
f7b0419
Give the route style comparison 15 s to settle on CI runners
sebastienros Nov 14, 2026
9e0e3a8
Add a prototype job comparing E2E browsers over CDP on a slice of specs
sebastienros Nov 14, 2026
d287542
Port 34 E2E tests to xUnit on Jint.Browser's in-process API
sebastienros Nov 14, 2026
8b8b4d7
Install jint-browser from the Jint preview feed instead of building it
sebastienros Nov 14, 2026
304770f
Fix the CDP harness for Lightpanda and Jint.Browser and polyfill CSS …
sebastienros Nov 14, 2026
6d7b373
Let Jint.Browser page tasks run up to 120 s instead of 5 s
sebastienros Nov 14, 2026
90baccc
Polyfill @scope in the contexts that tests create themselves
sebastienros Nov 14, 2026
747491a
Use the setContent and addStyleTag workarounds for Kitesurf too
sebastienros Nov 14, 2026
6c026f8
Run Kitesurf with the harness workarounds alone, since applying @scop…
sebastienros Nov 14, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ jobs:
frontend=true
apphost=true
else
if git diff --quiet "$base_sha" "$head_sha" -- src/frontend; then
if git diff --quiet "$base_sha" "$head_sha" -- src/frontend src/site; then
frontend=false
else
frontend=true
Expand Down
390 changes: 292 additions & 98 deletions .github/workflows/frontend-build.yml

Large diffs are not rendered by default.

30 changes: 29 additions & 1 deletion .github/workflows/update-integration-data.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,25 @@ jobs:
GITHUB_TOKEN: ${{ github.token }}
run: ./src/frontend/scripts/update-integration-data.ps1

# The site builds with Douze from src/site, which keeps its own copies
# of the generated data the site reads: mirror them, so the PR updates
# both. The API data (pkgs, ts-modules) needs no copy: the build's API
# index script reads it from src/frontend.
- name: Copy the data to the Douze site
if: ${{ steps.update.outputs.changed == 'true' }}
shell: bash
run: |
set -euo pipefail
from=src/frontend/src/data
to=src/site/data
for f in aspire-integrations.json integration-docs.json github-stats.json \
github-contributors.json samples.json aspire-blog-posts.json; do
cp "$from/$f" "$to/$f"
done
cp "$from/twoslash/aspire.d.ts" "$to/twoslash/aspire.d.ts"
rsync -a --delete "$from/schemas/" "$to/schemas/"
rsync -a --delete src/frontend/src/assets/samples/ src/site/assets/images/samples/

- name: Commit and refresh automation branch
if: ${{ steps.update.outputs.changed == 'true' }}
id: push
Expand Down Expand Up @@ -121,7 +140,16 @@ jobs:
src/frontend/src/assets/samples \
src/frontend/src/data/pkgs \
src/frontend/src/data/ts-modules \
src/frontend/src/data/twoslash/aspire.d.ts
src/frontend/src/data/twoslash/aspire.d.ts \
src/site/data/aspire-integrations.json \
src/site/data/integration-docs.json \
src/site/data/github-stats.json \
src/site/data/github-contributors.json \
src/site/data/samples.json \
src/site/data/aspire-blog-posts.json \
src/site/data/schemas \
src/site/assets/images/samples \
src/site/data/twoslash/aspire.d.ts

if git diff --cached --quiet; then
echo "No staged changes after filtering to allowed paths; skipping PR."
Expand Down
847 changes: 847 additions & 0 deletions docs/douze-migration-plan.md

Large diffs are not rendered by default.

398 changes: 398 additions & 0 deletions docs/douze-migration-report.md

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/frontend/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cdp-results/
14 changes: 14 additions & 0 deletions src/frontend/playwright.cdp.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Prototype (E2E driver and browser alternatives): the Douze configuration, with every worker connected over CDP to a
// browser that is already running at CDP_ENDPOINT instead of a Chromium that Playwright launches. tsconfig.cdp.json
// points the specs' `@playwright/test` import at tests/cdp/playwright-test-shim.ts, which swaps the `browser` fixture.
// Run: CDP_ENDPOINT=http://127.0.0.1:9222 bun run playwright test --config playwright.cdp.config.mjs --project=desktop-chromium <specs>
import { defineConfig } from '@playwright/test';
import douze from './playwright.douze.config.mjs';

export default defineConfig({
...douze,
tsconfig: './tsconfig.cdp.json',
// A CDP browser that is not Chromium may not record traces or videos; keep failure screenshots only.
use: { ...douze.use, trace: 'off', video: 'off' },
projects: douze.projects.map(({ use: { launchOptions, channel, ...use }, ...project }) => ({ ...project, use })),
});
30 changes: 30 additions & 0 deletions src/frontend/playwright.douze.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// Playwright configuration for the Douze build: the same specs (tests/e2e), served by StaticHost from its wwwroot,
// which `douze -s src/site -o src/statichost/StaticHost/wwwroot` fills (what production serves: Markdown negotiation,
// canonical redirects, 404, headers). Run: `pnpm exec playwright test --config playwright.douze.config.mjs`.
import { defineConfig } from '@playwright/test';
import base from './playwright.config.mjs';

const e2ePort = Number(process.env.PLAYWRIGHT_TEST_PORT || '4322');

// Playwright 1.61 wants its own Chromium build; when it is not installed, PLAYWRIGHT_CHROMIUM points at another
// Chrome for Testing build (for example ~/Library/Caches/ms-playwright/chromium-1248/chrome-mac-arm64/Google Chrome for Testing.app/Contents/MacOS/Google Chrome for Testing).
const executablePath = process.env.PLAYWRIGHT_CHROMIUM;

export default defineConfig({
...base,
projects: base.projects.map((project) => ({
...project,
use: { ...project.use, ...(executablePath ? { launchOptions: { executablePath } } : {}) },
})),
webServer: {
// STATICHOST_NO_BUILD: StaticHost is already built (the CI builds it while Playwright installs Chromium).
command: `dotnet run -c Release ${process.env.STATICHOST_NO_BUILD ? '--no-build ' : ''}--project ../statichost/StaticHost --urls http://127.0.0.1:${e2ePort}`,
// No Redis runs with the tests: the short connect timeout keeps StaticHost from waiting 5 s per attempt at startup.
env: { ...process.env, ASPNETCORE_ENVIRONMENT: 'Development', DOTNET_NOLOGO: '1', ConnectionStrings__cache: 'localhost:6379,abortConnect=false,connectTimeout=500' },
url: `http://127.0.0.1:${e2ePort}/`,
reuseExistingServer: true,
timeout: 180_000,
stdout: 'pipe',
stderr: 'pipe',
},
});
116 changes: 116 additions & 0 deletions src/frontend/tests/cdp/playwright-test-shim.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
// Prototype only (playwright.cdp.config.mjs): the specs import `@playwright/test`, which tsconfig.cdp.json maps to
// this file. It re-exports Playwright's test API unchanged, except that the worker's `browser` is a CDP connection
// to an already running browser (CDP_ENDPOINT) instead of a Chromium that Playwright launches. The same specs then
// run against Chromium, Lightpanda, Jint.Browser or Kitesurf without being edited.
//
// Opt-in workarounds for gaps in a CDP engine, enabled per engine by tests/cdp/run-engine.sh (CDP_WORKAROUNDS, a
// comma-separated list). They change how a test reaches the page, never what it asserts:
// - scope-polyfill: rewrites every served stylesheet so that `@scope (X) to (Y) { R }` becomes R with `:where(X)`
// in front (the lower bound Y is dropped). Douze compiles component styles to @scope, which only Chromium
// implements here; without it, half of the site's rules are dropped. Measures what an engine fix would buy.
// - set-content-route: page.setContent serves the HTML from a same-origin route and navigates to it, for engines
// where document.open()/write() after load is a no-op or console events don't reach Playwright (Jint.Browser).
// - style-tag-no-load: page.addStyleTag({ content }) appends the <style> without waiting for its load event,
// which some engines never fire for inline styles (Jint.Browser).
// - extra-connection: browser.newContext opens a second CDP connection when the engine allows a single browser
// context per connection (Lightpanda), as `all resource destinations remain available without JavaScript` needs.
import { chromium, test as base, type Browser, type BrowserContext, type Page } from 'playwright/test';
import { unscopeCss } from './unscope-css';

export * from 'playwright/test';

// Without CDP_ENDPOINT, Playwright launches its own Chromium as usual (the no-recording baseline).
const endpoint = process.env.CDP_ENDPOINT;
const workarounds = new Set((process.env.CDP_WORKAROUNDS ?? '').split(',').map((name) => name.trim()).filter(Boolean));

const connect = () => chromium.connectOverCDP(endpoint!, { timeout: 30_000 });

function allowExtraContexts(browser: Browser, extra: Browser[]) {
const newContext = browser.newContext.bind(browser);
browser.newContext = async (options) => {
try {
return await newContext(options);
} catch (error) {
if (!/more than one browser context/i.test(String(error))) throw error;
const second = await connect();
extra.push(second);
return second.newContext(options);
}
};
}

const polyfilled = new WeakSet<BrowserContext>();

// Also for the contexts that a test creates itself (browser.newContext), such as the no-JavaScript one.
function polyfillScopeInNewContexts(browser: Browser) {
const newContext = browser.newContext.bind(browser);
browser.newContext = async (options) => {
const context = await newContext(options);
await polyfillScope(context);
return context;
};
}

async function polyfillScope(context: BrowserContext) {
if (polyfilled.has(context)) return;
polyfilled.add(context);
// Node's fetch, not route.fetch(): Playwright's request context first reads the browser's cookies over CDP, which
// Lightpanda never answers (route.fetch times out). The site's stylesheets don't depend on cookies.
await context.route(/\.css(?:\?|$)/, async (route) => {
const response = await fetch(route.request().url());
const body = await response.text();
await route.fulfill({
status: response.status,
contentType: response.headers.get('content-type') ?? 'text/css',
body: response.ok ? unscopeCss(body) : body,
});
});
}

function patchPage(page: Page, baseURL: string | undefined) {
if (workarounds.has('set-content-route')) {
let count = 0;
page.setContent = async (html, options = {}) => {
const url = new URL(`/__cdp-set-content/${process.pid}-${++count}`, baseURL ?? page.url()).href;
await page.route(url, (route) => route.fulfill({ contentType: 'text/html; charset=utf-8', body: html }), { times: 1 });
await page.goto(url, { waitUntil: options.waitUntil ?? 'load', timeout: options.timeout });
};
}
if (workarounds.has('style-tag-no-load')) {
const addStyleTag = page.addStyleTag.bind(page);
page.addStyleTag = async (options = {}) => {
if (options.content === undefined) return addStyleTag(options);
return (await page.evaluateHandle((content) => {
const style = document.createElement('style');
style.textContent = content;
(document.head ?? document.documentElement).append(style);
return style;
}, options.content)).asElement()!;
};
}
}

export const test = !endpoint ? base : base.extend<{}, {}>({
browser: [
async ({}, use) => {
const browser = await connect();
const extra: Browser[] = [];
if (workarounds.has('extra-connection')) allowExtraContexts(browser, extra);
if (workarounds.has('scope-polyfill')) polyfillScopeInNewContexts(browser);
await use(browser);
for (const other of extra) await other.close().catch(() => {});
await browser.close().catch(() => {});
},
{ scope: 'worker' },
],
context: async ({ context }, use) => {
if (workarounds.has('scope-polyfill')) await polyfillScope(context);
await use(context);
},
page: async ({ page, baseURL }, use) => {
patchPage(page, baseURL);
await use(page);
},
});

export default test;
103 changes: 103 additions & 0 deletions src/frontend/tests/cdp/run-engine.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
#!/usr/bin/env bash
# Prototype (E2E driver and browser alternatives): provisions one browser, runs the slice of specs against it on the
# desktop-chromium project and writes a summary. Run from src/frontend once StaticHost is built (STATICHOST_NO_BUILD).
# ENGINE: playwright | playwright-no-recording | chromium-cdp | lightpanda | jint-browser | kitesurf
# SLICE: a Playwright file filter (regular expression)
# kitesurf expects the engine to be already listening on 127.0.0.1:9222 (the kitesurf job builds and starts it).
set -uo pipefail

ENGINE=${ENGINE:?}
SLICE=${SLICE:-'/(analytics-scripts|dev-browse|cookie-dialog-layout|og-metadata)\.spec\.ts'}
OUT=${OUT:-"$PWD/cdp-results"}
TOOLS=${RUNNER_TEMP:-/tmp}/cdp-tools
LIGHTPANDA_VERSION=1.0.4
JINT_VERSION=5.0.0-preview.2441
# SUBSET=1: the 34 tests that tests/E2E.Jint ports to xUnit on Jint.Browser's in-process API.
SUBSET_GREP='only displayed resource artwork|Dev Hub leads to the complete|tutorials and quickstarts keep|article language filters include|every ingested official blog post|empty results preserve useful|multi-type filters and sorting|legacy provider links|analytics|metadata|og:type|og:image|site description|site-wide image|content languages'
grep_args=()
if [ -n "${SUBSET:-}" ]; then
SLICE='/(analytics-scripts|dev-browse|og-metadata)\.spec\.ts'
grep_args=(--grep "$SUBSET_GREP" --grep-invert 'video platforms')
fi
LABEL="$ENGINE${SUBSET:+-subset}${LABEL_SUFFIX:-}"
mkdir -p "$OUT" "$TOOLS"

now() { date +%s.%N; }
wait_for() { for _ in $(seq 1 "${2:-120}"); do curl -sf -o /dev/null "$1" && return 0; sleep 1; done; echo "::error::$1 did not answer"; return 1; }

setup_start=$(now)
config=playwright.cdp.config.mjs
case "$ENGINE" in
playwright | playwright-no-recording)
# playwright.cdp.config.mjs without CDP_ENDPOINT: Playwright launches Chromium, with no trace or video.
[ "$ENGINE" = playwright ] && config=playwright.douze.config.mjs
bun run playwright install --with-deps chromium >/dev/null
;;
chromium-cdp)
bun run playwright install --with-deps chromium-headless-shell >/dev/null
shell=$(ls -d "$HOME"/.cache/ms-playwright/chromium_headless_shell-*/chrome-headless-shell-linux64/chrome-headless-shell | head -n 1)
"$shell" --remote-debugging-port=9222 --user-data-dir="$TOOLS/chrome-profile" --no-first-run --no-sandbox \
--hide-scrollbars --mute-audio about:blank > "$OUT/browser.log" 2>&1 &
wait_for http://127.0.0.1:9222/json/version 60 || exit 1
;;
lightpanda)
curl -sSfL -o "$TOOLS/lightpanda" "https://github.com/lightpanda-io/browser/releases/download/$LIGHTPANDA_VERSION/lightpanda-x86_64-linux"
chmod +x "$TOOLS/lightpanda"
"$TOOLS/lightpanda" version || true
# Stylesheets and images are off by default in `serve`; the specs read styles and wait for images.
# --cdp-max-message-size: the default (1 MB) is smaller than the axe-core source that AxeBuilder injects
# (1.3 MB); Lightpanda then drops the connection and the next test cannot create its browser context.
"$TOOLS/lightpanda" serve --host 127.0.0.1 --port 9222 --load-resources stylesheet,image --disable-metrics \
--cdp-max-connections 64 \
--cdp-max-message-size 16777216 > "$OUT/browser.log" 2>&1 &
wait_for http://127.0.0.1:9222/json/version 30 || { cat "$OUT/browser.log"; exit 1; }
;;
jint-browser)
# The jint-browser tool from the Jint preview feed (Jint 5 is not on nuget.org yet): a native AOT executable,
# the same package version as the Jint.Browser library of tests/E2E.Jint.
dotnet tool install Jint.Browser.Tool --version "$JINT_VERSION" --tool-path "$TOOLS/jint-browser" \
--configfile ../../tests/E2E.Jint/NuGet.config > "$OUT/jint-install.log" 2>&1 \
|| { cat "$OUT/jint-install.log"; exit 1; }
"$TOOLS/jint-browser/jint-browser" version
# --max-task-duration: one turn of a page may run 5 s by default; the resource browser's first render and
# axe-core take longer under the interpreter on a CI runner, and the page is then torn down mid-test.
"$TOOLS/jint-browser/jint-browser" serve --port 9222 --max-task-duration 120s > "$OUT/browser.log" 2>&1 &
wait_for http://127.0.0.1:9222/json/version 60 || { cat "$OUT/browser.log"; exit 1; }
;;
kitesurf)
wait_for http://127.0.0.1:9222/json/version 30 || exit 1
;;
*) echo "::error::Unknown engine $ENGINE"; exit 1 ;;
esac
setup_end=$(now)
curl -s http://127.0.0.1:9222/json/version 2>/dev/null | head -c 300 && echo

endpoint=http://127.0.0.1:9222
# Harness workarounds for each engine (tests/cdp/playwright-test-shim.ts). WORKAROUNDS=none runs without them;
# WORKAROUNDS=<list> replaces the default. scope-polyfill flattens CSS @scope, which none of the three implement.
case "$ENGINE" in
lightpanda) default_workarounds=scope-polyfill,extra-connection ;;
jint-browser) default_workarounds=scope-polyfill,set-content-route,style-tag-no-load ;;
kitesurf) default_workarounds=scope-polyfill,set-content-route,style-tag-no-load ;;
*) default_workarounds= ;;
esac
workarounds=${WORKAROUNDS:-$default_workarounds}
[ "$workarounds" = none ] && workarounds=
echo "CDP_WORKAROUNDS=$workarounds"
case "$ENGINE" in playwright | playwright-no-recording) endpoint= ;; esac

tests_start=$(now)
CDP_ENDPOINT=$endpoint CDP_WORKAROUNDS=$workarounds PLAYWRIGHT_JSON_OUTPUT_NAME="$OUT/$LABEL.json" \
bun run playwright test --config "$config" --project=desktop-chromium --retries=0 --reporter=dot,json "${grep_args[@]}" "$SLICE"
status=$?
tests_end=$(now)

{
node tests/cdp/summarize.mjs "$OUT/$LABEL.json" "$LABEL"
printf 'Browser provisioning (download and install included): %.1f s. Playwright command: %.1f s. Exit code: %s.\n\n' \
"$(echo "$setup_end - $setup_start" | bc)" "$(echo "$tests_end - $tests_start" | bc)" "$status"
} | tee -a "${GITHUB_STEP_SUMMARY:-/dev/null}"
printf '{"engine":"%s","setupS":%.1f,"testsS":%.1f,"exit":%s}\n' "$LABEL" \
"$(echo "$setup_end - $setup_start" | bc)" "$(echo "$tests_end - $tests_start" | bc)" "$status" > "$OUT/$LABEL.timing.json"
# The prototype reports; it does not gate the PR.
exit 0
47 changes: 47 additions & 0 deletions src/frontend/tests/cdp/summarize.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// Prototype: summarizes a Playwright JSON report (PLAYWRIGHT_JSON_OUTPUT_NAME) as one row per spec file, so the
// runs against each browser can be compared. Usage: node tests/cdp/summarize.mjs <report.json> <label>
// Prints Markdown and writes <report>.summary.json next to the report.
import { readFileSync, writeFileSync } from 'node:fs';

const [reportPath, label = 'run'] = process.argv.slice(2);
const report = JSON.parse(readFileSync(reportPath, 'utf8'));

const files = new Map();
const visit = (suite, file) => {
const name = suite.file ?? file;
for (const spec of suite.specs ?? []) {
for (const test of spec.tests ?? []) {
const row = files.get(name) ?? { passed: 0, failed: 0, skipped: 0, flaky: 0, ms: 0, errors: new Map() };
const status = test.status === 'expected' ? 'passed' : test.status === 'unexpected' ? 'failed' : test.status;
row[status] = (row[status] ?? 0) + 1;
for (const result of test.results ?? []) {
row.ms += result.duration ?? 0;
const message = result.error?.message?.split('\n').find((line) => line.trim())?.replace(/\u001b\[[0-9;]*m/g, '').slice(0, 140);
if (message && status === 'failed') row.errors.set(message, (row.errors.get(message) ?? 0) + 1);
}
files.set(name, row);
}
}
for (const child of suite.suites ?? []) visit(child, name);
};
for (const suite of report.suites ?? []) visit(suite);

const total = { passed: 0, failed: 0, skipped: 0, flaky: 0, ms: 0 };
const lines = [`### ${label}`, '', '| Spec | Passed | Failed | Skipped | Test time (s) |', '| --- | ---: | ---: | ---: | ---: |'];
for (const [name, row] of [...files].sort()) {
for (const key of Object.keys(total)) total[key] += row[key] ?? 0;
lines.push(`| ${name} | ${row.passed + row.flaky} | ${row.failed} | ${row.skipped} | ${(row.ms / 1000).toFixed(1)} |`);
}
lines.push(`| **Total** | **${total.passed + total.flaky}** | **${total.failed}** | **${total.skipped}** | **${(total.ms / 1000).toFixed(1)}** |`);
lines.push('', `Wall time of the run: ${(report.stats.duration / 1000).toFixed(1)} s.`, '');

const errors = new Map();
for (const row of files.values()) for (const [message, count] of row.errors) errors.set(message, (errors.get(message) ?? 0) + count);
if (errors.size) {
lines.push('<details><summary>Most frequent first error lines</summary>', '');
for (const [message, count] of [...errors].sort((a, b) => b[1] - a[1]).slice(0, 12)) lines.push(`- ${count} × \`${message.replace(/`/g, "'")}\``);
lines.push('', '</details>', '');
}

console.log(lines.join('\n'));
writeFileSync(`${reportPath}.summary.json`, JSON.stringify({ label, wallMs: report.stats.duration, total, files: Object.fromEntries([...files].map(([k, v]) => [k, { ...v, errors: Object.fromEntries(v.errors) }])) }, null, 2));
Loading
Loading