mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2026-09-19 09:02:41 +01:00
Stabilize global command selection
This commit is contained in:
+11
-6
@@ -497,13 +497,18 @@ export class DataExplorer {
|
|||||||
return new DocumentsTab(this.frame, tabId, tab, documentsTab);
|
return new DocumentsTab(this.frame, tabId, tab, documentsTab);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Select the primary global command button.
|
/** Select a global command from either the primary button or the overflow menu. */
|
||||||
*
|
|
||||||
* There's only a single "primary" button, but we still require you to pass the label to confirm you're selecting the right button.
|
|
||||||
*/
|
|
||||||
async globalCommandButton(label: string): Promise<Locator> {
|
async globalCommandButton(label: string): Promise<Locator> {
|
||||||
await this.frame.getByTestId("GlobalCommands").click();
|
const globalCommands = this.frame.getByTestId("GlobalCommands");
|
||||||
return this.frame.getByRole("menuitem", { name: label });
|
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 */
|
/** Select the command bar button with the specified label */
|
||||||
|
|||||||
Reference in New Issue
Block a user