chore: attempt hard coded await for event

This commit is contained in:
Michael Brevard 2024-06-15 14:18:46 +03:00 committed by GitHub
parent cf9a905993
commit 76a267de4d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2679,6 +2679,7 @@ describe('lazy import components', () => {
const component = await page.locator('#lazyevent') const component = await page.locator('#lazyevent')
const rect = (await component.boundingBox())! const rect = (await component.boundingBox())!
await page.mouse.move(rect.x + rect.width / 2, rect.y + rect.height / 2) 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.waitForLoadState('networkidle')
expect(await page.locator('body').getByText('This shouldn\'t be visible at first with events!').all()).toHaveLength(1) 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.evaluate(() => window.scrollTo(0, document.body.scrollHeight))