// Island SSR tests — verify islands render content server-side // These tests disable JavaScript to verify pure SSR output. const { test, expect } = require('playwright/test'); const BASE_URL = process.env.SX_TEST_URL || 'http://localhost:8013'; test.describe('Island SSR', () => { test('header island renders logo and tagline without JavaScript', async ({ browser }) => { const context = await browser.newContext({ javaScriptEnabled: false }); const page = await context.newPage(); await page.goto(BASE_URL + '/sx/(geography)', { waitUntil: 'domcontentloaded' }); // The header island should contain rendered HTML, not empty const header = page.locator('[data-sx-island="layouts/header"]'); await expect(header).not.toBeEmpty(); // Should contain the logo text const headerText = await header.textContent(); expect(headerText).toContain('sx'); // Should contain the tagline expect(headerText).toContain('reactive'); // Should contain copyright expect(headerText).toContain('Giles Bradshaw'); await context.close(); }); test('header island has styled elements without JavaScript', async ({ browser }) => { const context = await browser.newContext({ javaScriptEnabled: false }); const page = await context.newPage(); await page.goto(BASE_URL + '/sx/(geography)', { waitUntil: 'domcontentloaded' }); // The header should have actual HTML elements, not raw SX text const header = page.locator('[data-sx-island="layouts/header"]'); const links = await header.locator('a').count(); expect(links).toBeGreaterThan(0); // Should NOT contain raw SX calls const text = await header.textContent(); expect(text).not.toContain('(~'); expect(text).not.toContain(':tokens'); await context.close(); }); test('home stepper island renders content without JavaScript', async ({ browser }) => { const context = await browser.newContext({ javaScriptEnabled: false }); const page = await context.newPage(); await page.goto(BASE_URL + '/sx/', { waitUntil: 'domcontentloaded' }); // The stepper island should contain rendered HTML const stepper = page.locator('[data-sx-island="home/stepper"]'); await expect(stepper).not.toBeEmpty(); // Should have actual content — not be 0 bytes const html = await stepper.innerHTML(); expect(html.length).toBeGreaterThan(10); // SSR should produce actual HTML elements, not raw SX // The stepper has a code-view div with styled spans expect(html).toContain('