Skip to content

Commit

Permalink
Fix click-menu-item not waiting for the element to appear
Browse files Browse the repository at this point in the history
  • Loading branch information
kevin940726 committed Aug 15, 2023
1 parent 2ca55a1 commit b359cfe
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/e2e-test-utils/src/click-menu-item.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* @param {string} label The label to search the menu item for.
*/
export async function clickMenuItem( label ) {
const menuItems = await page.$x(
const menuItem = await page.waitForXPath(
`//*[@role="menu"]//*[text()="${ label }"]`
);
await menuItems[ 0 ].click();
await menuItem.click();
}

0 comments on commit b359cfe

Please sign in to comment.