mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-30 23:32:38 +00:00
tests: refactor tests to use waitForResponse
This commit is contained in:
parent
76a267de4d
commit
b8c36774f5
@ -2679,12 +2679,14 @@ describe('lazy import components', () => {
|
||||
const component = await page.locator('#lazyevent')
|
||||
const rect = (await component.boundingBox())!
|
||||
await page.mouse.move(rect.x + rect.width / 2, rect.y + rect.height / 2)
|
||||
await page.waitForTimeout(500) // attempt a hard-coded delay to ensure event isn't triggered after network is idle
|
||||
await page.waitForLoadState('networkidle')
|
||||
await page.waitForResponse(response =>
|
||||
response.status() === 200 && response.text().then(text => text.includes("This shouldn't be visible at first with events!"))
|
||||
)
|
||||
expect(await page.locator('body').getByText('This shouldn\'t be visible at first with events!').all()).toHaveLength(1)
|
||||
await page.evaluate(() => window.scrollTo(0, document.body.scrollHeight))
|
||||
await page.waitForTimeout(1000) // attempt a hard-coded delay to ensure IO isn't triggered after network is idle
|
||||
await page.waitForLoadState('networkidle')
|
||||
await page.waitForResponse(response =>
|
||||
response.status() === 200 && response.text().then(text => text.includes("This shouldn't be visible at first with viewport!"))
|
||||
)
|
||||
expect(await page.locator('body').getByText('This shouldn\'t be visible at first with viewport!').all()).toHaveLength(1)
|
||||
})
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user