From 7f10fe935a9efa337f294c9571e5a4414ccd49aa Mon Sep 17 00:00:00 2001 From: Dmitry Gozman Date: Thu, 9 Nov 2023 08:27:34 -0800 Subject: [PATCH] test: add a test for concurrent hover (#28042) References #27969. --- tests/library/emulation-focus.spec.ts | 33 +++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/tests/library/emulation-focus.spec.ts b/tests/library/emulation-focus.spec.ts index bc4bbb801c..94f18927b4 100644 --- a/tests/library/emulation-focus.spec.ts +++ b/tests/library/emulation-focus.spec.ts @@ -186,3 +186,36 @@ browserTest('should focus with more than one page/context', async ({ contextFact expect(await page1.evaluate(() => !!window['gotFocus'])).toBe(true); expect(await page2.evaluate(() => !!window['gotFocus'])).toBe(true); }); + +browserTest('should trigger hover state concurrently', async ({ browserType, browserName }) => { + browserTest.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/27969' }); + browserTest.fixme(browserName === 'firefox'); + + const browser1 = await browserType.launch(); + const context1 = await browser1.newContext(); + const page1 = await context1.newPage(); + const page2 = await context1.newPage(); + const browser2 = await browserType.launch(); + const page3 = await browser2.newPage(); + + for (const page of [page1, page2, page3]) { + await page.setContent(` + +
hover me
+ `); + } + + for (const page of [page1, page2, page3]) + await page.hover('span'); + for (const page of [page1, page2, page3]) + await page.click('button'); + for (const page of [page1, page2, page3]) + expect(await page.evaluate('window.clicked')).toBe(1); + for (const page of [page1, page2, page3]) + await page.click('button'); + for (const page of [page1, page2, page3]) + expect(await page.evaluate('window.clicked')).toBe(2); +});