Skip to content

Commit

Permalink
test: start listening for requests earlier (#24985)
Browse files Browse the repository at this point in the history
  • Loading branch information
huang-julien committed Jan 1, 2024
1 parent 5d22f8f commit 4d40e2e
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions test/basic.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1459,21 +1459,23 @@ describe.skipIf(isDev() || isWebpack)('inlining component styles', () => {
describe('server components/islands', () => {
it('/islands', async () => {
const { page } = await renderPage('/islands')
const islandRequest = page.waitForResponse(response => response.url().includes('/__nuxt_island/') && response.status() === 200)
await page.locator('#increase-pure-component').click()
await page.waitForResponse(response => response.url().includes('/__nuxt_island/') && response.status() === 200)

await islandRequest
await page.locator('#slot-in-server').getByText('Slot with in .server component').waitFor()
await page.locator('#test-slot').getByText('Slot with name test').waitFor()

// test fallback slot with v-for
expect(await page.locator('.fallback-slot-content').all()).toHaveLength(2)
// test islands update
expect(await page.locator('.box').innerHTML()).toContain('"number": 101,')
await page.locator('#update-server-components').click()
await Promise.all([
const requests = [
page.waitForResponse(response => response.url().includes('/__nuxt_island/LongAsyncComponent') && response.status() === 200),
page.waitForResponse(response => response.url().includes('/__nuxt_island/AsyncServerComponent') && response.status() === 200)
])
]
await page.locator('#update-server-components').click()
await Promise.all(requests)

await page.locator('#async-server-component-count').getByText('1').waitFor()
await page.locator('#long-async-component-count').getByText('1').waitFor()
Expand Down Expand Up @@ -1958,11 +1960,12 @@ describe('component islands', () => {

// test islands update
expect(await page.locator('.box').innerHTML()).toContain('"number": 101,')
await page.locator('#update-server-components').click()
await Promise.all([
const islandRequests = [
page.waitForResponse(response => response.url().includes('/__nuxt_island/LongAsyncComponent') && response.status() === 200),
page.waitForResponse(response => response.url().includes('/__nuxt_island/AsyncServerComponent') && response.status() === 200)
])
]
await page.locator('#update-server-components').click()
await Promise.all(islandRequests)

await page.locator('#long-async-component-count').getByText('1').waitFor()

Expand Down

0 comments on commit 4d40e2e

Please sign in to comment.