pcbjam/tests/e2e/boot.spec.ts
Viktor Vaczi 249010a582 feat(wasm-dom): dual-mode build scaffold — native DOM port builds, links and boots alongside canvas
Build/test plumbing for the second wxWidgets mode: --dom on
build-wxuniversal-wasm.sh (build-wasm/wxwidgets-dom, no universal,
--disable-tooltips, libwx_wasmu_* stubs) and build-wasm-test.sh
(mirrors sources into tests/apps-dom, PORT=dom). Build script now
reconfigures when Makefile.in or autoconf_inc.m4 regenerate (bakefile
chain). Harness: WX_PORT=dom serves apps-dom, namespaces screenshots
into test-results/dom and logs into logs/wxwidgets/dom; compare/update
screenshot scripts take --port dom with baseline-screenshots-dom.
New port-agnostic boot.spec.ts (green on both ports).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-12 20:17:09 +02:00

31 lines
1.1 KiB
TypeScript

import { test, expect, waitForApp } from './utils/fixtures';
// Port-agnostic boot check: the app starts, the wx element registry fills,
// and (in DOM mode) the wx-dom shim is present. Runs under both WX_PORT
// values; intentionally takes no screenshots.
test.describe('Application boot', () => {
test('minimal app boots and registers elements', async ({ page, testLogger }) => {
const fatal: string[] = [];
page.on('pageerror', (err) => fatal.push(String(err)));
await page.goto('/minimal_test.html');
await waitForApp(page);
// The registry fills as wx windows are created.
await page.waitForFunction(
() => (window as any).wxElementRegistry?.elements?.size > 0,
undefined,
{ timeout: 30000 }
);
const elementCount = await page.evaluate(
() => (window as any).wxElementRegistry.elements.size
);
expect(elementCount).toBeGreaterThan(0);
const isDomPort = await page.evaluate(() => (window as any).wxDomPort === true);
expect(isDomPort).toBe(process.env.WX_PORT === 'dom');
expect(fatal, `page errors: ${fatal.join('\n')}`).toHaveLength(0);
});
});