JIT compiler: - Fix jit_compile_lambda: resolve `compile` via symbol lookup in env instead of embedding VmClosure in AST (CEK dispatches differently) - Register eval-defcomp/eval-defisland/eval-defmacro runtime helpers in browser kernel for bytecoded defcomp forms - Disable broken .sxbc.json path (missing arity in nested code blocks), use .sxbc text format only - Mark JIT-failed closures as sentinel to stop retrying CSSX in browser: - Add cssx.sx symlink + cssx.sxbc to browser web stack - Add flush-cssx! to orchestration.sx post-swap for SPA nav - Add cssx.sx to compile-modules.js and mcp_tree.ml bytecode lists SPA navigation: - Fix double-fetch: check e.defaultPrevented in click delegation (bind-event already handled the click) - Fix layout destruction: change nav links from outerHTML to innerHTML swap (outerHTML destroyed #main-panel when response lacked it) - Guard JS popstate handler when SX engine is booted - Rename sx-platform.js → sx-platform-2.js to bust immutable cache Playwright tests: - Add trackErrors() helper to all test specs - Add SPA DOM comparison test (SPA nav vs fresh load) - Add single-fetch + no-duplicate-elements test - Improve MCP tool output: show failure details and error messages Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
46 lines
1.3 KiB
JavaScript
46 lines
1.3 KiB
JavaScript
// Shared helpers for Playwright tests
|
|
|
|
const BASE_URL = process.env.SX_TEST_URL || 'http://localhost:8013';
|
|
|
|
/**
|
|
* Wait for the SX runtime to finish hydration.
|
|
* boot-init sets data-sx-ready="true" on <html> after all islands are hydrated.
|
|
*/
|
|
async function waitForSxReady(page, timeout = 15000) {
|
|
await page.waitForSelector('html[data-sx-ready]', { timeout });
|
|
}
|
|
|
|
/**
|
|
* Navigate to an SX page and wait for hydration to complete.
|
|
* Replaces the old pattern of networkidle + arbitrary sleep.
|
|
*/
|
|
async function loadPage(page, path, timeout = 15000) {
|
|
await page.goto(BASE_URL + '/sx/' + path, { waitUntil: 'domcontentloaded', timeout });
|
|
await waitForSxReady(page);
|
|
}
|
|
|
|
/**
|
|
* Track console errors and uncaught exceptions on a page.
|
|
* Call before navigation. Use errors() to get filtered error list.
|
|
*/
|
|
function trackErrors(page) {
|
|
const raw = [];
|
|
page.on('pageerror', err => raw.push(err.message));
|
|
page.on('console', msg => {
|
|
if (msg.type() === 'error') raw.push(msg.text());
|
|
});
|
|
return {
|
|
/** Return errors, filtering transient network noise. */
|
|
errors() {
|
|
return raw.filter(e =>
|
|
!e.includes('Failed to fetch') &&
|
|
!e.includes('net::ERR') &&
|
|
!e.includes(' 404 ') &&
|
|
!e.includes('Failed to load resource')
|
|
);
|
|
}
|
|
};
|
|
}
|
|
|
|
module.exports = { BASE_URL, waitForSxReady, loadPage, trackErrors };
|