|
1 | 1 | import { expect, test } from '@playwright/test'
|
2 |
| -import { useFixture } from './fixture' |
| 2 | +import { setupInlineFixture, useFixture, type Fixture } from './fixture' |
3 | 3 | import { defineStarterTest } from './starter'
|
4 |
| -import { waitForHydration } from './helper' |
| 4 | +import { expectNoPageError, waitForHydration } from './helper' |
5 | 5 |
|
6 | 6 | test.describe('dev-default', () => {
|
7 | 7 | const f = useFixture({ root: 'examples/starter', mode: 'dev' })
|
@@ -53,3 +53,44 @@ test.describe('build-development', () => {
|
53 | 53 | expect(output).toContain('jsxDEV')
|
54 | 54 | })
|
55 | 55 | })
|
| 56 | + |
| 57 | +test.describe('duplicate loadCss', () => { |
| 58 | + const root = 'examples/e2e/temp/duplicate-load-css' |
| 59 | + test.beforeAll(async () => { |
| 60 | + await setupInlineFixture({ |
| 61 | + src: 'examples/starter', |
| 62 | + dest: root, |
| 63 | + files: { |
| 64 | + 'src/root.tsx': { |
| 65 | + edit: (s) => |
| 66 | + s.replace( |
| 67 | + '</head>', |
| 68 | + () => |
| 69 | + `\ |
| 70 | +{import.meta.viteRsc.loadCss()} |
| 71 | +{import.meta.viteRsc.loadCss()} |
| 72 | +</head>`, |
| 73 | + ), |
| 74 | + }, |
| 75 | + }, |
| 76 | + }) |
| 77 | + }) |
| 78 | + |
| 79 | + test.describe('dev', () => { |
| 80 | + const f = useFixture({ root, mode: 'dev' }) |
| 81 | + defineTest(f) |
| 82 | + }) |
| 83 | + |
| 84 | + test.describe('build', () => { |
| 85 | + const f = useFixture({ root, mode: 'build' }) |
| 86 | + defineTest(f) |
| 87 | + }) |
| 88 | + |
| 89 | + function defineTest(f: Fixture) { |
| 90 | + test('basic', async ({ page }) => { |
| 91 | + using _ = expectNoPageError(page) |
| 92 | + await page.goto(f.url()) |
| 93 | + await waitForHydration(page) |
| 94 | + }) |
| 95 | + } |
| 96 | +}) |
0 commit comments