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
Consolidate dashboard questions, management, and navigation e2e tests (#83924)
Nemanja Glumac176923265d7a
diff --git a/e2e/test/scenarios/dashboard/dashboard-back-navigation.cy.spec.js b/e2e/test/scenarios/dashboard/dashboard-back-navigation.cy.spec.jsindex f7f4b958723..4cd01484fba 100644--- a/e2e/test/scenarios/dashboard/dashboard-back-navigation.cy.spec.js+++ b/e2e/test/scenarios/dashboard/dashboard-back-navigation.cy.spec.js@@ -29,7 +29,7 @@ describe("scenarios > dashboard > dashboard back navigation", () => {);});- it("should display a back to the dashboard button when navigating to a question", () => {+ it("should display a back to the dashboard button when navigating to a question and keep the selected tab", () => {const dashboardName = "Orders in a dashboard";const backButtonLabel = `Back to ${dashboardName}`;@@ -60,7 +60,34 @@ describe("scenarios > dashboard > dashboard back navigation", () => {H.appBar().findByText("Our analytics").click();cy.findByTestId("collection-table").findByText("Orders").click();+ H.queryBuilderHeader().findByDisplayValue("Orders").should("be.visible");cy.findByLabelText(backButtonLabel).should("not.exist");++ cy.log("should return to the dashboard with the same tab selected");+ cy.intercept("GET", "/api/card/*").as("card");+ H.visitDashboardAndCreateTab({+ dashboardId: ORDERS_DASHBOARD_ID,+ save: false,+ });++ // Add card to second tab+ cy.icon("pencil").click();+ H.openQuestionsSidebar();+ H.sidebar().within(() => {+ cy.findByText("Orders, Count").click();+ });+ H.saveDashboard();++ H.getDashboardCard().within(() => {+ cy.findByText("Orders, Count").click();+ cy.wait("@card");+ });++ H.queryBuilderHeader()+ .findByLabelText("Back to Orders in a dashboard")+ .click();++ cy.findByRole("tab", { selected: true }).should("have.text", "Tab 2");});it("should expand the native editor when editing a question from a dashboard", () => {@@ -79,24 +106,6 @@ describe("scenarios > dashboard > dashboard back navigation", () => {H.NativeEditor.get().should("not.exist");});- it("should display a back to the dashboard button in table x-ray dashboards", () => {- const cardTitle = "Total transactions";- cy.visit(`/auto/dashboard/table/${ORDERS_ID}?#show=${MAX_CARDS}`);- cy.wait("@dataset", { timeout: MAX_XRAY_WAIT_TIMEOUT });-- H.getDashboardCards()- .filter(`:contains("${cardTitle}")`)- .findByText(cardTitle)- .click();- cy.wait("@dataset");-- H.queryBuilderHeader()- .findByLabelText(/Back to .*Orders.*/)- .click();-- H.getDashboardCards().filter(`:contains("${cardTitle}")`).should("exist");- });-it("should display a back to the dashboard button in model x-ray dashboards", () => {const cardTitle = "Orders by Subtotal";cy.request("PUT", `/api/card/${ORDERS_QUESTION_ID}`, { type: "model" });@@ -209,32 +218,6 @@ describe("scenarios > dashboard > dashboard back navigation", () => {cy.get("@dashboard.all").should("have.length", 1);cy.get("@dashcardQuery.all").should("have.length", 1);});-- it("should return to dashboard with specific tab selected", () => {- H.visitDashboardAndCreateTab({- dashboardId: ORDERS_DASHBOARD_ID,- save: false,- });-- // Add card to second tab- cy.icon("pencil").click();- H.openQuestionsSidebar();- H.sidebar().within(() => {- cy.findByText("Orders, Count").click();- });- H.saveDashboard();-- H.getDashboardCard().within(() => {- cy.findByText("Orders, Count").click();- cy.wait("@card");- });-- H.queryBuilderHeader()- .findByLabelText("Back to Orders in a dashboard")- .click();-- cy.findByRole("tab", { selected: true }).should("have.text", "Tab 2");- });});describe(diff --git a/e2e/test/scenarios/dashboard/dashboard-management.cy.spec.js b/e2e/test/scenarios/dashboard/dashboard-management.cy.spec.jsindex 718aee8751d..f0ad8577c92 100644--- a/e2e/test/scenarios/dashboard/dashboard-management.cy.spec.js+++ b/e2e/test/scenarios/dashboard/dashboard-management.cy.spec.js@@ -1,11 +1,10 @@const { H } = cy;import { USERS } from "e2e/support/cypress_data";-import { SAMPLE_DATABASE } from "e2e/support/cypress_sample_database";import { ORDERS_DASHBOARD_ID } from "e2e/support/cypress_sample_instance_data";import { onlyOn } from "e2e/support/helpers/e2e-skip-test-helpers";const PERMISSIONS = {- curate: ["admin", "normal", "nodata"],+ curate: ["admin", "nodata"],view: ["readonly"],no: ["nocollection", "nosql", "none"],};@@ -70,6 +69,8 @@ describe("managing dashboard from the dashboard's edit menu", () => {cy.reload();assertOnRequest("getDashboard");cy.findByDisplayValue(`${dashboardName}1`);+ H.openDashboardInfoSidebar();+ H.sidesheet().findByText("Foo").should("be.visible");});it("should shallow duplicate a dashboard but not its cards", () => {@@ -111,23 +112,24 @@ describe("managing dashboard from the dashboard's edit menu", () => {name: `Duplicate "${dashboardName}"`,});cy.button("Duplicate").click();- assertOnRequest("copyDashboard");});+ assertOnRequest("copyDashboard");cy.url().should("contain", `/dashboard/${newDashboardId}`);cy.findByDisplayValue(newDashboardName);H.appBar().findByText("Our analytics").click();- cy.findAllByTestId("collection-entry-name")- .should("contain", dashboardName)- .and("contain", newDashboardName)- .and("contain", originalQuestionName)- .and("not.contain", newQuestionName);+ H.collectionTable().within(() => {+ cy.findByText(dashboardName).should("be.visible");+ cy.findByText(newDashboardName).should("be.visible");+ cy.findByText(originalQuestionName).should("be.visible");+ cy.findByText(newQuestionName).should("not.exist");+ });});});- it("should deep duplicate a dashboard and its cards", () => {+ it("should deep duplicate a dashboard and its cards to the same and to a new collection", () => {cy.get("@originalDashboardId").then((id) => {cy.intercept("POST", `/api/dashboard/${id}/copy`).as("copyDashboard",@@ -159,34 +161,27 @@ describe("managing dashboard from the dashboard's edit menu", () => {"If you check this, the cards in the duplicated dashboard will reference the original questions.",);- H.modal().within(() => {- cy.button("Duplicate").click();- assertOnRequest("copyDashboard");- });+ H.modal().button("Duplicate").click();+ assertOnRequest("copyDashboard");cy.url().should("contain", `/dashboard/${newDashboardId}`);cy.findByDisplayValue(newDashboardName);H.appBar().findByText("Our analytics").click();- cy.findAllByTestId("collection-entry-name")- .should("contain", dashboardName)- .and("contain", newDashboardName)- .and("contain", originalQuestionName)- .and("contain", newQuestionName);- });- });+ H.collectionTable().within(() => {+ cy.findByText(dashboardName).should("be.visible");+ cy.findByText(newDashboardName).should("be.visible");+ cy.findByText(originalQuestionName).should("be.visible");+ cy.findByText(newQuestionName).should("be.visible");+ });- it("should deep duplicate a dashboard and its cards to a collection created on the go", () => {- cy.get("@originalDashboardId").then((id) => {- cy.intercept("POST", `/api/dashboard/${id}/copy`).as(- "copyDashboard",- );- const newDashboardName = `${dashboardName} - Duplicate`;- const { name: originalQuestionName } = questionDetails;- const newQuestionName = originalQuestionName;- const newDashboardId = id + 1;+ cy.log("deep duplicate to a collection created on the go");+ const newCollectionDashboardId = id + 2;+ const newCollectionQuestionName = originalQuestionName;+ H.visitDashboard(id);+ H.openDashboardMenu();H.popover().findByText("Duplicate").should("be.visible")@@ -216,19 +211,25 @@ describe("managing dashboard from the dashboard's edit menu", () => {cy.button("Duplicate").click();assertOnRequest("copyDashboard");- cy.url().should("contain", `/dashboard/${newDashboardId}`);+ cy.url().should(+ "contain",+ `/dashboard/${newCollectionDashboardId}`,+ );cy.findByDisplayValue(newDashboardName);H.appBar().findByText(NEW_COLLECTION).click();- cy.findAllByTestId("collection-entry-name")- .should("contain", newDashboardName)- .and("contain", newQuestionName);+ H.collectionTable().within(() => {+ cy.findByText(newDashboardName).should("be.visible");+ cy.findByText(newCollectionQuestionName).should("be.visible");+ cy.findByText(newQuestionName).should("not.exist");+ });H.openNavigationSidebar();H.navigationSidebar().findByText("Our analytics").click();- cy.findAllByTestId("collection-entry-name")- .should("contain", dashboardName)- .and("contain", originalQuestionName);+ H.collectionTable().within(() => {+ cy.findByText(dashboardName).should("be.visible");+ cy.findByText(originalQuestionName).should("be.visible");+ });});});@@ -281,8 +282,8 @@ describe("managing dashboard from the dashboard's edit menu", () => {name: "Move this dashboard to trash?",}); //Without this, there is some race condition and the button click failscy.button("Move to trash").click();- assertOnRequest("updateDashboard");});+ assertOnRequest("updateDashboard");cy.location("pathname").should("eq", `/dashboard/${id}`);@@ -291,8 +292,8 @@ describe("managing dashboard from the dashboard's edit menu", () => {H.undoToast().within(() => {cy.findByText("FooBar has been moved to the trash.");cy.button("Undo").click();- assertOnRequest("updateDashboard");});+ assertOnRequest("updateDashboard");cy.visit("/collection/root");cy.findAllByTestId("collection-entry-name").should(@@ -315,17 +316,16 @@ describe("managing dashboard from the dashboard's edit menu", () => {});});- it("should not be offered to edit dashboard details or archive the dashboard for dashboard in collections they have `read` access to (metabase#15280)", () => {- H.popover()- .findByText("Edit dashboard details")- .should("not.exist");-- H.popover().findByText("Move to trash").should("not.exist");- });-- it("should be offered to duplicate dashboard in collections they have `read` access to", () => {+ it("should only be offered to duplicate dashboard in collections they have `read` access to (metabase#15280)", () => {const { first_name, last_name } = USERS[user];+ H.popover().within(() => {+ cy.findByText("Duplicate").should("be.visible");+ cy.findByText("Edit settings").should("not.exist");+ cy.findByText("Move").should("not.exist");+ cy.findByText("Move to trash").should("not.exist");+ });+H.popover().findByText("Duplicate").click();cy.findByTestId("collection-picker-button").should("have.text",@@ -336,35 +336,6 @@ describe("managing dashboard from the dashboard's edit menu", () => {});});});-- it("should be prevented from doing a shallow copy if the dashboard contains a dashboard question", () => {- cy.signInAsAdmin();-- H.createNativeQuestionAndDashboard({- questionDetails,- dashboardDetails: { name: dashboardName },- }).then(({ body: { dashboard_id } }) => {- H.createQuestion({- name: "Foo dashboard question",- query: { "source-table": SAMPLE_DATABASE.ORDERS_ID, limit: 5 },- dashboard_id,- }).then(({ body: card }) => {- cy.wrap(card.id).as("dashboardQuestionId");- H.addOrUpdateDashboardCard({ card_id: card.id, dashboard_id });- H.visitDashboard(dashboard_id);- });- });-- H.openDashboardMenu();- H.popover().findByText("Duplicate").should("be.visible").click();-- H.modal().within(() => {- cy.findByRole("heading", {- name: `Duplicate "${dashboardName}" and its questions`,- });- cy.findByLabelText("Only duplicate the dashboard").should("not.exist");- });- });});function assertOnRequest(xhr_alias) {diff --git a/e2e/test/scenarios/dashboard/dashboard-questions.cy.spec.js b/e2e/test/scenarios/dashboard/dashboard-questions.cy.spec.jsindex d6f2704a500..e9c2754c9e5 100644--- a/e2e/test/scenarios/dashboard/dashboard-questions.cy.spec.js+++ b/e2e/test/scenarios/dashboard/dashboard-questions.cy.spec.js@@ -64,9 +64,13 @@ describe("Dashboard > Dashboard Questions", () => {H.entityPickerModal().findByText("First collection").click();H.entityPickerModal().button("Move").click();- H.modal().findByText(/do you still want this question to appear/i);- // defaults to yes- H.modal().button("Done").click();+ H.modal().within(() => {+ cy.findByText(/do you still want this question to appear/i);+ cy.findByRole("radio", {+ name: /Yes, it should still appear there/i,+ }).should("be.checked");+ cy.button("Done").click();+ });H.undoToast().findByText("First collection");H.appBar().findByText("First collection"); // breadcrumb should changeH.appBar().findByText("Orders in a dashboard").should("not.exist"); // dashboard name should no longer be visible@@ -77,16 +81,6 @@ describe("Dashboard > Dashboard Questions", () => {});it("can move an existing question between a dashboard and a collection", () => {- H.createQuestion({- name: "Total Orders that should stay",- dashboard_id: S.ORDERS_DASHBOARD_ID,- query: {- "source-table": SAMPLE_DATABASE.ORDERS_ID,- aggregation: [["count"]],- },- display: "scalar",- });-H.createQuestion({name: "Total Orders",@@ -109,6 +103,7 @@ describe("Dashboard > Dashboard Questions", () => {H.dashboardCards().findByText("Total Orders").click();H.openQuestionActions();+ H.popover().findByText("Move").should("be.visible");H.popover().findByText("Turn into a model").should("not.exist");H.popover().findByText("Add to dashboard").should("not.exist");cy.findByLabelText("Navigation bar").should(@@ -137,31 +132,8 @@ describe("Dashboard > Dashboard Questions", () => {H.undoToast().findByText("Second collection");H.visitDashboard(S.ORDERS_DASHBOARD_ID);+ H.dashboardCards().findByText("Orders").should("be.visible");H.dashboardCards().findByText("Total Orders").should("not.exist");-- cy.log("test moving a question while keeping the dashcard");- H.dashboardCards().findByText("Total Orders that should stay").click();-- H.openQuestionActions();- H.popover().findByText("Move").click();- H.entityPickerModal().findByText("First collection").click();- H.entityPickerModal().findByText("Second collection").click();- H.entityPickerModal().button("Move").click();- H.modal().within(() => {- cy.findByText(/do you still want this question to appear/i).should(- "exist",- );- cy.findByRole("radio", {- name: /Yes, it should still appear there/i,- }).should("be.checked");- cy.button("Done").click();- });-- H.undoToast().findByText("Second collection");- H.visitDashboard(S.ORDERS_DASHBOARD_ID);- H.dashboardCards()- .findByText("Total Orders that should stay")- .should("exist");});it("can move a dashboard question between dashboards", () => {@@ -217,7 +189,7 @@ describe("Dashboard > Dashboard Questions", () => {);});- it("can bulk move questions into a dashboard", () => {+ it("can bulk move questions into a dashboard and tell users which dashboards will be affected", () => {cy.intercept("PUT", "/api/card/*").as("updateCard");new Array(20).fill("pikachu").forEach((_, i) => {@@ -270,15 +242,15 @@ describe("Dashboard > Dashboard Questions", () => {H.entityPickerModal().button("Move").click();cy.wait(["@updateCard", "@updateCard"]);+ H.undoToast().findByText("Moved 2 questions");+ H.collectionTable().findByText("Orders Model").should("be.visible");cy.findByTestId("error-boundary").should("not.exist");H.visitDashboard(S.ORDERS_DASHBOARD_ID, { dashcardTimeout: 30000 });H.dashboardCards().findByText("Orders");H.dashboardCards().findByText("Orders, Count");- });- it("should tell users which dashboards will be affected when doing bulk question moves", () => {+ cy.log("tell users which dashboards will be affected");cy.intercept("PUT", "/api/card/*").as("moveQuestion");-H.createQuestionAndDashboard({questionDetails: {name: "Sample Question",@@ -326,11 +298,11 @@ describe("Dashboard > Dashboard Questions", () => {.findByText("This dashboard is empty").should("be.visible");- H.visitDashboard(S.ORDERS_DASHBOARD_ID);+ H.visitDashboard(S.ORDERS_DASHBOARD_ID, { dashcardTimeout: 30000 });H.dashboardCards().findByText("Sample Question").should("exist");});- it("can edit a dashboard question", () => {+ it("can edit and publicly share a dashboard question", () => {cy.intercept("PUT", "/api/card/*").as("updateCard");H.createQuestion({@@ -360,6 +332,20 @@ describe("Dashboard > Dashboard Questions", () => {H.visitDashboard(S.ORDERS_DASHBOARD_ID);H.dashboardCards().findByText("Total Orders");H.dashboardCards().findByText("80.52");++ cy.log("share the dashboard question via public link");+ H.dashboardCards().findByText("Total Orders").click();+ H.openSharingMenu("Create a public link");+ cy.findByTestId("public-link-input")+ .invoke("val")+ .should("not.be.empty")+ .then((publicLink) => {+ cy.signOut();+ cy.visit(publicLink);+ cy.findByTestId("embed-frame-header")+ .findByText("Total Orders")+ .should("be.visible");+ });});it("can save a question directly to a dashboard", () => {@@ -464,48 +450,9 @@ describe("Dashboard > Dashboard Questions", () => {.should("be.visible");});- it("can move a question into a dashboard that already has a dashcard with the same question", () => {+ it("preserves bookmarks when moving a question to a dashboard that already has a dashcard with the same question", () => {cy.intercept("POST", "/api/cards/dashboards").as("cardDashboards");- H.visitQuestion(S.ORDERS_QUESTION_ID);- H.openQuestionActions();- H.popover().findByText("Move").click();- H.entityPickerModal().findByText("Orders in a dashboard").click();- H.entityPickerModal().button("Move").click();- // Quick check to ensure that the move confirmation modal doesn't hang around- cy.wait("@cardDashboards");- H.modal().should("not.exist");- // should only have one instance of this card- H.dashboardCards().findAllByText("Orders").should("have.length", 1);- });- it("can share a dashboard card via public link", () => {- H.createQuestion(- {- name: "Total Orders",- dashboard_id: S.ORDERS_DASHBOARD_ID,- query: {- "source-table": SAMPLE_DATABASE.ORDERS_ID,- aggregation: [["count"]],- },- display: "scalar",- },- { visitQuestion: true },- );-- H.openSharingMenu("Create a public link");- cy.findByTestId("public-link-input")- .invoke("val")- .should("not.be.empty")- .then((publicLink) => {- cy.signOut();- cy.visit(publicLink);- cy.findByTestId("embed-frame-header")- .findByText("Total Orders")- .should("be.visible");- });- });-- it("preserves bookmarks when moving a question to a dashboard", () => {// bookmark itH.visitQuestion(S.ORDERS_QUESTION_ID);H.queryBuilderHeader().icon("bookmark").click();@@ -518,11 +465,18 @@ describe("Dashboard > Dashboard Questions", () => {H.navigationSidebar().findByText("Orders");H.entityPickerModal().findByText("Orders in a dashboard").click();H.entityPickerModal().button("Move").click();+ // Quick check to ensure that the move confirmation modal doesn't hang around+ cy.wait("@cardDashboards");+ H.modal().should("not.exist");+ // should only have one instance of this card+ H.dashboardCards().findAllByText("Orders").should("have.length", 1);+ H.undoToast().findByText("Orders in a dashboard");H.visitDashboard(S.ORDERS_DASHBOARD_ID);// it's still bookmarkedcy.findByTestId("sidebar-toggle").click();H.navigationSidebar().findByText("Orders");H.dashboardCards().findByText("Orders").click();+ H.appBar().findByText("Orders in a dashboard");// unbookmark itH.queryBuilderHeader().icon("bookmark_filled").click();@@ -573,8 +527,13 @@ describe("Dashboard > Dashboard Questions", () => {cy.icon("copy").click();cy.findAllByTestId("dashcard").should("have.length", 2);H.showDashboardCardActions(0);- cy.icon("trash").should("not.exist");- cy.icon("close").should("exist");+ H.getDashboardCard(0)+ .findByTestId("dashboardcard-actions-panel")+ .should("be.visible")+ .within(() => {+ cy.icon("close").should("exist");+ cy.icon("trash").should("not.exist");+ });cy.log("should have the trash option if changes leave only one dashcard for a question",@@ -589,53 +548,6 @@ describe("Dashboard > Dashboard Questions", () => {cy.findAllByTestId("dashcard").should("have.length", 0);});- it("can delete a question from a dashboard without deleting all of the questions in metabase", () => {- H.createQuestion({- name: "Total Orders",- dashboard_id: S.ORDERS_DASHBOARD_ID,- query: {- "source-table": SAMPLE_DATABASE.ORDERS_ID,- aggregation: [["count"]],- },- display: "scalar",- });-- H.createQuestion(- {- name: "Total Orders deleted",- dashboard_id: S.ORDERS_DASHBOARD_ID,- query: {- "source-table": SAMPLE_DATABASE.ORDERS_ID,- aggregation: [["count"]],- },- display: "scalar",- },- { wrapId: true, idAlias: "deletedCardId" },- );-- // there has to be a card already in the trash from this dashboard for this to reproduce- cy.get("@deletedCardId").then((deletedCardId) => {- cy.request("PUT", `/api/card/${deletedCardId}`, { archived: true });- });-- // check that the 2 cards are there- H.visitDashboard(S.ORDERS_DASHBOARD_ID);- H.dashboardCards().findByText("Total Orders");- H.dashboardCards().findByText("Orders");-- // remove the card saved inside the dashboard- H.editDashboard();- H.dashboardCards().findByText("Total Orders").realHover();- // eslint-disable-next-line metabase/no-unsafe-element-filtering- cy.icon("trash").last().click();- H.undoToast().findByText("Trashed and removed card");- H.saveDashboard();-- // check that we didn't accidentally delete everything- H.dashboardCards().findByText("Total Orders").should("not.exist");- H.dashboardCards().findByText("Orders").should("be.visible");- });-it("can archive and unarchive a dashboard with cards saved inside it", () => {H.createDashboard({@@ -652,6 +564,16 @@ describe("Dashboard > Dashboard Questions", () => {H.addHeadingWhileEditing("A section");H.saveDashboard();+ cy.log("shallow copy is allowed without dashboard questions");+ H.openDashboardMenu("Duplicate");+ H.modal().within(() => {+ cy.findByDisplayValue("Dashboard with a title - Duplicate");+ cy.findByLabelText("Only duplicate the dashboard").should(+ "be.visible",+ );+ cy.button("Cancel").click();+ });+H.createQuestion({name: "Total Orders",dashboard_id: dashboardId,@@ -672,7 +594,30 @@ describe("Dashboard > Dashboard Questions", () => {display: "scalar",});+ // the copy form fetches the dashboard without a dashboard_load_id+ cy.intercept(+ { method: "GET", pathname: `/api/dashboard/${dashboardId}` },+ (req) => {+ if (!req.url.includes("dashboard_load_id")) {+ req.alias = "copyFormDashboard";+ }+ },+ );H.visitDashboard(dashboardId);++ cy.log("shallow copy is not allowed with dashboard questions");+ H.openDashboardMenu("Duplicate");+ cy.wait("@copyFormDashboard");+ H.modal().within(() => {+ cy.findByRole("heading", {+ name: 'Duplicate "Dashboard with a title" and its questions',+ });+ cy.findByLabelText("Only duplicate the dashboard").should(+ "not.exist",+ );+ cy.button("Cancel").click();+ });+H.openDashboardMenu("Move to trash");H.modal().button("Move to trash").click();cy.findByText(/gone wrong/, { timeout: 0 }).should("not.exist");@@ -696,7 +641,7 @@ describe("Dashboard > Dashboard Questions", () => {});});- it("can archive and unarchive a card within a dashboard", () => {+ it("can trash and restore dashboard questions without trashing other questions", () => {H.createQuestion({name: "Total Orders",dashboard_id: S.ORDERS_DASHBOARD_ID,@@ -725,8 +670,26 @@ describe("Dashboard > Dashboard Questions", () => {// check that it got removedH.visitDashboard(S.ORDERS_DASHBOARD_ID);+ H.dashboardCards().findByText("More Total Orders").should("be.visible");H.dashboardCards().findByText("Total Orders").should("not.exist");+ cy.log(+ "remove a dashboard question while another question from this dashboard is in the trash",+ );+ H.editDashboard();+ H.dashboardCards()+ .findByText("More Total Orders")+ .closest("[data-testid='dashcard']")+ .realHover()+ .icon("trash")+ .click();+ H.undoToast().findByText("Trashed and removed card");+ H.saveDashboard();++ // check that we didn't accidentally delete everything+ H.dashboardCards().findByText("More Total Orders").should("not.exist");+ H.dashboardCards().findByText("Orders").should("be.visible");+// restore itcy.visit("/trash");H.collectionTable().findByText("Total Orders");@@ -898,7 +861,7 @@ describe("Dashboard > Dashboard Questions", () => {H.modal().should("not.exist");});- it("should be able to save a question to a specific tab", () => {+ it("should be able to save or copy a question to a specific tab", () => {cy.intercept("POST", "/api/card").as("saveQuestion");const NO_TABS_DASH_NAME = "Orders in a dashboard";@@ -972,19 +935,10 @@ describe("Dashboard > Dashboard Questions", () => {H.dashboardCards().findByText(DASHBOARD_QUESTION_NAME).should("be.visible");- });-- it("should allow a user to copy a question into a tab", () => {- const TAB_ONE_NAME = "First tab";- H.createDashboardWithTabs({- name: "Dashboard with tabs",- tabs: [- { id: -1, name: TAB_ONE_NAME },- { id: -2, name: "Second tab" },- ],- dashcards: [],- });+ cy.findByTestId("edit-bar").button("Save").click();+ cy.findByTestId("edit-bar").should("not.exist");+ cy.log("copy a question into a tab");H.visitQuestion(S.ORDERS_COUNT_QUESTION_ID);H.openQuestionActions();H.popover().findByText("Duplicate").click();@@ -1035,6 +989,9 @@ describe("Dashboard > Dashboard Questions", () => {// should not show dashboard you can't write tocy.wait(["@getADashboard"]);+ H.modal()+ .findByLabelText(/Where do you want to save this/)+ .should("contain.text", "Personal Collection");H.modal().findByText(/Orders in a dashboard/).should("not.exist");@@ -1118,11 +1075,34 @@ describe("Dashboard > Dashboard Questions", () => {});describe("migration modal", () => {- it("should allow users to migrate questions in one dashboard into their respective dashboards", () => {+ it("should allow admins to migrate questions in one dashboard into their respective dashboards", () => {cy.signInAsAdmin();cy.log("seed data");seedMigrationToolData();+ cy.log("non-admins should not see the migration tool");+ cy.signIn("normal");+ H.visitCollection(S.FIRST_COLLECTION_ID);+ H.collectionTable().within(() => {+ cy.findByText(QUESTION_ONE).should("exist");+ cy.findByText(QUESTION_TWO).should("exist");+ cy.findByText(QUESTION_THREE).should("exist");+ });+ H.openCollectionMenu();+ H.popover().within(() => {+ cy.findByText("Move").should("be.visible");+ cy.findByText("Move questions into their dashboards").should(+ "not.exist",+ );+ });++ cy.log("non-admins should get redirected from the migration tool url");+ cy.visit(`/collection/${S.FIRST_COLLECTION_ID}/move-questions-dashboard`);+ cy.url().should("not.include", "move-questions-dashboard");+ cy.url().should("include", `/collection/${S.FIRST_COLLECTION_ID}`);++ cy.signInAsAdmin();+cy.log("assert questions are in the collection");H.visitCollection(S.FIRST_COLLECTION_ID);H.collectionTable().within(() => {@@ -1199,6 +1179,7 @@ describe("Dashboard > Dashboard Questions", () => {cy.log("assert option to migrate is no longer available");H.openCollectionMenu();H.popover().within(() => {+ cy.findByText("Move").should("be.visible");cy.findByText("Move questions into their dashboards").should("not.exist",);@@ -1223,9 +1204,15 @@ describe("Dashboard > Dashboard Questions", () => {cy.log("should be immediately responsive to dashcard changes making new candidates",);+ cy.intercept(+ "GET",+ "/api/collection/*/dashboard-question-candidates*",+ ).as("dashboardQuestionCandidates");H.visitCollection(S.FIRST_COLLECTION_ID);+ cy.wait("@dashboardQuestionCandidates");H.openCollectionMenu();H.popover().within(() => {+ cy.findByText("Move").should("be.visible");cy.findByText("Move questions into their dashboards").should("not.exist",);@@ -1248,34 +1235,6 @@ describe("Dashboard > Dashboard Questions", () => {cy.findByText(DASHBOARD_TWO).should("exist");});});-- it("should not show migration tool to non-admins", () => {- cy.signInAsAdmin();- cy.log("seed data");- seedMigrationToolData();- cy.signIn("normal");-- cy.log("assert questions are in the collection");- H.visitCollection(S.FIRST_COLLECTION_ID);- H.collectionTable().within(() => {- cy.findByText(QUESTION_ONE).should("exist");- cy.findByText(QUESTION_TWO).should("exist");- cy.findByText(QUESTION_THREE).should("exist");- });-- cy.log("user should not be able to engage with the tool");- H.openCollectionMenu();- H.popover().within(() => {- cy.findByText("Move questions into their dashboards").should(- "not.exist",- );- });-- cy.log("should get redirect if the user navigates to url directly");- cy.visit(`/collection/${S.FIRST_COLLECTION_ID}/move-questions-dashboard`);- cy.url().should("not.include", "move-questions-dashboard");- cy.url().should("include", `/collection/${S.FIRST_COLLECTION_ID}`);- });});});diff --git a/e2e/test/scenarios/dashboard/dashboard-reproductions.cy.spec.js b/e2e/test/scenarios/dashboard/dashboard-reproductions.cy.spec.jsindex 79e3e2118fb..fdd3ab5a7f8 100644--- a/e2e/test/scenarios/dashboard/dashboard-reproductions.cy.spec.js+++ b/e2e/test/scenarios/dashboard/dashboard-reproductions.cy.spec.js@@ -757,56 +757,6 @@ describe("issue 31274", () => {});});-describe("issue 31697", () => {- const segmentDetails = {- name: "Orders segment",- description: "All orders with a total under $100.",- definition: {- database: SAMPLE_DB_ID,- type: "query",- query: {- "source-table": ORDERS_ID,- filter: ["<", ["field", ORDERS.TOTAL, null], 100],- },- },- };-- const getQuestionDetails = (segment) => ({- display: "line",- query: {- "source-table": ORDERS_ID,- filter: ["segment", segment.id],- aggregation: [["count"]],- breakout: [["field", ORDERS.CREATED_AT, { "temporal-unit": "month" }]],- },- visualization_settings: {- "graph.metrics": ["count"],- "graph.dimensions": ["CREATED_AT"],- },- });-- beforeEach(() => {- H.restore();- cy.signInAsAdmin();- H.createSegment(segmentDetails).then(({ body: segment }) => {- H.createQuestion(getQuestionDetails(segment), { wrapId: true });- });- cy.intercept("GET", "/api/automagic-dashboards/**").as("xrayDashboard");- });-- it("should allow x-rays for questions with segments (metabase#31697)", () => {- cy.get("@questionId").then(H.visitQuestion);- H.cartesianChartCircle().eq(0).click();- H.popover().findByText("Automatic insights…").click();- H.popover().findByText("X-ray").click();- cy.wait("@xrayDashboard");-- cy.findByRole("main").within(() => {- cy.findByText(/A closer look at number of Orders/).should("be.visible");- });- });-});-describe("issue 31766", () => {function saveUpdatedQuestion() {cy.intercept("PUT", "/api/card/*").as("updateQuestion");@@ -986,6 +936,7 @@ describe("issue 34382", () => {.findAllByRole("gridcell").eq(3).should("contain", "Gizmo");+ cy.findByTestId("table-body").should("not.contain", "Doohickey");});});});diff --git a/e2e/test/scenarios/dashboard/x-rays.cy.spec.js b/e2e/test/scenarios/dashboard/x-rays.cy.spec.jsindex 2f396bf2c63..d46c422d6da 100644--- a/e2e/test/scenarios/dashboard/x-rays.cy.spec.js+++ b/e2e/test/scenarios/dashboard/x-rays.cy.spec.js@@ -15,25 +15,27 @@ describe("scenarios > x-rays", { tags: "@slow" }, () => {const XRAY_DATASETS = 5; // enough to load most questionsit("should not display x-rays if the feature is disabled in admin settings (metabase#26571)", () => {- cy.request("PUT", "api/setting/enable-xrays", { value: false });+ const xrayCaption =+ "Try out these sample x-rays to see what Metabase can do.";cy.visit("/");+ cy.findByTestId("home-page").should("contain", xrayCaption);- // eslint-disable-next-line metabase/no-unscoped-text-selectors -- deprecated usage- cy.findByText(- "Try out these sample x-rays to see what Metabase can do.",- ).should("not.exist");- // eslint-disable-next-line metabase/no-unscoped-text-selectors -- deprecated usage- cy.findByText(/^A summary of/).should("not.exist");- // eslint-disable-next-line metabase/no-unscoped-text-selectors -- deprecated usage- cy.findByText(/^A glance at/).should("not.exist");- // eslint-disable-next-line metabase/no-unscoped-text-selectors -- deprecated usage- cy.findByText(/^A look at/).should("not.exist");- // eslint-disable-next-line metabase/no-unscoped-text-selectors -- deprecated usage- cy.findByText(/^Some insights about/).should("not.exist");+ cy.request("PUT", "api/setting/enable-xrays", { value: false });+ cy.reload();++ cy.findByTestId("home-page").within(() => {+ cy.findByTestId("loading-indicator").should("not.exist");+ cy.findByText(xrayCaption).should("not.exist");+ cy.findByText(/^A summary of/).should("not.exist");+ cy.findByText(/^A glance at/).should("not.exist");+ cy.findByText(/^A look at/).should("not.exist");+ cy.findByText(/^Some insights about/).should("not.exist");+ });});- it("should work on questions with explicit joins (metabase#13112)", () => {+ it("should x-ray questions from a chart click (metabase#13112, metabase#31697, metabase#23820)", () => {+ cy.log("x-ray a question with explicit joins (metabase#13112)");const PRODUCTS_ALIAS = "Products";H.createQuestion(@@ -81,124 +83,189 @@ describe("scenarios > x-rays", { tags: "@slow" }, () => {cy.findByText("A closer look at number of Orders where Created At is in March 2027 and Category is Gadget",);+ H.dashboardGrid().findAllByTestId("dashcard").should("have.length.gt", 1);cy.icon("warning").should("not.exist");- });-- ["X-ray", "Compare to the rest"].forEach((action) => {- it(`"${action.toUpperCase()}" should work on a nested question made from base native question (metabase#15655)`, () => {- cy.intercept("GET", "/api/automagic-dashboards/**").as("xray");- H.createNativeQuestion({- name: "15655",- native: { query: "select * from people" },- }).then(({ body: { id } }) => {- H.createQuestion(- {- name: "Count of 15655 by SOURCE",- display: "bar",- query: {- "source-table": `card__${id}`,- aggregation: [["count"]],- breakout: [["field", "SOURCE", { "base-type": "type/Text" }]],- },+ cy.log("x-ray a question filtered by a segment (metabase#31697)");+ H.createSegment({+ name: "Orders segment",+ description: "All orders with a total under $100.",+ definition: {+ database: SAMPLE_DB_ID,+ type: "query",+ query: {+ "source-table": ORDERS_ID,+ filter: ["<", ["field", ORDERS.TOTAL, null], 100],+ },+ },+ }).then(({ body: segment }) => {+ H.createQuestion(+ {+ display: "line",+ query: {+ "source-table": ORDERS_ID,+ filter: ["segment", segment.id],+ aggregation: [["count"]],+ breakout: [+ ["field", ORDERS.CREATED_AT, { "temporal-unit": "month" }],+ ],+ },+ visualization_settings: {+ "graph.metrics": ["count"],+ "graph.dimensions": ["CREATED_AT"],},- { visitQuestion: true },- );+ },+ { visitQuestion: true },+ );+ });- H.chartPathWithFillColor("#509EE3").first().click({ force: true });+ cy.intercept("GET", "/api/automagic-dashboards/**").as("xrayDashboard");+ H.cartesianChartCircle().eq(0).click();+ H.popover().findByText("Automatic insights…").click();+ H.popover().findByText("X-ray").click();+ cy.wait("@xrayDashboard");- H.popover().within(() => {- cy.findByText("Automatic insights…").click();- cy.findByText(action).click();- });+ cy.findByRole("main").within(() => {+ cy.findByText(/A closer look at number of Orders/).should("be.visible");+ });++ cy.log(+ "x-ray a question with a day-of-week breakout and a null semantic type (metabase#23820)",+ );+ cy.request("PUT", `/api/field/${ORDERS.CREATED_AT}`, {+ semantic_type: null,+ });+ H.createQuestion(+ {+ name: "23820",+ query: {+ "source-table": ORDERS_ID,+ aggregation: [["count"]],+ breakout: [+ ["field", ORDERS.CREATED_AT, { "temporal-unit": "day-of-week" }],+ ],+ },+ display: "line",+ },+ { visitQuestion: true },+ );- // At this point, we ensure that the dashboard is created and displayed- // There are corresponding unit tests so if the timing/flake burden becomes too great, the rest of this test can be removed- cy.intercept("POST", "/api/dataset").as("postDataset");+ cy.intercept("POST", "/api/dataset").as("dataset");- cy.wait(Array(XRAY_DATASETS).fill("@postDataset"), {- timeout: 15 * 1000,- });+ H.cartesianChartCircle()+ .eq(3) // Wednesday+ .click();- cy.wait("@xray").then((xhr) => {- expect(xhr.response.body.cause).not.to.exist;- expect(xhr.response.statusCode).not.to.eq(500);- });+ H.popover().within(() => {+ cy.findByText("Automatic insights…").click();+ cy.findByText("X-ray").click();+ });- H.main().within(() => {- cy.findByText("A look at the number of 15655").should("exist");- });+ cy.wait("@dataset");- cy.findAllByTestId("dashcard-container");- });+ H.main().within(() => {+ cy.findByText(+ "A closer look at number of Orders where day of week of Created At is Wednesday",+ ).should("be.visible");});- it(`"${action.toUpperCase()}" should not show NULL in titles of generated dashboard cards (metabase#15737)`, () => {- cy.intercept("GET", "/api/automagic-dashboards/**").as("xray");- H.visitQuestionAdhoc({- name: "15737",- dataset_query: {- database: SAMPLE_DB_ID,+ getDashcardByTitle("A look at Created At fields").should("exist");++ getDashcardByTitle("A look at the number of Orders").should("exist");+ });++ it("should x-ray and compare a nested question made from base native question (metabase#15655)", () => {+ H.createNativeQuestion({+ name: "15655",+ native: { query: "select * from people" },+ }).then(({ body: { id } }) => {+ H.createQuestion(+ {+ name: "Count of 15655 by SOURCE",+ display: "bar",query: {- "source-table": PEOPLE_ID,+ "source-table": `card__${id}`,aggregation: [["count"]],- breakout: [["field", PEOPLE.SOURCE, null]],+ breakout: [["field", "SOURCE", { "base-type": "type/Text" }]],},- type: "query",},- display: "bar",- });-- H.chartPathWithFillColor("#509EE3").first().click();-- // eslint-disable-next-line metabase/no-unscoped-text-selectors -- deprecated usage- cy.findByText("Automatic insights…").click();- // eslint-disable-next-line metabase/no-unscoped-text-selectors -- deprecated usage- cy.findByText(action).click();- cy.wait("@xray");-- // eslint-disable-next-line metabase/no-unscoped-text-selectors -- deprecated usage- cy.contains("null").should("not.exist");+ { visitQuestion: true },+ );});- });- it("should be able to save an x-ray as a dashboard and visit it immediately (metabase#18028)", () => {- cy.intercept("GET", "/app/assets/geojson/**").as("geojson");+ ["X-ray", "Compare to the rest"].forEach((action, index) => {+ cy.log(action);+ if (index > 0) {+ cy.go("back");+ cy.url().should("include", "/question");+ H.queryBuilderHeader().should("be.visible");+ }- cy.visit(`/auto/dashboard/table/${ORDERS_ID}`);+ cy.intercept("GET", "/api/automagic-dashboards/**").as("xray");+ cy.intercept("POST", "/api/dataset").as("postDataset");- cy.wait("@geojson", { timeout: 10000 });+ H.chartPathWithFillColor("#509EE3").first().click({ force: true });- cy.button("Save this").click();+ H.popover().within(() => {+ cy.findByText("Automatic insights…").click();+ cy.findByText(action).click();+ });- cy.log(- "'See it' link should be displayed both in the header and in the toast",- );- H.undoToast()- .should("contain", "Your dashboard was saved")- .and("contain", "See it");+ cy.wait(Array(XRAY_DATASETS).fill("@postDataset"), {+ timeout: 15 * 1000,+ });+ cy.wait("@xray").its("response.statusCode").should("eq", 200);- cy.findByTestId("automatic-dashboard-header")- .findByRole("link", { name: "See it" })- .should("be.visible");+ H.main().within(() => {+ cy.findByText("A look at the number of 15655").should("exist");+ });- H.undoToast().findByRole("link", { name: "See it" }).realClick();+ cy.findAllByTestId("dashcard-container");+ });+ });- cy.url().should("contain", "a-look-at-orders");+ it("should not show NULL in titles of generated dashboard cards (metabase#15737)", () => {+ H.visitQuestionAdhoc({+ name: "15737",+ dataset_query: {+ database: SAMPLE_DB_ID,+ query: {+ "source-table": PEOPLE_ID,+ aggregation: [["count"]],+ breakout: [["field", PEOPLE.SOURCE, null]],+ },+ type: "query",+ },+ display: "bar",+ });- cy.log("toast should not stay paused after clicking a link inside it");- cy.get("body").realMouseMove(0, 0);- H.undoToast().should("not.have.attr", "data-paused");+ [+ { action: "X-ray", title: "Source is Affiliate" },+ {+ action: "Compare to the rest",+ title: "Comparison of Number of People by Source and People",+ },+ ].forEach(({ action, title }, index) => {+ cy.log(action);+ if (index > 0) {+ cy.go("back");+ cy.url().should("include", "/question");+ H.queryBuilderHeader().should("be.visible");+ }- cy.findAllByTestId("dashcard").contains("18,760");- // eslint-disable-next-line metabase/no-unscoped-text-selectors -- deprecated usage- cy.findByText("How these transactions are distributed");+ cy.intercept("GET", "/api/automagic-dashboards/**").as("xray");- H.openNavigationSidebar();+ H.chartPathWithFillColor("#509EE3").first().click();- H.navigationSidebar()- .findByRole("link", { name: /Automatically generated dashboards/i })- .should("exist");+ H.popover().within(() => {+ cy.findByText("Automatic insights…").click();+ cy.findByText(action).click();+ });+ cy.wait("@xray");++ H.main().should("contain", title);+ cy.contains("null").should("not.exist");+ });});it("should start loading cards from top to bottom", () => {@@ -209,23 +276,29 @@ describe("scenarios > x-rays", { tags: "@slow" }, () => {const successfullyLoadedCards = 1;const failedCards = totalRequests - successfullyLoadedCards;- cy.intercept({- method: "POST",- url: "/api/dataset",- times: successfullyLoadedCards,- }).as("dataset");-+ // Cypress runs the newest matching intercept first, so the stub for the+ // failed requests is registered before the pass-through for the first onecy.intercept({ method: "POST", url: "/api/dataset", times: failedCards },{ statusCode: 500 },).as("datasetFailed");+ cy.intercept(+ { method: "POST", url: "/api/dataset", times: successfullyLoadedCards },+ (req) => req.continue(),+ ).as("dataset");+cy.visit(`/auto/dashboard/table/${ORDERS_ID}`);cy.wait("@dataset");cy.wait("@datasetFailed");- H.getDashboardCards().eq(1).contains("Total transactions");+ getDashcardByTitle("Total transactions")+ .findByText("18,760")+ .should("be.visible");+ getDashcardByTitle("Transactions in the last 30 days")+ .icon("warning")+ .should("be.visible");});// TODO - this is a legitimate failure because `param_fields` are not returned for x-ray dashboards@@ -237,16 +310,24 @@ describe("scenarios > x-rays", { tags: "@slow" }, () => {cy.wait("@geojson", { timeout });// confirm results of "Total transactions" card are present- // eslint-disable-next-line metabase/no-unscoped-text-selectors -- deprecated usage- cy.findByText("18,760", timeout);- // eslint-disable-next-line metabase/no-unscoped-text-selectors -- deprecated usage- cy.findByText("Total transactions").click();+ getDashcardByTitle("Total transactions").findByText("18,760", timeout);+ H.dashboardGrid().findByText("Total transactions").click();// confirm we're in the query builder with the same resultscy.url().should("contain", "/question");- // eslint-disable-next-line metabase/no-unscoped-text-selectors -- deprecated usage- cy.findByText("18,760");+ H.queryBuilderMain().findByText("18,760");++ cy.log("return with the back to the x-ray button");+ H.queryBuilderHeader()+ .findByLabelText(/Back to .*Orders.*/)+ .click();+ getDashcardByTitle("Total transactions")+ .findByText("18,760", timeout)+ .should("be.visible");+ cy.log("return with the browser back button");+ H.dashboardGrid().findByText("Total transactions").click();+ H.queryBuilderMain().findByText("18,760");cy.go("back");// add a parameter filter to the auto dashboard@@ -273,19 +354,9 @@ describe("scenarios > x-rays", { tags: "@slow" }, () => {it("should correctly apply breakout in query builder (metabase#14648)", () => {cy.visit(`/auto/dashboard/table/${ORDERS_ID}`);- // canceled requests will still increment intercept counter- const NUMBER_OF_DATASET_REQUESTS = 8 * 2;- cy.intercept("POST", "/api/dataset").as("ordersDataset");-- cy.log("wait for dashcard with 18,760 dataset");-- waitForSatisfyingResponse(- "@ordersDataset",- { body: { data: { rows: [[18760]] } } },- NUMBER_OF_DATASET_REQUESTS,- );-- H.getDashboardCards().contains("18,760").click();+ getDashcardByTitle("Total transactions")+ .findByText("18,760", { timeout: 30000 })+ .click();H.popover().within(() => {cy.findByText("Break out by…").click();@@ -346,31 +417,18 @@ describe("scenarios > x-rays", { tags: "@slow" }, () => {cy.wait("@dataset", { timeout: 60000 });// Ensure charts actually got rendered- cy.get("text").contains("Created At");+ cy.url().should("include", "/auto/dashboard/");+ H.main()+ .findByText(+ /^A closer look at number of Orders where year of Created At is between/,+ )+ .should("be.visible");+ H.dashboardGrid().find("text").contains("Created At");},);});- it("should default x-ray dashboard width to 'fixed'", () => {- cy.intercept("POST", "/api/dataset").as("dataset");- cy.visit(`/auto/dashboard/table/${ORDERS_ID}`);- cy.wait("@dataset", { timeout: 60000 });-- // x-ray dashboards should default to 'fixed' width- cy.findByTestId("fixed-width-dashboard-header").should(- "have.css",- "max-width",- "1048px",- );- cy.findByTestId("fixed-width-filters").should(- "have.css",- "max-width",- "1048px",- );- cy.findByTestId("dashboard-grid").should("have.css", "max-width", "1048px");- });-- it("should render all cards without errors (metabase#48519)", () => {+ it("should render all cards of a table x-ray and save it as a dashboard (metabase#48519, metabase#18028)", () => {cy.intercept("POST", "/api/dataset").as("dataset");cy.visit(`/auto/dashboard/table/${ORDERS_ID}`);@@ -408,69 +466,53 @@ describe("scenarios > x-rays", { tags: "@slow" }, () => {getDashcardByTitle("Sales by coordinates").findByText("Leaflet").should("exist");- });- it("should work on questions with breakout by day-of-week and null semantic type (metabase#23820)", () => {- cy.request("PUT", `/api/field/${ORDERS.CREATED_AT}`, {- semantic_type: null,- });- H.createQuestion(- {- name: "23820",- query: {- "source-table": ORDERS_ID,- aggregation: [["count"]],- breakout: [- ["field", ORDERS.CREATED_AT, { "temporal-unit": "day-of-week" }],- ],- },- display: "line",- },- { visitQuestion: true },+ // x-ray dashboards should default to 'fixed' width+ cy.findByTestId("fixed-width-dashboard-header").should(+ "have.css",+ "max-width",+ "1048px",);+ cy.findByTestId("fixed-width-filters").should(+ "have.css",+ "max-width",+ "1048px",+ );+ cy.findByTestId("dashboard-grid").should("have.css", "max-width", "1048px");- cy.intercept("POST", "/api/dataset").as("dataset");+ cy.log("save the x-ray and visit it immediately (metabase#18028)");+ cy.button("Save this").click();- H.cartesianChartCircle()- .eq(3) // Wednesday- .click();+ cy.log(+ "'See it' link should be displayed both in the header and in the toast",+ );+ H.undoToast()+ .should("contain", "Your dashboard was saved")+ .and("contain", "See it");- H.popover().within(() => {- cy.findByText("Automatic insights…").click();- cy.findByText("X-ray").click();- });+ cy.findByTestId("automatic-dashboard-header")+ .findByRole("link", { name: "See it" })+ .should("be.visible");- cy.wait("@dataset");+ H.undoToast().findByRole("link", { name: "See it" }).realClick();- H.main().within(() => {- cy.findByText(- "A closer look at number of Orders where day of week of Created At is Wednesday",- ).should("be.visible");- });+ cy.url().should("contain", "a-look-at-orders");- getDashcardByTitle("A look at Created At fields").should("exist");+ cy.log("toast should not stay paused after clicking a link inside it");+ cy.get("body").realMouseMove(0, 0);+ H.undoToast().should("not.have.attr", "data-paused");- getDashcardByTitle("A look at the number of Orders").should("exist");- });-});+ cy.findAllByTestId("dashcard").contains("18,760");+ // eslint-disable-next-line metabase/no-unscoped-text-selectors -- deprecated usage+ cy.findByText("How these transactions are distributed");-function waitForSatisfyingResponse(- alias,- partialResponse,- maxRequests,- level = 0,-) {- if (level === maxRequests) {- throw `${maxRequests} requests exceeded`; // fail the test- }-- cy.wait(alias).then((interception) => {- const isMatch = Cypress._.isMatch(interception.response, partialResponse);- if (!isMatch) {- waitForSatisfyingResponse(alias, partialResponse, maxRequests, level + 1);- }+ H.openNavigationSidebar();++ H.navigationSidebar()+ .findByRole("link", { name: /Automatically generated dashboards/i })+ .should("exist");});-}+});function getDashcardByTitle(title) {return H.dashboardGrid()