From 9c0ab06d54716ee1e2162851ee2e205b903fc241 Mon Sep 17 00:00:00 2001
From: Nemanja Glumac <31325167+nemanjaglumac@users.noreply.github.com>
Date: Wed, 20 Oct 2021 20:38:05 +0200
Subject: [PATCH] #18547 Repro: Wrong id used in links for questions added to
 dashboard in the activity page (#18575)

---
 .../onboarding/home/activity-page.cy.spec.js  | 38 ++++++++++++++++++-
 1 file changed, 37 insertions(+), 1 deletion(-)

diff --git a/frontend/test/metabase/scenarios/onboarding/home/activity-page.cy.spec.js b/frontend/test/metabase/scenarios/onboarding/home/activity-page.cy.spec.js
index 09cf4a2b511..68ffa3349a9 100644
--- a/frontend/test/metabase/scenarios/onboarding/home/activity-page.cy.spec.js
+++ b/frontend/test/metabase/scenarios/onboarding/home/activity-page.cy.spec.js
@@ -1,5 +1,12 @@
 //Replaces HomepageApp.e2e.spec.js
-import { restore, openProductsTable, popover } from "__support__/e2e/cypress";
+import {
+  restore,
+  openProductsTable,
+  popover,
+  sidebar,
+  editDashboard,
+  saveDashboard,
+} from "__support__/e2e/cypress";
 
 describe("metabase > scenarios > home > activity-page", () => {
   beforeEach(() => {
@@ -47,4 +54,33 @@ describe("metabase > scenarios > home > activity-page", () => {
     cy.findAllByText("Robert").should("have.length", 2);
     cy.findByText("Products, Filtered by Rating");
   });
+
+  it.skip("should respect the (added to dashboard) card id in the link (metabase#18547)", () => {
+    cy.intercept("GET", `/api/dashboard/1`).as("dashboard");
+
+    cy.visit("/dashboard/1");
+    cy.wait("@dashboard");
+
+    editDashboard();
+
+    cy.icon("add")
+      .last()
+      .click();
+
+    sidebar().within(() => {
+      cy.get(".LoadingSpinner").should("not.exist");
+      cy.findByText("Orders").click();
+    });
+
+    saveDashboard();
+    cy.wait("@dashboard");
+
+    cy.visit("/activity");
+
+    cy.contains("You added a question to the dashboard - Orders in a dashboard")
+      .closest("li")
+      .findByRole("link", { name: "Orders" })
+      .should("have.attr", "href")
+      .and("include", "question/1");
+  });
 });
-- 
GitLab