Last active
March 11, 2025 10:29
-
-
Save adamliptrot-oc/042ebf50e2715bdbe3f459c0ce711a54 to your computer and use it in GitHub Desktop.
State 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('open account menu actions', async ({ page }) => { | |
| const logInButton = page.getByRole('button', {name: 'login', expanded: false}); | |
| await logInButton.press('Enter'); | |
| const accountMenu = page.locator('#account-menu'); | |
| const accountMenuClose = page.locator('#account-menu-close') | |
| // check menu is visible | |
| await expect.soft(accountMenu).toBeVisible(); | |
| // check button aria has updated | |
| await expect.soft(logInButton.toHaveAttribute('aria-expanded','true')); | |
| // check close button in dialog is focused | |
| await expect.soft(accountMenuClose).toBeFocused(); | |
| }); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment