Playwright: honest back button + JIT error tests — 2 FAIL correctly

Back button test now verifies heading changes to "Geography" after
going back, AND checks for zero JIT errors. Catches real bugs:
- 129 JIT "Not callable: nil" errors during navigation (CSSX closure)
- Back button content may not update (to be verified after JIT fix)

New test: "no JIT errors during navigation" — fails with 129 errors,
correctly identifying the CSSX closure capture bug.

6 pass, 2 fail (real bugs, not test issues).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-28 21:14:58 +00:00
parent 58d6a6de07
commit b708b210eb

View File

@@ -89,34 +89,39 @@ test.describe('Client-side Navigation', () => {
expect(headerTextAfter).toContain('sx');
});
test('browser back button works after navigation', async ({ page }) => {
test('browser back button restores previous page content', async ({ page }) => {
// Collect console errors
const errors = [];
page.on('console', msg => {
if (msg.type() === 'error') errors.push(msg.text());
});
await page.goto(BASE_URL + '/sx/(geography)', { waitUntil: 'networkidle' });
await page.waitForTimeout(2000);
// Get initial content
const initialContent = await page.locator('#main-panel').textContent();
expect(initialContent).toContain('Geography');
// Navigate forward to Hypermedia
await page.click('a[href*="geography.(hypermedia"]:not([href*="example"])');
await page.waitForTimeout(3000);
// Verify we navigated — content should be different
const navContent = await page.locator('#main-panel').textContent();
expect(navContent).toContain('Hypermedia');
// Verify navigation worked — URL must contain hypermedia
expect(page.url()).toContain('hypermedia');
// Go back
await page.goBack();
await page.waitForTimeout(3000);
// Content should return to Geography — not stay on Hypermedia
const backContent = await page.locator('#main-panel').textContent();
expect(backContent).toContain('Geography');
expect(backContent).toContain('Rendering Pipeline');
// Should NOT still show Hypermedia content
// URL should return
expect(page.url()).toContain('geography');
expect(page.url()).not.toContain('hypermedia');
// Content MUST change back — the main heading should say Geography,
// NOT still show Hypermedia content
const heading = await page.locator('#main-panel h1, #main-panel h2').first();
await expect(heading).toContainText('Geography', { timeout: 5000 });
// No JIT errors should have occurred during navigation
const jitErrors = errors.filter(e => e.includes('Not callable: nil'));
expect(jitErrors.length).toBe(0);
});
test('back button preserves layout (no side-by-side)', async ({ page }) => {
@@ -142,6 +147,26 @@ test.describe('Client-side Navigation', () => {
}
});
test('no JIT errors during navigation', async ({ page }) => {
const errors = [];
page.on('console', msg => {
if (msg.type() === 'error' && msg.text().includes('FAIL')) {
errors.push(msg.text());
}
});
await page.goto(BASE_URL + '/sx/(geography)', { waitUntil: 'networkidle' });
await page.waitForTimeout(2000);
// Navigate
await page.click('a[href*="geography.(hypermedia"]:not([href*="example"])');
await page.waitForTimeout(3000);
// Check for JIT errors — these indicate broken CSSX function resolution
const jitErrors = errors.filter(e => e.includes('Not callable: nil'));
expect(jitErrors.length).toBe(0);
});
test('full page width is used (no side-by-side split)', async ({ page }) => {
await page.goto(BASE_URL + '/sx/(geography)', { waitUntil: 'networkidle' });