refactor: use page.evaluate

This commit is contained in:
Michael Brevard 2024-04-09 22:24:48 +03:00 committed by GitHub
parent 59edd16fce
commit d4bca6cd57
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 1 deletions

View File

@ -2567,7 +2567,7 @@ describe('lazy import components', () => {
expect(html).not.toContain('This shouldn\'t be visible at first!') expect(html).not.toContain('This shouldn\'t be visible at first!')
const { page } = await renderPage('/lazy-import-components') const { page } = await renderPage('/lazy-import-components')
expect(await page.locator('body').getByText('This shouldn\'t be visible at first!').all()).toHaveLength(0) expect(await page.locator('body').getByText('This shouldn\'t be visible at first!').all()).toHaveLength(0)
await page.mouse.wheel(0, 4000) await page.evaluate(() => window.scrollTo(0, document.body.scrollHeight))
expect(await page.locator('body').getByText('This shouldn\'t be visible at first!').all()).toHaveLength(1) expect(await page.locator('body').getByText('This shouldn\'t be visible at first!').all()).toHaveLength(1)
}) })
}) })