Last active
March 11, 2025 10:29
-
-
Save adamliptrot-oc/b19e5d9a730e53522e808bf7927bbb2c to your computer and use it in GitHub Desktop.
Keyboard-only tests with Playwright
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| test('user can access carousel items', async ({ page }) => { | |
| const carouselPrev = page.getByRole('button', {name: 'previous'}); | |
| const firstDeal = page.getByTestId('first-deal-item'); | |
| carouselPrev.focus(); | |
| await page.keyboard.press('Tab'); | |
| await expect(firstDeal).toBeFocused(); | |
| await page.keyboard.press('Enter'); | |
| await expect(firstDeal).toHaveClass(/selected/); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment