mirror of
https://github.com/Matysh/houseplan-card
synced 2026-09-29 03:09:36 +00:00
test: validate comparison bundles against their own trees
Issue: #322 User-Visible: no
This commit is contained in:
@@ -87,7 +87,7 @@ const viewport = { width: 1280, height: 900 };
|
||||
const { page, browser } = await launch(
|
||||
viewport, 1,
|
||||
['--enable-precise-memory-info', '--js-flags=--expose-gc'],
|
||||
{}, resolve(targetRoot, 'demo/srv'),
|
||||
{}, resolve(targetRoot, 'demo/srv'), targetRoot,
|
||||
);
|
||||
await page.addScriptTag({
|
||||
content: `window.__hpAssertCardContract = ${assertCardContract.toString()};`,
|
||||
|
||||
@@ -43,6 +43,7 @@ const { page, browser } = await launch(
|
||||
['--enable-precise-memory-info', '--js-flags=--expose-gc'],
|
||||
{},
|
||||
resolve(targetRoot, 'demo/srv'),
|
||||
targetRoot,
|
||||
);
|
||||
await page.emulateMedia({ reducedMotion: 'reduce' });
|
||||
await page.addStyleTag({
|
||||
|
||||
+2
-1
@@ -50,6 +50,7 @@ export async function launch(
|
||||
browserArgs = [],
|
||||
contextOptions = {},
|
||||
serveRoot = ROOT,
|
||||
repoRoot = REPO_ROOT,
|
||||
) {
|
||||
const browser = await chromium.launch({ args: ['--no-sandbox', ...browserArgs] });
|
||||
const page = await (await browser.newContext({
|
||||
@@ -75,7 +76,7 @@ export async function launch(
|
||||
// круга разбора: три проверки упали, четвёртая ложно прошла, поскольку старый
|
||||
// код одинаково врал в двух местах, которые сверялись друг с другом.
|
||||
// golden и бенчмарки эту защиту имели с самого начала, смоки — нет.
|
||||
await assertFreshDemoBundleUnlessAllowed(page, REPO_ROOT);
|
||||
await assertFreshDemoBundleUnlessAllowed(page, repoRoot);
|
||||
// HP-1552: the first-open boot veil hides the plan (visibility:hidden) until
|
||||
// the stage height settles — real pointer interaction cannot hit a hidden
|
||||
// plan, so every smoke starts where the user does: with the plan revealed.
|
||||
|
||||
+3
-1
@@ -158,7 +158,9 @@ limits. See
|
||||
When the comparison base predates `scripts/bundle-sync.mjs`, the workflow still
|
||||
builds that exact tree and materializes its fresh bundle through the equivalent
|
||||
legacy copy path. This keeps old stable releases usable as performance baselines
|
||||
without borrowing build output from the candidate.
|
||||
without borrowing build output from the candidate. Comparative benchmark
|
||||
launches also pass that target tree as the freshness authority; the ordinary
|
||||
smoke launcher continues to default to the current repository root.
|
||||
Both browser diagnostics require a freshly built/copied demo bundle. Rollup
|
||||
embeds a SHA-256 fingerprint of `src/` plus the locked package and
|
||||
Rollup/TypeScript build inputs; benchmark/golden runners fail before
|
||||
|
||||
@@ -123,6 +123,14 @@ test('the smoke launcher enforces the gate on the repository root (#236)', async
|
||||
const source = readFileSync(
|
||||
new URL('../demo/serve.mjs', import.meta.url), 'utf8',
|
||||
);
|
||||
assert.match(source, /assertFreshDemoBundleUnlessAllowed\(page, REPO_ROOT\)/);
|
||||
assert.match(source, /repoRoot = REPO_ROOT/);
|
||||
assert.match(source, /assertFreshDemoBundleUnlessAllowed\(page, repoRoot\)/);
|
||||
assert.match(source, /const REPO_ROOT = dirname\(dirname\(/);
|
||||
});
|
||||
|
||||
test('comparative benchmarks pass the target repository root to the launcher', () => {
|
||||
for (const file of ['benchmark_large_house.mjs', 'benchmark_glow.mjs']) {
|
||||
const source = readFileSync(new URL(`../demo/${file}`, import.meta.url), 'utf8');
|
||||
assert.match(source, /resolve\(targetRoot, 'demo\/srv'\)[\s\S]{0,40}targetRoot/);
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user