CI green on a loaded shared machine: browser suites (now also glyph-ligatures and feature-fit, through the shared launch helper) in one dedicated shard started first at concurrency 2; timeouts scaled by load ÷ cores (tests/helpers/load.ts, max(1-, 5-min average), capped at 5x, logged) for browser tests, waits, launch/close, the other shards' default and the desktop boot check; one retry for a browser test that timed out while the factor was above 2, listed as 'retried under load' in the CI summary, never for an assertion failure; the six-type App Privacy walk no longer dumps every step (the --debug-dump check walks two types), wait timeouts print per-line times; play-edit-lock checks reads in flight instead of wall time; tests/load-retry.test.ts

This commit is contained in:
CRTkafa 2026-10-14 05:21:15 +08:00
parent 21fa91afd1
commit 918146d4a6
13 changed files with 261 additions and 96 deletions

View file

@ -7,17 +7,15 @@ import { afterAll, describe, expect, test } from 'bun:test';
import { readFileSync } from 'node:fs';
import { join } from 'node:path';
import { measureFonts } from '../cli/shots/glyphs';
import { AFTER_ALL_MS, launchTestBrowser, scaled } from './helpers/browser';
// eslint-disable-next-line @typescript-eslint/no-explicit-any
let browser: any = null;
let skipWhy = '';
try {
const { chromium } = await import('playwright-core');
try { browser = await chromium.launch({ headless: true }); } catch { browser = await chromium.launch({ headless: true, channel: 'chrome' }); }
} catch (e) { skipWhy = (e as Error).message.split('\n')[0]!; }
if (!browser) console.warn(`glyph ligature test skipped: no Chromium could launch (${skipWhy}). Run \`bunx playwright install chromium\`.`);
// one browser for the file, launched and killed by the shared helper (bounded, load-aware timeouts); tools/ci-plan.ts
// lists this file as HEAVY (the browser shard)
const shared = await launchTestBrowser('playwright-core');
const { browser, skipWhy } = shared;
if (!browser) console.warn(`glyph ligature test skipped: no Chromium installed (${skipWhy}). Run \`bunx playwright install chromium\`.`);
afterAll(async () => { await browser?.close(); }, 30_000);
afterAll(() => shared.close(), AFTER_ALL_MS);
const font = readFileSync(join(import.meta.dir, 'fixtures', 'fonts', 'montserrat-text-subset.woff2')).toString('base64');
const TEXT = 'Outfits, fit, office, affine';
@ -45,5 +43,5 @@ describe.skipIf(!browser)('shots font usage: ligatures', () => {
for (const m of measured) expect(Object.keys(m.faces)).toEqual(['Montserrat']);
expect(await page.evaluate("document.getElementById('sb-glyph-probes')")).toBeNull();
} finally { await page.close(); }
}, 30_000);
}, scaled(30_000));
});