host/tests: Phase 2 — trim Playwright to a boot smoke
The picker's per-behaviour browser tests are now SX engine tests
(web/tests/test-relate-picker.sx) + SX conformance (lib/host/tests/blog.sx), so
delete them from Playwright and keep only what needs a real boosted-SPA browser:
spa-check.spec.js (3): WASM kernel boots + loads modules CONTENT-ADDRESSED
(/sx/h/{hash} fetches, zero path-.sxbc fallback — new assertion) + marks
ready; a boosted nav fragment-swaps #content (raw! HTML path); back/re-boost.
relate-picker.spec.js (2): the bind-boost-form remove button; the picker
re-binds its load trigger on content brought in by a boosted SPA nav.
Net: 11 browser tests -> 5. Both ephemeral-host suites verified green
(run-spa-check.sh 3/3, run-picker-check.sh 2/2).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -17,8 +17,18 @@ async function waitReady(page) {
|
||||
const POSTLINK = '#content a[href$="/"]';
|
||||
|
||||
test.describe('blog SPA', () => {
|
||||
test('WASM kernel boots and marks the document ready', async ({ page }) => {
|
||||
test('WASM kernel boots, loads modules content-addressed, marks ready', async ({ page }) => {
|
||||
const errors = [];
|
||||
// Track web-stack module fetches: content-addressed (/sx/h/{hash}) vs the
|
||||
// path-based .sxbc fallback. A correctly-booting client takes ONLY the
|
||||
// content-addressed branch (immutable, localStorage-cached).
|
||||
const caFetches = []; // /sx/h/{hash}
|
||||
const pathSxbc = []; // *.sxbc by path (the fallback — should not happen)
|
||||
page.on('request', (r) => {
|
||||
const u = r.url();
|
||||
if (u.includes('/sx/h/')) caFetches.push(u);
|
||||
else if (/\.sxbc(\?|$)/.test(u)) pathSxbc.push(u);
|
||||
});
|
||||
page.on('console', (m) => { if (m.type() === 'error') errors.push(m.text()); });
|
||||
page.on('pageerror', (e) => errors.push(String(e)));
|
||||
await page.goto('/');
|
||||
@@ -26,19 +36,13 @@ test.describe('blog SPA', () => {
|
||||
// the shell shipped the WASM loaders
|
||||
expect(await page.locator('script[src*="sx_browser.bc.wasm.js"]').count()).toBe(1);
|
||||
expect(await page.locator('script[src*="sx-platform.js"]').count()).toBe(1);
|
||||
// modules loaded by content hash, with no path-.sxbc fallback fetches
|
||||
expect(caFetches.length, 'expected content-addressed /sx/h/ module fetches').toBeGreaterThan(0);
|
||||
expect(pathSxbc, `path-based .sxbc fallback fetched:\n${pathSxbc.join('\n')}`).toEqual([]);
|
||||
// no boot-time JS errors
|
||||
expect(errors, errors.join('\n')).toEqual([]);
|
||||
});
|
||||
|
||||
test('links inside #content get boosted', async ({ page }) => {
|
||||
await page.goto('/');
|
||||
await waitReady(page);
|
||||
// the engine marks a boosted link with the _sxBoundboost JS property
|
||||
await expect
|
||||
.poll(() => page.locator(POSTLINK).first().evaluate((a) => !!a._sxBoundboost), { timeout: 15000 })
|
||||
.toBe(true);
|
||||
});
|
||||
|
||||
test('clicking a link does a fragment swap — no full reload, URL updates', async ({ page }) => {
|
||||
await page.goto('/');
|
||||
await waitReady(page);
|
||||
|
||||
Reference in New Issue
Block a user