mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-22 13:45:18 +00:00
test: remove wait for networkidle
This commit is contained in:
parent
f9fe282506
commit
9b5bffbbb4
@ -199,13 +199,14 @@ describe('pages', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('should render correctly when loaded on a different path', async () => {
|
it('should render correctly when loaded on a different path', async () => {
|
||||||
const { page, pageErrors } = await renderPage('/proxy')
|
const { page, pageErrors } = await renderPage()
|
||||||
|
await page.goto(url('/proxy'))
|
||||||
|
await page.waitForFunction(() => window.useNuxtApp?.() && !window.useNuxtApp?.().isHydrating)
|
||||||
|
|
||||||
expect(await page.innerText('body')).toContain('Composable | foo: auto imported from ~/composables/foo.ts')
|
expect(await page.innerText('body')).toContain('Composable | foo: auto imported from ~/composables/foo.ts')
|
||||||
|
expect(pageErrors).toEqual([])
|
||||||
|
|
||||||
await page.close()
|
await page.close()
|
||||||
|
|
||||||
expect(pageErrors).toEqual([])
|
|
||||||
})
|
})
|
||||||
|
|
||||||
it('preserves query', async () => {
|
it('preserves query', async () => {
|
||||||
@ -1309,7 +1310,8 @@ describe('deferred app suspense resolve', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('should fully hydrate even if there is a redirection on a page with `ssr: false`', async () => {
|
it('should fully hydrate even if there is a redirection on a page with `ssr: false`', async () => {
|
||||||
const { page } = await renderPage('/hydration/spa-redirection/start')
|
const { page } = await renderPage()
|
||||||
|
await page.goto(url('/hydration/spa-redirection/start'))
|
||||||
await page.getByText('fully hydrated and ready to go').waitFor()
|
await page.getByText('fully hydrated and ready to go').waitFor()
|
||||||
await page.close()
|
await page.close()
|
||||||
})
|
})
|
||||||
@ -1641,7 +1643,7 @@ describe('server components/islands', () => {
|
|||||||
// test fallback slot with v-for
|
// test fallback slot with v-for
|
||||||
expect(await page.locator('.fallback-slot-content').all()).toHaveLength(2)
|
expect(await page.locator('.fallback-slot-content').all()).toHaveLength(2)
|
||||||
// test islands update
|
// test islands update
|
||||||
expect(await page.locator('.box').innerHTML()).toContain('"number": 101,')
|
await page.locator('.box').getByText('"number": 101,').waitFor()
|
||||||
const requests = [
|
const requests = [
|
||||||
page.waitForResponse(response => response.url().includes('/__nuxt_island/LongAsyncComponent') && response.status() === 200),
|
page.waitForResponse(response => response.url().includes('/__nuxt_island/LongAsyncComponent') && response.status() === 200),
|
||||||
page.waitForResponse(response => response.url().includes('/__nuxt_island/AsyncServerComponent') && response.status() === 200)
|
page.waitForResponse(response => response.url().includes('/__nuxt_island/AsyncServerComponent') && response.status() === 200)
|
||||||
|
@ -38,8 +38,7 @@ export async function renderPage (path = '/') {
|
|||||||
})
|
})
|
||||||
|
|
||||||
if (path) {
|
if (path) {
|
||||||
await page.goto(url(path), { waitUntil: 'networkidle' })
|
await gotoPath(page, path)
|
||||||
await page.waitForFunction(() => window.useNuxtApp?.())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@ -70,7 +69,7 @@ export async function expectNoClientErrors (path: string) {
|
|||||||
|
|
||||||
export async function gotoPath (page: Page, path: string) {
|
export async function gotoPath (page: Page, path: string) {
|
||||||
await page.goto(url(path))
|
await page.goto(url(path))
|
||||||
await page.waitForFunction(path => window.useNuxtApp?.()._route.fullPath === path, path)
|
await page.waitForFunction(path => window.useNuxtApp?.()._route.fullPath === path && !window.useNuxtApp?.().isHydrating, path)
|
||||||
}
|
}
|
||||||
|
|
||||||
type EqualityVal = string | number | boolean | null | undefined | RegExp
|
type EqualityVal = string | number | boolean | null | undefined | RegExp
|
||||||
|
Loading…
Reference in New Issue
Block a user