Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

Fix flaky embedding data-picker join-step e2e test (#76380)

github-automation-metabase807236db3140
diff --git a/e2e/test/scenarios/embedding/embedding-reproductions.cy.spec.js b/e2e/test/scenarios/embedding/embedding-reproductions.cy.spec.js
index 5b8f702117f..c0ffb835601 100644
--- a/e2e/test/scenarios/embedding/embedding-reproductions.cy.spec.js
+++ b/e2e/test/scenarios/embedding/embedding-reproductions.cy.spec.js
@@ -1408,16 +1408,22 @@ describe("issue 51934 (EMB-189)", () => {
const QA_DB_NAME = "QA Postgres12";
const DATA_SOURCE_NAME = "Orders";
- // The data/join pickers re-render while their collection list loads, AND
- // clicking a menu item itself triggers a re-render (card metadata fetch +
- // selection state change) that detaches Cypress's actionability retry on
- // `.click()`. Wait for the list to be stable (loader gone), then click
- // with `{ force: true }` to skip the post-find actionability re-check —
- // we already know the item is visible; we don't want to retry-and-detach
- // when clicking it causes its own re-render.
+ // Before the picker can auto-navigate into the data source's collection it
+ // resolves the target path asynchronously: a card-metadata fetch plus one
+ // `listCollectionItems` request per collection level (root -> Model
+ // Collection). On a throttled CI runner that serial chain routinely outlasts
+ // Cypress's default 4 s command timeout, so the picker is still showing the
+ // parent (root) collections when a default-timeout query gives up — the
+ // dominant "cannot find menuitem '...' (only the root collections are
+ // present)" flake. Wait for the loader to clear, then give the item lookup a
+ // generous timeout so it waits for the path to finish resolving, and assert
+ // it is visible (positive anchor) before clicking.
+ const PICKER_ITEM_TIMEOUT = 15000;
const clickPickerItem = (name) => {
cy.get('[data-testid="mini-picker-list-loader"]').should("not.exist");
- cy.findByRole("menuitem", { name }).click();
+ cy.findByRole("menuitem", { name }, { timeout: PICKER_ITEM_TIMEOUT })
+ .should("be.visible")
+ .click();
};
// The data-source picker and the join picker are both rendered by the same