From a5d3c0aef6d48cae905f44544c2dbd94816bfe57 Mon Sep 17 00:00:00 2001 From: Yury Semikhatsky Date: Thu, 19 Sep 2024 16:42:19 -0700 Subject: [PATCH] test: pressing tab should trigger blur event Reference: https://github.com/microsoft/playwright/issues/32339 --- tests/page/page-focus.spec.ts | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/tests/page/page-focus.spec.ts b/tests/page/page-focus.spec.ts index 744aefec2e..54c1010b21 100644 --- a/tests/page/page-focus.spec.ts +++ b/tests/page/page-focus.spec.ts @@ -117,6 +117,37 @@ it('clicking checkbox should activate it', async ({ page, browserName, headless, expect(nodeName).toBe('INPUT'); }); +it('tab should cycle between document and browser', { + annotation: { type: 'issue', description: 'https://github.com/microsoft/playwright/issues/32339' } +}, async ({ page, browserName }) => { + it.fixme(browserName !== 'chromium'); + await page.setContent(` + + `); + await page.keyboard.press('Tab'); + await expect(page.getByText('Input was focused')).toHaveCount(1); + await page.keyboard.press('Tab'); + await expect(page.getByText('Input was blurred')).toHaveCount(1); + await page.keyboard.press('Tab'); + await expect(page.getByText('Input was focused')).toHaveCount(2); + await page.keyboard.press('Tab'); + await expect(page.getByText('Input was blurred')).toHaveCount(2); +}); + it('keeps focus on element when attempting to focus a non-focusable element', async ({ page }) => { it.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/14254' });