Make the Playwright e2e + kicad suites deterministic so screenshot flake stops tracing to timing races. - Blind page.waitForTimeout -> condition waits (expect.poll, web-first assertions, waitUntil) + readiness helpers (waitForWxApp, waitForCanvasApp). Remaining sleeps are documented interaction dwells (annotated). - Defensive "if element exists" branches -> loud asserts; label-fallback chains -> normalized clickMenuItemByText. First-run wizard for/if loops removed by seeding calculator/gerbview/pcbnew HTMLs. - Screenshots: new stableShot(page, name) settles the render in-page (canvas hash over rAF) then writes a raw PNG to test-results/ for the existing offline gate (tools/screenshots vs baseline-screenshots). Replaces toHaveScreenshot, which did inline compare + its own baselines and had decoupled the specs from the real gate. scale:'css' pinned. - retries: 0 in both configs. - Guard: tests/tools/lint-determinism.ts (npm run lint:determinism) bans blind sleeps / toHaveScreenshot / inline retries / swallowed catches in specs; documented exceptions carry a marker. Rules in tests/TESTING.md. Assertions, coverage, and renders unchanged (semantic-equivalence reviewed; captures pixel-identical modulo inherent timer/timestamp/3d-raytrace variance). Both suites green at retries:0 (e2e 340, kicad 92); ~35-61% faster. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BVX1pHMvRPYHdp6ZfEawrk
65 lines
2.6 KiB
TypeScript
65 lines
2.6 KiB
TypeScript
// wxCollapsiblePane Tests - Collapsible sections for property panels
|
|
import { test, expect, waitForWxApp } from './utils/fixtures';
|
|
import { clickByLabel, stableShot } from './utils/element-tracker';
|
|
|
|
test.describe('wxCollapsiblePane Tests', () => {
|
|
|
|
test('Collapsible test app loads successfully', async ({ page, testLogger }) => {
|
|
await page.goto('/standalone/collapsible/collapsible_test.html');
|
|
await waitForWxApp(page);
|
|
|
|
await stableShot(page, 'collapsible-01-loaded.png', { fullPage: true });
|
|
|
|
expect(testLogger.errors.filter(e => !e.includes('favicon'))).toHaveLength(0);
|
|
});
|
|
|
|
test('Collapsible panes are created', async ({ page, testLogger }) => {
|
|
await page.goto('/standalone/collapsible/collapsible_test.html');
|
|
await waitForWxApp(page);
|
|
|
|
await expect.poll(() => testLogger.consoleLogs.some(l =>
|
|
l.includes('3 collapsible sections') || l.includes('CollapsiblePane test app')),
|
|
{ message: 'Collapsible panes should be created' }).toBe(true);
|
|
|
|
await stableShot(page, 'collapsible-02-panes.png', { fullPage: true });
|
|
});
|
|
|
|
test('First pane is expanded by default', async ({ page, testLogger }) => {
|
|
await page.goto('/standalone/collapsible/collapsible_test.html');
|
|
await waitForWxApp(page);
|
|
|
|
// First pane should be expanded showing content
|
|
await stableShot(page, 'collapsible-03-expanded.png', { fullPage: true });
|
|
});
|
|
|
|
test('Expand All button works', async ({ page, testLogger }) => {
|
|
await page.goto('/standalone/collapsible/collapsible_test.html');
|
|
await waitForWxApp(page);
|
|
|
|
// Click Expand All button using element registry
|
|
const clicked = await clickByLabel(page, 'Expand All');
|
|
expect(clicked, 'Expand All button should be found and clicked').toBe(true);
|
|
|
|
await expect.poll(() => testLogger.consoleLogs.some(l =>
|
|
l.includes('All panes expanded') || l.includes('expanded')),
|
|
{ message: 'Expand All should log expansion' }).toBe(true);
|
|
|
|
await stableShot(page, 'collapsible-04-expand-all.png', { fullPage: true });
|
|
});
|
|
|
|
test('Collapse All button works', async ({ page, testLogger }) => {
|
|
await page.goto('/standalone/collapsible/collapsible_test.html');
|
|
await waitForWxApp(page);
|
|
|
|
// Click Collapse All button using element registry
|
|
const clicked = await clickByLabel(page, 'Collapse All');
|
|
expect(clicked, 'Collapse All button should be found and clicked').toBe(true);
|
|
|
|
await expect.poll(() => testLogger.consoleLogs.some(l =>
|
|
l.includes('All panes collapsed') || l.includes('collapsed')),
|
|
{ message: 'Collapse All should log collapse' }).toBe(true);
|
|
|
|
await stableShot(page, 'collapsible-05-collapse-all.png', { fullPage: true });
|
|
});
|
|
|
|
});
|