test: add default override test

This commit is contained in:
Michael Brevard 2024-06-16 19:51:37 +03:00 committed by GitHub
parent 794f46114f
commit d54e58dc44
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2690,9 +2690,15 @@ describe('lazy import components', () => {
expect(await page.locator('body').getByText('This shouldn\'t be visible at first with viewport!').all()).toHaveLength(1) expect(await page.locator('body').getByText('This shouldn\'t be visible at first with viewport!').all()).toHaveLength(1)
}) })
it('respects custom delayed hydration triggers', async () => { it('respects custom delayed hydration triggers and overrides defaults', async () => {
const { page } = await renderPage('/lazy-import-components') const { page } = await renderPage('/lazy-import-components')
await page.waitForLoadState('networkidle') await page.waitForLoadState('networkidle')
const component = await page.locator('#lazyevent2')
const rect = (await component.boundingBox())!
await page.mouse.move(rect.x + rect.width / 2, rect.y + rect.height / 2)
await page.waitForTimeout(500)
await page.waitForLoadState('networkidle')
expect(await page.locator('body').getByText('This should be visible at first with events!').all()).toHaveLength(2)
const resp = page.waitForResponse(response => const resp = page.waitForResponse(response =>
response.status() === 200 && response.text().then(text => text.includes('This shouldn\'t be visible at first with events!')), response.status() === 200 && response.text().then(text => text.includes('This shouldn\'t be visible at first with events!')),
) )