diff --git a/test/emulation-focus.spec.ts b/test/emulation-focus.spec.ts index 30bdd1efd9..75d9b1abba 100644 --- a/test/emulation-focus.spec.ts +++ b/test/emulation-focus.spec.ts @@ -171,3 +171,15 @@ it('should change focused iframe', async ({page, server}) => { expect(focused).toEqual([false, true]); } }); + +// @see https://github.com/microsoft/playwright/issues/3476 +it('should focus with more than one page/context', async ({contextFactory}) => { + const page1 = await (await contextFactory()).newPage(); + const page2 = await (await contextFactory()).newPage(); + await page1.setContent(``); + await page2.setContent(``); + await page1.focus('#foo'); + await page2.focus('#foo'); + expect(await page1.evaluate(() => !!window['gotFocus'])).toBe(true); + expect(await page2.evaluate(() => !!window['gotFocus'])).toBe(true); +});