Skip to content

Commit 7c8e43c

Browse files
committed
Improve Puppeteer tests
1 parent 1521cb8 commit 7c8e43c

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

test/puppeteer/demo.test.ts

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,7 @@ it('has the correct page title', async () => {
2020
await expect(page.title()).resolves.toMatch('React Accessible Dropdown Menu Hook');
2121
});
2222

23-
it('focuses on the first menu item when the enter key is pressed', async () => {
24-
await page.focus('#menu-button');
25-
await keyboard.down('Enter');
26-
await menuOpen();
27-
28-
expect(await currentFocusID()).toBe('menu-item-1');
29-
});
30-
31-
it('leaves focus on the button if the button is clicked', async () => {
23+
it('leaves focus on the button after clicking it', async () => {
3224
await page.click('#menu-button');
3325
await menuOpen();
3426

@@ -74,7 +66,7 @@ it('closes the menu if you click outside of it', async () => {
7466
await keyboard.down('Enter');
7567
await menuOpen();
7668

77-
await page.click('body');
69+
await page.click('h1');
7870
await menuClosed(); // times out if menu doesn't close
7971

8072
expect(true).toBe(true);

0 commit comments

Comments
 (0)