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>
This commit is contained in:
parent
14ca16cbd3
commit
249010a582
10 changed files with 205 additions and 29 deletions
|
|
@ -2,10 +2,31 @@ import { test as base } from '@playwright/test';
|
|||
import * as path from 'path';
|
||||
import { setupTestLogger, writeTestLogs, TestLogger, MAIN_CANVAS, waitForApp, tryLoadApp, getCanvasBox, WXWIDGETS_LOGS_DIR, getTestFileName } from './test-utils';
|
||||
|
||||
// WX_PORT=dom runs the same specs against the DOM-port bundles; screenshots
|
||||
// and logs are namespaced into a dom/ subdirectory so the canvas artifacts
|
||||
// stay untouched (baselines: tests/baseline-screenshots-dom/).
|
||||
const IS_DOM_PORT = process.env.WX_PORT === 'dom';
|
||||
|
||||
// Extend base test with automatic logging
|
||||
export const test = base.extend<{
|
||||
testLogger: TestLogger;
|
||||
}>({
|
||||
page: async ({ page }, use) => {
|
||||
if (IS_DOM_PORT) {
|
||||
const origScreenshot = page.screenshot.bind(page);
|
||||
page.screenshot = ((options?: Parameters<typeof origScreenshot>[0]) => {
|
||||
if (options?.path) {
|
||||
const dir = path.dirname(options.path);
|
||||
// Specs write to test-results/<name>.png; redirect to test-results/dom/.
|
||||
if (path.basename(dir) === 'test-results') {
|
||||
options = { ...options, path: path.join(dir, 'dom', path.basename(options.path)) };
|
||||
}
|
||||
}
|
||||
return origScreenshot(options);
|
||||
}) as typeof page.screenshot;
|
||||
}
|
||||
await use(page);
|
||||
},
|
||||
testLogger: async ({ page }, use, testInfo) => {
|
||||
// Build test name from describe block + test title
|
||||
const testName = testInfo.titlePath.join(' - ');
|
||||
|
|
@ -14,9 +35,11 @@ export const test = base.extend<{
|
|||
|
||||
await use(logger);
|
||||
|
||||
// Write logs to wxwidgets/<test-file>/ directory
|
||||
// Write logs to wxwidgets/<test-file>/ directory (wxwidgets/dom/<test-file>/ for the DOM port)
|
||||
const testFileName = getTestFileName(testInfo.file);
|
||||
const logsDir = path.join(WXWIDGETS_LOGS_DIR, testFileName);
|
||||
const logsDir = IS_DOM_PORT
|
||||
? path.join(WXWIDGETS_LOGS_DIR, 'dom', testFileName)
|
||||
: path.join(WXWIDGETS_LOGS_DIR, testFileName);
|
||||
writeTestLogs(testName, logger, logsDir);
|
||||
logger.cleanup();
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in a new issue