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(test): fix flaky embedded dashboard tab view_count assertions (#75889)
Mahatthana (Kelvin) Nomsawadi3012ea0cb493
diff --git a/e2e/test/scenarios/dashboard/tabs.cy.spec.js b/e2e/test/scenarios/dashboard/tabs.cy.spec.jsindex 2683ad64bf3..72f06e5e811 100644--- a/e2e/test/scenarios/dashboard/tabs.cy.spec.js+++ b/e2e/test/scenarios/dashboard/tabs.cy.spec.js@@ -534,15 +534,6 @@ describe("scenarios > dashboard > tabs", () => {cy.wrap(response.body.dashcards[1].id).as("secondTabDashcardId");});- const firstQuestion = () => {- return cy.request("GET", `/api/card/${ORDERS_QUESTION_ID}`).its("body");- };- const secondQuestion = () => {- return cy- .request("GET", `/api/card/${ORDERS_COUNT_QUESTION_ID}`)- .its("body");- };-cy.intercept("GET",`/api/embed/dashboard/*/dashcard/*/card/${ORDERS_QUESTION_ID}*`,@@ -562,34 +553,20 @@ describe("scenarios > dashboard > tabs", () => {// publish the embedded dashboard so that we can directly navigate to its urlH.publishChanges("dashboard", () => {});+// directly navigate to the embedded dashboard, starting on Tab 1H.visitIframe();// wait for resultscy.findAllByTestId("dashcard").contains("37.65");- cy.signInAsAdmin();cy.get("@firstTabQuerySpy").should("have.been.calledOnce");cy.get("@secondTabQuerySpy").should("not.have.been.called");- cy.wait("@firstTabQuery").then((r) => {- firstQuestion().then((r) => {- expect(r.view_count).to.equal(3); // 1 (previously) + 1 (firstQuestion) + 1 (first tab query)- });- secondQuestion().then((r) => {- expect(r.view_count).to.equal(1); // 1 (previously)- });- });+ cy.wait("@firstTabQuery");H.goToTab("Tab 2");cy.get("@secondTabQuerySpy").should("have.been.calledOnce");cy.get("@firstTabQuerySpy").should("have.been.calledOnce");- cy.wait("@secondTabQuery").then((r) => {- firstQuestion().then((r) => {- expect(r.view_count).to.equal(3); // 3 (previously)- });- secondQuestion().then((r) => {- expect(r.view_count).to.equal(2); // 1 (previously) + 1 (second tab query)- });- });+ cy.wait("@secondTabQuery");H.goToTab("Tab 1");cy.get("@firstTabQuerySpy").should("have.been.calledOnce");