diff --git a/packages/playwright-core/src/server/chromium/crPage.ts b/packages/playwright-core/src/server/chromium/crPage.ts index c1ff803338..57ebc5fa69 100644 --- a/packages/playwright-core/src/server/chromium/crPage.ts +++ b/packages/playwright-core/src/server/chromium/crPage.ts @@ -364,6 +364,8 @@ export class CRPage implements PageDelegate { } async resetForReuse(): Promise { + // See https://github.com/microsoft/playwright/issues/22432. + await this.rawMouse.move(-1, -1, 'none', new Set(), new Set(), true); } async pdf(options: channels.PagePdfParams): Promise { diff --git a/tests/library/browsercontext-reuse.spec.ts b/tests/library/browsercontext-reuse.spec.ts index 14590a3ae3..30319f0aad 100644 --- a/tests/library/browsercontext-reuse.spec.ts +++ b/tests/library/browsercontext-reuse.spec.ts @@ -203,10 +203,10 @@ test('should ignore binding from beforeunload', async ({ reusedContext }) => { expect(called).toBe(false); }); -test('should reset mouse position', async ({ reusedContext, browserName, platform }) => { +test('should reset mouse position', { + annotation: { type: 'issue', description: 'https://github.com/microsoft/playwright/issues/22432' }, +}, async ({ reusedContext, browserName, platform }) => { // Note: this test only reproduces the issue locally when run with --repeat-each=20. - test.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/22432' }); - test.fixme(browserName === 'chromium' && platform !== 'darwin', 'chromium keeps hover on linux/win'); const pageContent = ` +
one
one
two
`; @@ -224,7 +225,7 @@ test('should reset mouse position', async ({ reusedContext, browserName, platfor await expect(page.locator('#one')).toHaveCSS('background-color', 'rgb(0, 0, 255)'); await expect(page.locator('#two')).toHaveCSS('background-color', 'rgb(0, 0, 255)'); - await page.mouse.move(10, 45); + await page.mouse.move(10, 75); await expect(page.locator('#one')).toHaveCSS('background-color', 'rgb(0, 0, 255)'); await expect(page.locator('#two')).toHaveCSS('background-color', 'rgb(255, 0, 0)');