From 3a1f5143c7c052b3929450ab6e6ca3bbe65efb6d Mon Sep 17 00:00:00 2001 From: Vsevolod Kukol Date: Fri, 11 Sep 2026 23:35:56 +0200 Subject: [PATCH] Stabilize global command selection --- test/fx.ts | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/test/fx.ts b/test/fx.ts index f3fc2e679..c4a156ed2 100644 --- a/test/fx.ts +++ b/test/fx.ts @@ -497,13 +497,18 @@ export class DataExplorer { return new DocumentsTab(this.frame, tabId, tab, documentsTab); } - /** Select the primary global command button. - * - * There's only a single "primary" button, but we still require you to pass the label to confirm you're selecting the right button. - */ + /** Select a global command from either the primary button or the overflow menu. */ async globalCommandButton(label: string): Promise { - await this.frame.getByTestId("GlobalCommands").click(); - return this.frame.getByRole("menuitem", { name: label }); + const globalCommands = this.frame.getByTestId("GlobalCommands"); + const primaryButton = globalCommands.getByRole("button", { name: label, exact: true }); + if (await primaryButton.isVisible()) { + return primaryButton; + } + + await globalCommands.locator('button[aria-haspopup="menu"]:visible').click(); + const menuItem = this.frame.getByRole("menuitem", { name: label, exact: true }); + await menuItem.waitFor(); + return menuItem; } /** Select the command bar button with the specified label */