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
Fix e2e `dashboard-questions.cy.spec.js` scrollTo flakes (#70114)
Sloan Sparger3401c9e90203
diff --git a/e2e/test/scenarios/dashboard/dashboard-questions.cy.spec.js b/e2e/test/scenarios/dashboard/dashboard-questions.cy.spec.jsindex da45f2d009c..6750e02c7f1 100644--- a/e2e/test/scenarios/dashboard/dashboard-questions.cy.spec.js+++ b/e2e/test/scenarios/dashboard/dashboard-questions.cy.spec.js@@ -43,11 +43,12 @@ describe("Dashboard > Dashboard Questions", () => {H.modal().findByText("Orders in a dashboard");H.modal().button("Save").click();- // should take you to the edit dashboard screen + url has hash param to auto-scroll+ // should take you to the edit dashboard screen and auto-scroll to the new cardcy.url().should("include", "/dashboard/");- // FIXME: Re-visit the assertion (GDGT-1856)- // cy.location("hash").should("match", /scrollTo=\d+/); // url should have hash param to auto-scroll- H.dashboardCards().findByText("Orders with a discount");+ cy.location("hash").should("not.include", "scrollTo");+ H.dashboardCards()+ .findByText("Orders with a discount")+ .should("be.visible");cy.findByTestId("edit-bar").findByText("You're editing this dashboard.");// we can't use the save dashboard util, because we're not actually saving any changes@@ -202,10 +203,10 @@ describe("Dashboard > Dashboard Questions", () => {cy.button("Okay").click();});- // its in the new dash + url has hash param to auto-scroll+ // its in the new dash and auto-scrolls to the cardcy.url().should("include", "/dashboard/");- // FIXME: Re-visit the assertion (GDGT-1856)- // cy.location("hash").should("match", /scrollTo=\d+/); // url should have hash param to auto-scroll+ cy.location("hash").should("not.include", "scrollTo");+ H.dashboardCards().findByText("Total Orders").should("be.visible");H.undoToast().findByText("Orders in a dashboard");H.dashboardCards().should("contain", "Total Orders");@@ -391,6 +392,8 @@ describe("Dashboard > Dashboard Questions", () => {});it("can save a native question to a dashboard", () => {+ cy.intercept("POST", "/api/card").as("createCard");+H.startNewNativeQuestion({ query: "SELECT 123" });// this reduces the flakiness@@ -403,8 +406,7 @@ describe("Dashboard > Dashboard Questions", () => {cy.button("Save").click();});- cy.wait(5000);-+ cy.wait("@createCard", { timeout: 30 * 1000 }); // trying something dumb...cy.findByTestId("edit-bar").button("Save").click();H.dashboardCards().findByText("Half Orders");});@@ -968,13 +970,12 @@ describe("Dashboard > Dashboard Questions", () => {cy.log("should navigate user to the tab the question was saved to");cy.url().should("include", "/dashboard/");- // FIXME: Re-visit the assertion (GDGT-1856)- // cy.location("hash").should("match", /scrollTo=\d+/); // url should have hash param to auto-scroll+ cy.location("hash").should("not.include", "scrollTo");cy.location("search").should("contain", "tab"); // url should have tab param configuredH.assertTabSelected(TAB_TWO_NAME);- H.dashboardCards().within(() => {- cy.findByText(DASHBOARD_QUESTION_NAME).should("exist");- });+ H.dashboardCards()+ .findByText(DASHBOARD_QUESTION_NAME)+ .should("be.visible");});it("should allow a user to copy a question into a tab", () => {@@ -1013,13 +1014,12 @@ describe("Dashboard > Dashboard Questions", () => {cy.log("should navigate user to the tab the question was saved to");cy.url().should("include", "/dashboard/");- // FIXME: Re-visit the assertion (GDGT-1856)- // cy.location("hash").should("match", /scrollTo=\d+/); // url should have hash param to auto-scroll+ cy.location("hash").should("not.include", "scrollTo");cy.location("search").should("contain", "tab"); // url should have tab param configuredH.assertTabSelected(TAB_ONE_NAME);- H.dashboardCards().within(() => {- cy.findByText("Orders, Count - Duplicate").should("exist");- });+ H.dashboardCards()+ .findByText("Orders, Count - Duplicate")+ .should("be.visible");});});diff --git a/e2e/test/scenarios/dashboard/dashboard.cy.spec.js b/e2e/test/scenarios/dashboard/dashboard.cy.spec.jsindex 709cd358350..a090a9e7d6d 100644--- a/e2e/test/scenarios/dashboard/dashboard.cy.spec.js+++ b/e2e/test/scenarios/dashboard/dashboard.cy.spec.js@@ -1107,8 +1107,8 @@ describe("scenarios > dashboard", () => {cy.log("should scroll into view w/ scrollTo hash param");cy.visit(`/dashboard/${dashboard.id}#scrollTo=${targetCard.id}`);- cy.location("hash").should("match", /scrollTo=\d+/); // url should have hash param to auto-scroll- cy.location("hash").should("not.include", "scrollTo"); // scrollTo param should get removed+ // wait for scroll to complete (hash cleared) then verify visibility+ cy.location("hash").should("not.include", "scrollTo");cy.findByText(TARGET_TEXT).should("be.visible");},);diff --git a/e2e/test/scenarios/question/saved.cy.spec.js b/e2e/test/scenarios/question/saved.cy.spec.jsindex fb6619898fc..0d85562d8dc 100644--- a/e2e/test/scenarios/question/saved.cy.spec.js+++ b/e2e/test/scenarios/question/saved.cy.spec.js@@ -104,8 +104,8 @@ describe("scenarios > question > saved", () => {});cy.url().should("include", "/dashboard/");- cy.location("hash").should("match", /scrollTo=\d+/); // url should have hash param to auto-scroll- H.dashboardCards().findByText("Orders - Duplicate").should("exist");+ cy.location("hash").should("not.include", "scrollTo");+ H.dashboardCards().findByText("Orders - Duplicate").should("be.visible");});it("should duplicate a saved question to a collection created on the go", () => {