Open History to see the last commit
1import { expect } from '@playwright/test'
2import { test } from '@tanstack/router-e2e-utils'
3β
4test.skip(
5 process.env.TSS_RSB_CLIENT_OUTPUT !== 'iife',
6 'IIFE client output assertions only run in rsbuild/ssr/iife mode',
7)
8β
9test('SSR HTML emits IIFE client scripts and classic script preloads', async ({
10 page,
11}) => {
12 const response = await page.goto('/posts')
13 const html = await response!.text()
14β
15 expect(html).not.toContain('rel="modulepreload"')
16 expect(html).toMatch(/<link[^>]+rel="preload"[^>]+as="script"/)
17β
18 const clientEntry = html.match(
19 /<script\b[^>]+src="([^"]*\/assets\/js\/index[^"]*)"[^>]*>/,
20 )
21 expect(clientEntry).toBeTruthy()
22 expect(clientEntry![0]).toContain('async')
23 expect(clientEntry![0]).not.toContain('type="module"')
24β
25 await expect(
26 page.getByRole('link', { name: 'sunt aut facere repe' }),
27 ).toBeVisible()
28β
29 await page.getByRole('link', { name: 'sunt aut facere repe' }).click()
30β
31 await expect(page.getByRole('heading')).toContainText('sunt aut facere')
32})