sadpandajoe commented on code in PR #43487:
URL: https://github.com/apache/superset/pull/43487#discussion_r3856618892


##########
superset-frontend/playwright/pages/DashboardV2Page.ts:
##########
@@ -115,15 +114,21 @@ export class DashboardV2Page {
   }
 
   /**
-   * Switches back to the "Building blocks" palette tab. Placing (or
-   * selecting) a block switches the editor panel to Properties, so a test
-   * that places one block via `placeBlockByClick` and then wants to drag a
-   * second one from the palette needs this in between.
+   * Switches back to the "Widgets" palette tab. Placing (or selecting) a
+   * block switches the editor panel to Properties, so a test that places
+   * one block via `placeBlockByClick` and then wants to drag a second one
+   * from the palette needs this in between.
+   *
+   * A plain `text=Widgets` locator is unsafe here: on a branch (or any
+   * other page state) where the word "Widgets" happens to appear
+   * elsewhere too — e.g. a dev-mode badge showing the current git branch
+   * name — it resolves to more than one element and Playwright refuses to
+   * click ambiguously. Scoping to the actual `tab` role, which only the
+   * real palette tab has, avoids that regardless of what else is on the
+   * page.
    */
   async showPalette(): Promise<void> {
-    await this.page
-      .locator(DashboardV2Page.SELECTORS.BUILDING_BLOCKS_TAB)
-      .click();
+    await this.page.getByRole('tab', { name: 'Widgets', exact: true }).click();

Review Comment:
   This locator still searches the whole document. A dashboard can contain a 
Tabs widget with a user-named "Widgets" pane, which is also a `role="tab"`; 
strict mode will then find both tabs and `showPalette()` will fail again. Could 
this be scoped to the editor panel or its `Editor panel views` tablist?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to