The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:
TypeScript analyticsbibusiness-intelligencebusinessintelligenceclojuredashboarddatadata-analysisdata-visualizationdatabasemetabasemysqlpostgrespostgresqlreportingslacksql-editorvisualization
Fixed flaky e2e test (#71019)
Sébastienea2e642c8251
diff --git a/e2e/test/scenarios/embedding/sdk-iframe-embedding/custom-elements-api.cy.spec.ts b/e2e/test/scenarios/embedding/sdk-iframe-embedding/custom-elements-api.cy.spec.tsindex 5832cea82ee..0fe8eda0f1d 100644--- a/e2e/test/scenarios/embedding/sdk-iframe-embedding/custom-elements-api.cy.spec.ts+++ b/e2e/test/scenarios/embedding/sdk-iframe-embedding/custom-elements-api.cy.spec.ts@@ -157,37 +157,53 @@ describe("scenarios > embedding > sdk iframe embedding > custom elements api", (});it("should enable drill-through when drills is true", () => {- H.visitCustomHtmlPage(`- ${H.getNewEmbedScriptTag()}- ${H.getNewEmbedConfigurationScript()}- <metabase-dashboard dashboard-id="${ORDERS_DASHBOARD_ID}" drills />- `);+ H.createQuestionAndDashboard({+ questionDetails: {+ name: "Limited Orders",+ query: { "source-table": ORDERS_ID, limit: 5 },+ },+ }).then(({ body: { dashboard_id } }) => {+ H.visitCustomHtmlPage(`+ ${H.getNewEmbedScriptTag()}+ ${H.getNewEmbedConfigurationScript()}+ <metabase-dashboard dashboard-id="${dashboard_id}" drills />+ `);- H.getSimpleEmbedIframeContent()- .findAllByText("37.65")- .first()- .should("be.visible")- .click();- H.getSimpleEmbedIframeContent()- .findByText(/Filter by this value/)- .should("be.visible");+ H.getSimpleEmbedIframeContent()+ .findAllByText("37.65")+ .first()+ .should("be.visible")+ .click();+ H.getSimpleEmbedIframeContent()+ .findByText(/Filter by this value/)+ .should("be.visible");+ });});it("should disable drill-through when drills is false", () => {- H.visitCustomHtmlPage(`- ${H.getNewEmbedScriptTag()}- ${H.getNewEmbedConfigurationScript()}- <metabase-dashboard dashboard-id="${ORDERS_DASHBOARD_ID}" drills="false" />- `);+ H.createQuestionAndDashboard({+ questionDetails: {+ name: "Limited Orders",+ query: { "source-table": ORDERS_ID, limit: 5 },+ },+ }).then(({ body: { dashboard_id } }) => {+ H.visitCustomHtmlPage(`+ ${H.getNewEmbedScriptTag()}+ ${H.getNewEmbedConfigurationScript()}+ <metabase-dashboard dashboard-id="${dashboard_id}" drills="false" />+ `);- H.getSimpleEmbedIframeContent()- .findAllByText("37.65")- .first()- .should("be.visible")- .click();- H.getSimpleEmbedIframeContent()- .findByText(/Filter by this value/)- .should("not.exist");+ cy.wait("@getDashCardQuery");++ H.getSimpleEmbedIframeContent()+ .findAllByText("37.65")+ .first()+ .should("be.visible")+ .click({ force: true });+ H.getSimpleEmbedIframeContent()+ .findByText(/Filter by this value/)+ .should("not.exist");+ });});});@@ -276,37 +292,55 @@ describe("scenarios > embedding > sdk iframe embedding > custom elements api", (});it("should enable drill-through when drills is true", () => {- H.visitCustomHtmlPage(`- ${H.getNewEmbedScriptTag()}- ${H.getNewEmbedConfigurationScript()}- <metabase-question question-id="${ORDERS_QUESTION_ID}" drills />- `);+ H.createQuestion({+ name: "Limited Orders",+ query: { "source-table": ORDERS_ID, limit: 5 },+ }).then(({ body: { id: questionId } }) => {+ H.visitCustomHtmlPage(`+ ${H.getNewEmbedScriptTag()}+ ${H.getNewEmbedConfigurationScript()}+ <metabase-question question-id="${questionId}" drills />+ `);- H.getSimpleEmbedIframeContent()- .findAllByText("37.65")- .first()- .should("be.visible")- .click();- H.getSimpleEmbedIframeContent()- .findByText(/Filter by this value/)- .should("be.visible");+ H.getSimpleEmbedIframeContent()+ .findAllByText("37.65")+ .first()+ .should("be.visible")+ .click();+ H.getSimpleEmbedIframeContent()+ .findByText(/Filter by this value/)+ .should("be.visible");+ });});it("should disable drill-through when drills is false", () => {- H.visitCustomHtmlPage(`- ${H.getNewEmbedScriptTag()}- ${H.getNewEmbedConfigurationScript()}- <metabase-question question-id="${ORDERS_QUESTION_ID}" drills="false" />- `);+ H.createQuestion({+ name: "Limited Orders",+ query: { "source-table": ORDERS_ID, limit: 5 },+ }).then(({ body: { id: questionId } }) => {+ H.visitCustomHtmlPage(`+ ${H.getNewEmbedScriptTag()}+ ${H.getNewEmbedConfigurationScript()}+ <metabase-question question-id="${questionId}" drills="false" />+ `);- H.getSimpleEmbedIframeContent()- .findAllByText("37.65")- .first()- .should("be.visible")- .click();- H.getSimpleEmbedIframeContent()- .findByText(/Filter by this value/)- .should("not.exist");+ cy.wait("@getCardQuery");++ // Wait for the table to finish rendering before interacting,+ // as column auto-sizing can cause re-renders that detach elements.+ H.getSimpleEmbedIframeContent()+ .findByTestId("table-root")+ .should("have.attr", "data-rows-count", "5");++ H.getSimpleEmbedIframeContent()+ .findByText("37.65")+ .should("be.visible")+ .click({ force: true });++ H.getSimpleEmbedIframeContent()+ .findByText(/Filter by this value/)+ .should("not.exist");+ });});it("should allow saving a question when `is-save-enabled` is true", () => {