Skip to content

Commit d7fcdd8

Browse files
authored
test(rsc): add more basic tests to starter (#600)
1 parent b550b63 commit d7fcdd8

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

packages/plugin-rsc/e2e/starter.test.ts

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,24 @@ function defineTest(f: Fixture, variant?: 'no-ssr') {
110110
await page.getByRole('button', { name: 'Client Counter: 0' }).click()
111111
})
112112

113+
test.describe(() => {
114+
test.skip(f.mode === 'build')
115+
116+
test('server hmr', async ({ page }) => {
117+
await page.goto(f.url())
118+
await waitForHydration(page)
119+
await using _ = await expectNoReload(page)
120+
await expect(page.getByText('Vite + RSC')).toBeVisible()
121+
const editor = f.createEditor('src/root.tsx')
122+
editor.edit((s) =>
123+
s.replace('<h1>Vite + RSC</h1>', '<h1>Vite x RSC</h1>'),
124+
)
125+
await expect(page.getByText('Vite x RSC')).toBeVisible()
126+
editor.reset()
127+
await expect(page.getByText('Vite + RSC')).toBeVisible()
128+
})
129+
})
130+
113131
test('image assets', async ({ page }) => {
114132
await page.goto(f.url())
115133
await waitForHydration(page)
@@ -122,4 +140,25 @@ function defineTest(f: Fixture, variant?: 'no-ssr') {
122140
0,
123141
)
124142
})
143+
144+
test('css @js', async ({ page }) => {
145+
await page.goto(f.url())
146+
await waitForHydration(page)
147+
await expect(page.locator('.read-the-docs')).toHaveCSS(
148+
'color',
149+
'rgb(136, 136, 136)',
150+
)
151+
})
152+
153+
test.describe(() => {
154+
test.skip(variant === 'no-ssr')
155+
156+
testNoJs('css @nojs', async ({ page }) => {
157+
await page.goto(f.url())
158+
await expect(page.locator('.read-the-docs')).toHaveCSS(
159+
'color',
160+
'rgb(136, 136, 136)',
161+
)
162+
})
163+
})
125164
}

0 commit comments

Comments
 (0)