From e068873e6e834b6a61e35188f67e189ef8105a46 Mon Sep 17 00:00:00 2001 From: Michael Brevard Date: Fri, 13 Sep 2024 13:01:03 +0300 Subject: [PATCH] test: add grace period for intersection observer --- test/basic.test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/basic.test.ts b/test/basic.test.ts index 31cbc06a3..8804e4a65 100644 --- a/test/basic.test.ts +++ b/test/basic.test.ts @@ -2786,8 +2786,8 @@ describe('lazy import components', () => { await page.waitForLoadState('networkidle') expect(await page.locator('body').getByText('This shouldn\'t be visible at first with conditions!').all()).toHaveLength(2) await page.evaluate(() => window.scrollTo(0, document.body.scrollHeight)) - await page.waitForLoadState('networkidle') - expect(await page.locator('body').getByText('This shouldn\'t be visible at first with viewport!').all()).toHaveLength(1) + await page.waitForTimeout(300) // Wait for the intersection observer to fire the callback + expect(await page.locator('body').getByText('This shouldn\'t be visible at first with viewport!').all()).toHaveLength(2) expect(await page.locator('body').getByText('This should always be visible!').all()).toHaveLength(1) await page.close() })