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
feat(dashboard): move subscriptions to action menu (#64950)
Uladzimir Havenchykdc319ca76a75
diff --git a/e2e/support/helpers/e2e-email-helpers.js b/e2e/support/helpers/e2e-email-helpers.jsindex 772964c2782..538dc151b42 100644--- a/e2e/support/helpers/e2e-email-helpers.js+++ b/e2e/support/helpers/e2e-email-helpers.js@@ -1,4 +1,4 @@-import { openSharingMenu, sidebar } from "e2e/support/helpers";+import { openDashboardMenu, sidebar } from "e2e/support/helpers";import { WEBMAIL_CONFIG } from "../cypress_data";@@ -85,7 +85,7 @@ export const clickSend = () => {};export const openAndAddEmailsToSubscriptions = (recipients) => {- openSharingMenu("Subscriptions");+ openDashboardMenu("Subscriptions");sidebar().findByText("Set up a dashboard subscription").should("be.visible");diff --git a/e2e/test/scenarios/permissions/application-permissions.cy.spec.js b/e2e/test/scenarios/permissions/application-permissions.cy.spec.jsindex 1676ceff266..3542f48cb11 100644--- a/e2e/test/scenarios/permissions/application-permissions.cy.spec.js+++ b/e2e/test/scenarios/permissions/application-permissions.cy.spec.js@@ -85,7 +85,7 @@ describe("scenarios > admin > permissions > application", () => {cy.log("Set up a dashboard subscription");H.visitDashboard(ORDERS_DASHBOARD_ID);- H.openSharingMenu(/subscriptions/i);+ H.openDashboardMenu("Subscriptions");H.sidebar().findByText("Email this dashboard").should("exist");cy.log("Create a question alert");diff --git a/e2e/test/scenarios/permissions/permissions-reproductions.cy.spec.js b/e2e/test/scenarios/permissions/permissions-reproductions.cy.spec.jsindex 422650c491a..50b8c98471c 100644--- a/e2e/test/scenarios/permissions/permissions-reproductions.cy.spec.js+++ b/e2e/test/scenarios/permissions/permissions-reproductions.cy.spec.js@@ -359,7 +359,7 @@ describe("issue 22473", () => {it("nocollection user should be able to view and unsubscribe themselves from a subscription", () => {cy.visit(`/dashboard/${ORDERS_DASHBOARD_ID}`);- H.openSharingMenu("Subscriptions");+ H.openDashboardMenu("Subscriptions");// eslint-disable-next-line metabase/no-unscoped-text-selectors -- deprecated usagecy.findByText("Email it").click();cy.findByPlaceholderText("Enter user names or email addresses")diff --git a/e2e/test/scenarios/permissions/sandboxing/sandboxing-via-api.cy.spec.js b/e2e/test/scenarios/permissions/sandboxing/sandboxing-via-api.cy.spec.jsindex 80aa940dfa9..73095cc12ad 100644--- a/e2e/test/scenarios/permissions/sandboxing/sandboxing-via-api.cy.spec.js+++ b/e2e/test/scenarios/permissions/sandboxing/sandboxing-via-api.cy.spec.js@@ -1111,7 +1111,7 @@ describe("admin > permissions > sandboxes (tested via the API)", () => {cy.signInAsSandboxedUser();H.visitDashboard(ORDERS_DASHBOARD_ID);- H.openSharingMenu("Subscriptions");+ H.openDashboardMenu("Subscriptions");// should forward to email since that is the only one setupH.sidebar().findByText("Email this dashboard").should("exist");@@ -1233,7 +1233,7 @@ describe("admin > permissions > sandboxes (tested via the API)", () => {columnAssertion: Number(USERS.sandboxed.login_attributes.attr_uid),});- H.openSharingMenu("Subscriptions");+ H.openDashboardMenu("Subscriptions");H.sidebar().findByPlaceholderText("Enter user names or email addresses")diff --git a/e2e/test/scenarios/sharing/alert/alert.cy.spec.js b/e2e/test/scenarios/sharing/alert/alert.cy.spec.jsindex 21d00c4aeca..8812d988c3e 100644--- a/e2e/test/scenarios/sharing/alert/alert.cy.spec.js+++ b/e2e/test/scenarios/sharing/alert/alert.cy.spec.js@@ -197,7 +197,7 @@ describe("scenarios > alert", () => {it("should validate approved email domains for a dashboard subscription (metabase#17977)", () => {H.visitDashboard(ORDERS_DASHBOARD_ID);- H.openSharingMenu("Subscriptions");+ H.openDashboardMenu("Subscriptions");H.sidebar().within(() => {cy.findByText("Email it").click();@@ -231,7 +231,7 @@ describe("scenarios > alert", () => {});H.visitDashboard(ORDERS_DASHBOARD_ID);- H.openSharingMenu("Subscriptions");+ H.openDashboardMenu("Subscriptions");H.sidebar().within(() => {addEmailRecipient(deniedEmail);diff --git a/e2e/test/scenarios/sharing/sharing-reproductions.cy.spec.js b/e2e/test/scenarios/sharing/sharing-reproductions.cy.spec.jsindex 1557abeccc2..d70a6cdf359 100644--- a/e2e/test/scenarios/sharing/sharing-reproductions.cy.spec.js+++ b/e2e/test/scenarios/sharing/sharing-reproductions.cy.spec.js@@ -33,7 +33,7 @@ describe("issue 18009", { tags: "@external" }, () => {it("nodata user should be able to create and receive an email subscription without errors (metabase#18009)", () => {H.visitDashboard(ORDERS_DASHBOARD_ID);- H.openSharingMenu("Subscriptions");+ H.openDashboardMenu("Subscriptions");H.sidebar().findByPlaceholderText("Enter user names or email addresses")@@ -89,7 +89,7 @@ describe("issue 18344", { tags: "@external" }, () => {it("subscription should not include original question name when it's been renamed in the dashboard (metabase#18344)", () => {// Send a test email subscription- H.openSharingMenu("Subscriptions");+ H.openDashboardMenu("Subscriptions");// eslint-disable-next-line metabase/no-unscoped-text-selectors -- deprecated usagecy.findByText("Email it").click();@@ -134,7 +134,7 @@ describe("issue 18352", { tags: "@external" }, () => {});it("should send the card with the INT64 values (metabase#18352)", () => {- H.openSharingMenu("Subscriptions");+ H.openDashboardMenu("Subscriptions");// eslint-disable-next-line metabase/no-unscoped-text-selectors -- deprecated usagecy.findByText("Email it").click();@@ -205,7 +205,7 @@ describe("issue 18669", { tags: "@external" }, () => {});it("should send a test email with non-default parameters (metabase#18669)", () => {- H.openSharingMenu("Subscriptions");+ H.openDashboardMenu("Subscriptions");// eslint-disable-next-line metabase/no-unscoped-text-selectors -- deprecated usagecy.findByText("Email it").click();@@ -699,7 +699,7 @@ describe("issue 30314", () => {it("should clean the new subscription form on cancel (metabase#30314)", () => {H.visitDashboard(ORDERS_DASHBOARD_ID);- H.openSharingMenu("Subscriptions");+ H.openDashboardMenu("Subscriptions");H.sidebar().within(() => {cy.findByText("Email it").click();@@ -770,7 +770,7 @@ describe("issue 17657", () => {it("frontend should gracefully handle the case of a subscription without a recipient (metabase#17657)", () => {H.visitDashboard(ORDERS_DASHBOARD_ID);- H.openSharingMenu("Subscriptions");+ H.openDashboardMenu("Subscriptions");// eslint-disable-next-line metabase/no-unscoped-text-selectors -- deprecated usagecy.findByText(/^Emailed monthly/).click();@@ -865,7 +865,7 @@ describe("issue 17658", { tags: "@external" }, () => {it("should delete dashboard subscription from any collection (metabase#17658)", () => {H.visitDashboard(ORDERS_DASHBOARD_ID);- H.openSharingMenu("Subscriptions");+ H.openDashboardMenu("Subscriptions");// eslint-disable-next-line metabase/no-unscoped-text-selectors -- deprecated usagecy.findByText(/^Emailed monthly/).click();@@ -1004,7 +1004,7 @@ describe("issue 49525", { tags: "@external" }, () => {it("Subscriptions with 'Keep the data pivoted' checked should work (metabase#49525)", () => {// Send a test email subscription- H.openSharingMenu("Subscriptions");+ H.openDashboardMenu("Subscriptions");H.sidebar().within(() => {cy.findByText("Email it").click();cy.findByPlaceholderText("Enter user names or email addresses").click();diff --git a/e2e/test/scenarios/sharing/subscriptions.cy.spec.js b/e2e/test/scenarios/sharing/subscriptions.cy.spec.jsindex 50f05b37eaf..85ea37312bd 100644--- a/e2e/test/scenarios/sharing/subscriptions.cy.spec.js+++ b/e2e/test/scenarios/sharing/subscriptions.cy.spec.js@@ -51,7 +51,7 @@ describe("scenarios > dashboard > subscriptions", () => {openDashboardSubscriptions();// The sidebar starts open after the method there, so test that clicking the icon closes it- H.openSharingMenu("Subscriptions");+ H.openDashboardMenu("Subscriptions");H.sidebar().should("not.exist");});});@@ -517,8 +517,8 @@ describe("scenarios > dashboard > subscriptions", () => {it("should allow non-admin users to create subscriptions", () => {cy.signInAsNormalUser();H.visitDashboard(ORDERS_DASHBOARD_ID);- H.openSharingMenu();- H.sharingMenu().findByText("Subscriptions").should("be.visible");+ H.openDashboardMenu();+ H.popover().findByText("Subscriptions").should("be.visible");});});@@ -829,7 +829,7 @@ describe("scenarios > dashboard > subscriptions", () => {function openDashboardSubscriptions(dashboard_id = ORDERS_DASHBOARD_ID) {// Orders in a dashboardH.visitDashboard(dashboard_id);- H.openSharingMenu("Subscriptions");+ H.openDashboardMenu("Subscriptions");}function assignRecipient({diff --git a/frontend/src/metabase/dashboard/components/DashboardHeader/buttons/DashboardActionMenu.tsx b/frontend/src/metabase/dashboard/components/DashboardHeader/buttons/DashboardActionMenu.tsxindex e5ca64b6e94..9b6595f192f 100644--- a/frontend/src/metabase/dashboard/components/DashboardHeader/buttons/DashboardActionMenu.tsx+++ b/frontend/src/metabase/dashboard/components/DashboardHeader/buttons/DashboardActionMenu.tsx@@ -4,8 +4,12 @@ import type { WithRouterProps } from "react-router/lib/withRouter";import { c, t } from "ttag";import { ToolbarButton } from "metabase/common/components/ToolbarButton";+import { setSharing as setDashboardSubscriptionSidebarOpen } from "metabase/dashboard/actions";import { useDashboardContext } from "metabase/dashboard/context/context";import { useRefreshDashboard } from "metabase/dashboard/hooks";+import { getIsSharing as getIsDashboardSubscriptionSidebarOpen } from "metabase/dashboard/selectors";+import { useDispatch, useSelector } from "metabase/lib/redux";+import { DashboardSubscriptionMenuItem } from "metabase/notifications/NotificationsActionsMenu/DashboardSubscriptionMenuItem";import { useRegisterShortcut } from "metabase/palette/hooks/useRegisterShortcut";import { PLUGIN_MODERATION } from "metabase/plugins";import { Icon, Menu } from "metabase/ui";@@ -37,6 +41,7 @@ const DashboardActionMenuInner = ({const { dashboard, isFullscreen, onFullscreenChange, onChangeLocation } =useDashboardContext();const [opened, setOpened] = useState(false);+ const dispatch = useDispatch();const { refreshDashboard } = useRefreshDashboard({dashboardId: dashboard?.id ?? null,@@ -48,6 +53,15 @@ const DashboardActionMenuInner = ({refreshDashboard,);+ const isDashboardSubscriptionSidebarOpen = useSelector(+ getIsDashboardSubscriptionSidebarOpen,+ );++ const toggleSubscriptionSidebar = () =>+ dispatch(+ setDashboardSubscriptionSidebarOpen(!isDashboardSubscriptionSidebarOpen),+ );+// solely for the dependency list below, so we don't ever have an undefinedconst pathname = location?.pathname ?? "";useRegisterShortcut(@@ -89,6 +103,11 @@ const DashboardActionMenuInner = ({</Menu.Item>)}+ <DashboardSubscriptionMenuItem+ dashboard={dashboard}+ onClick={toggleSubscriptionSidebar}+ />+<Menu.ItemleftSection={<Icon name="expand" />}onClick={(e: MouseEvent) =>diff --git a/frontend/src/metabase/dashboard/components/DashboardHeader/buttons/DashboardActionMenu.unit.spec.tsx b/frontend/src/metabase/dashboard/components/DashboardHeader/buttons/DashboardActionMenu.unit.spec.tsxnew file mode 100644index 00000000000..9e91c4731f2--- /dev/null+++ b/frontend/src/metabase/dashboard/components/DashboardHeader/buttons/DashboardActionMenu.unit.spec.tsx@@ -0,0 +1,224 @@+import userEvent from "@testing-library/user-event";+import { Route } from "react-router";++import { setupEnterpriseOnlyPlugin } from "__support__/enterprise";+import { setupNotificationChannelsEndpoints } from "__support__/server-mocks/pulse";+import { mockSettings } from "__support__/settings";+import { renderWithProviders, screen } from "__support__/ui";+import { getIsSharing } from "metabase/dashboard/selectors";+import { MockDashboardContext } from "metabase/public/containers/PublicOrEmbeddedDashboard/mock-context";+import type { ChannelApiResponse, User } from "metabase-types/api";+import {+ createMockCard,+ createMockDashboard,+ createMockDashboardCard,+ createMockSettings,+ createMockTokenFeatures,+ createMockUser,+} from "metabase-types/api/mocks";+import { createMockDashboardState } from "metabase-types/store/mocks";++import { DashboardActionMenu } from "./DashboardActionMenu";++const DASHCARD = createMockDashboardCard({+ card: createMockCard({ display: "pie" }),+});++const setup = ({+ isAdmin = false,+ hasEmailSetup = false,+ hasSlackSetup = false,+ canManageSubscriptions,+ isEnterprise = false,+ dashboard: dashboardOverrides = {},+}: {+ isAdmin?: boolean;+ hasEmailSetup?: boolean;+ hasSlackSetup?: boolean;+ canManageSubscriptions?: boolean;+ isEnterprise?: boolean;+ dashboard?: Partial<ReturnType<typeof createMockDashboard>>;+} = {}) => {+ const dashboard = createMockDashboard({+ dashcards: [DASHCARD],+ ...dashboardOverrides,+ });++ if (isEnterprise) {+ setupEnterpriseOnlyPlugin("application_permissions");+ }++ const currentUser = createMockUser({+ is_superuser: isAdmin,+ });++ setupNotificationChannelsEndpoints({+ email: { configured: hasEmailSetup },+ slack: { configured: hasSlackSetup },+ } as ChannelApiResponse["channels"]);++ const { store } = renderWithProviders(+ <Route+ path="*"+ component={() => (+ <MockDashboardContext+ dashboardId={dashboard.id}+ dashboard={dashboard}+ isFullscreen={false}+ onFullscreenChange={jest.fn()}+ parameterQueryParams={{}}+ >+ <DashboardActionMenu+ canResetFilters={false}+ onResetFilters={jest.fn()}+ canEdit={false}+ openSettingsSidebar={jest.fn()}+ />+ </MockDashboardContext>+ )}+ />,+ {+ withRouter: true,+ storeInitialState: {+ currentUser: isEnterprise+ ? ({+ ...currentUser,+ permissions: {+ can_access_subscription: canManageSubscriptions ?? false,+ },+ } as User)+ : currentUser,+ ...(isEnterprise && {+ settings: mockSettings(+ createMockSettings({+ "token-features": createMockTokenFeatures({+ advanced_permissions: true,+ }),+ }),+ ),+ }),+ dashboard: createMockDashboardState({+ dashboardId: dashboard.id,+ dashboards: {+ [dashboard.id]: {+ ...dashboard,+ dashcards: dashboard.dashcards.map((c) => c.id),+ },+ },+ dashcards: {+ [DASHCARD.id]: {+ ...DASHCARD,+ isDirty: false,+ isRemoved: false,+ },+ },+ }),+ },+ },+ );++ return { store };+};++const openMenu = () => {+ return userEvent.click(+ screen.getByRole("button", { name: /Move, trash, and more/ }),+ );+};++describe("DashboardActionMenu", () => {+ describe("dashboard subscriptions", () => {+ describe("admins", () => {+ it("should show the 'Subscriptions' menu item if email and slack are not setup", async () => {+ setup({ isAdmin: true, hasEmailSetup: false, hasSlackSetup: false });+ await openMenu();+ expect(await screen.findByText("Subscriptions")).toBeInTheDocument();+ });++ it("should show the 'Subscriptions' menu item if email and slack are setup", async () => {+ setup({ isAdmin: true, hasEmailSetup: true, hasSlackSetup: true });+ await openMenu();+ expect(await screen.findByText("Subscriptions")).toBeInTheDocument();+ });++ it("should toggle the subscriptions sidebar on click", async () => {+ const { store } = setup({ isAdmin: true });+ expect(getIsSharing(store.getState())).toBe(false);+ await openMenu();+ await userEvent.click(await screen.findByText("Subscriptions"));+ expect(getIsSharing(store.getState())).toBe(true);+ await openMenu();+ await userEvent.click(await screen.findByText("Subscriptions"));+ expect(getIsSharing(store.getState())).toBe(false);+ });++ it("should not show the subscriptions menu item if there are no data cards", async () => {+ setup({+ isAdmin: true,+ dashboard: {+ dashcards: [+ createMockDashboardCard({+ card: createMockCard({ display: "text" }),+ }),+ ],+ },+ });+ await openMenu();+ expect(screen.queryByText("Subscriptions")).not.toBeInTheDocument();+ });+ });++ describe("non-admins", () => {+ it("should show 'Subscriptions' option when email is set up, but slack is not setup", async () => {+ setup({ isAdmin: false, hasEmailSetup: true, hasSlackSetup: false });+ await openMenu();+ expect(await screen.findByText("Subscriptions")).toBeInTheDocument();+ });++ it("should show 'Subscriptions' option when email is not set up, but slack is setup", async () => {+ setup({ isAdmin: false, hasEmailSetup: false, hasSlackSetup: true });+ await openMenu();+ expect(await screen.findByText("Subscriptions")).toBeInTheDocument();+ });++ it("should not show the subscriptions menu item if there are no data cards", async () => {+ setup({+ isAdmin: false,+ dashboard: {+ dashcards: [+ createMockDashboardCard({+ card: createMockCard({ display: "heading" }),+ }),+ ],+ },+ });+ await openMenu();+ expect(screen.queryByText("Subscriptions")).not.toBeInTheDocument();+ });+ });++ describe("enterprise", () => {+ it('should show the "Subscriptions" menu item to non-admins with subscription permissions', async () => {+ setup({+ canManageSubscriptions: true,+ hasEmailSetup: true,+ isEnterprise: true,+ isAdmin: false,+ });+ await openMenu();+ expect(await screen.findByText("Subscriptions")).toBeInTheDocument();+ });++ it('should not show the "Subscriptions" menu item to non-admins without subscription permissions', async () => {+ setup({+ canManageSubscriptions: false,+ hasEmailSetup: true,+ isEnterprise: true,+ isAdmin: false,+ });+ await openMenu();+ expect(screen.queryByText("Subscriptions")).not.toBeInTheDocument();+ });+ });+ });+});diff --git a/frontend/src/metabase/embedding/components/PublicLinkPopover/PublicLinkCopyPanel.tsx b/frontend/src/metabase/embedding/components/PublicLinkPopover/PublicLinkCopyPanel.tsxindex 71eecfd965e..53abde3511e 100644--- a/frontend/src/metabase/embedding/components/PublicLinkPopover/PublicLinkCopyPanel.tsx+++ b/frontend/src/metabase/embedding/components/PublicLinkPopover/PublicLinkCopyPanel.tsx@@ -43,7 +43,7 @@ export const PublicLinkCopyPanel = ({readOnlydata-testid="public-link-input"placeholder={loading ? t`Loading…` : undefined}- value={url ?? undefined}+ value={url ?? ""}inputWrapperOrder={["label", "input", "error", "description"]}rightSection={url && <PublicLinkCopyButton value={url} onCopy={onCopy} />}/>diff --git a/frontend/src/metabase/embedding/components/SharingMenu/DashboardSharingMenu.tsx b/frontend/src/metabase/embedding/components/SharingMenu/DashboardSharingMenu.tsxindex 3510b4fa285..f073563868c 100644--- a/frontend/src/metabase/embedding/components/SharingMenu/DashboardSharingMenu.tsx+++ b/frontend/src/metabase/embedding/components/SharingMenu/DashboardSharingMenu.tsx@@ -1,12 +1,7 @@import { isInstanceAnalyticsCollection } from "metabase/collections/utils";-import { setSharing as setDashboardSubscriptionSidebarOpen } from "metabase/dashboard/actions";-import {- getIsDashCardsRunning,- getIsSharing as getIsDashboardSubscriptionSidebarOpen,-} from "metabase/dashboard/selectors";+import { getIsDashCardsRunning } from "metabase/dashboard/selectors";import { GUEST_EMBED_EMBEDDING_TYPE } from "metabase/embedding/constants";-import { useDispatch, useSelector } from "metabase/lib/redux";-import { DashboardSubscriptionMenuItem } from "metabase/notifications/NotificationsActionsMenu/DashboardSubscriptionMenuItem";+import { useSelector } from "metabase/lib/redux";import { Flex, Menu } from "metabase/ui";import type { Dashboard } from "metabase-types/api";@@ -20,16 +15,6 @@ import { SharingMenu } from "./SharingMenu";import type { DashboardSharingModalType } from "./types";export function DashboardSharingMenu({ dashboard }: { dashboard: Dashboard }) {- const dispatch = useDispatch();-- const isDashboardSubscriptionSidebarOpen = useSelector(- getIsDashboardSubscriptionSidebarOpen,- );- const toggleSubscriptionSidebar = () =>- dispatch(- setDashboardSubscriptionSidebarOpen(!isDashboardSubscriptionSidebarOpen),- );-const { modalType, setModalType } =useSharingModal<DashboardSharingModalType>({resource: dashboard,@@ -51,10 +36,6 @@ export function DashboardSharingMenu({ dashboard }: { dashboard: Dashboard }) {return (<Flex><SharingMenu>- <DashboardSubscriptionMenuItem- onClick={toggleSubscriptionSidebar}- dashboard={dashboard}- /><ExportPdfMenuItem dashboard={dashboard} loading={isDashCardsRunning} />{canShare && (<>diff --git a/frontend/src/metabase/embedding/components/SharingMenu/test/DashboardSharingMenu.enterprise.unit.spec.tsx b/frontend/src/metabase/embedding/components/SharingMenu/test/DashboardSharingMenu.enterprise.unit.spec.tsxindex 2a5b1a14b5c..a5d0ee823d2 100644--- a/frontend/src/metabase/embedding/components/SharingMenu/test/DashboardSharingMenu.enterprise.unit.spec.tsx+++ b/frontend/src/metabase/embedding/components/SharingMenu/test/DashboardSharingMenu.enterprise.unit.spec.tsx@@ -4,28 +4,6 @@ import { createMockCollection } from "metabase-types/api/mocks";import { openMenu, setupDashboardSharingMenu } from "./setup";describe("DashboardSharingMenu > Enterprise", () => {- it('Should show the "Subscriptions" menu item to non-admins if the user has subscriptions/alerts permissions', async () => {- await setupDashboardSharingMenu({- canManageSubscriptions: true,- isEmailSetup: true,- isEnterprise: true,- isAdmin: false,- });- await openMenu();- expect(screen.getByText("Subscriptions")).toBeInTheDocument();- });-- it('Should not show the "Subscriptions" menu item to non-admins if the user lacks subscriptions/alerts permissions', async () => {- await setupDashboardSharingMenu({- canManageSubscriptions: false,- isEmailSetup: true,- isEnterprise: true,- isAdmin: false,- });- await openMenu();- expect(screen.queryByText("Subscriptions")).not.toBeInTheDocument();- });-it("should not allow embedding instance analytics dashboard", async () => {setupDashboardSharingMenu({isAdmin: true,diff --git a/frontend/src/metabase/embedding/components/SharingMenu/test/DashboardSharingMenu.unit.spec.tsx b/frontend/src/metabase/embedding/components/SharingMenu/test/DashboardSharingMenu.unit.spec.tsxindex 5722b99624d..5cbd0fb96dc 100644--- a/frontend/src/metabase/embedding/components/SharingMenu/test/DashboardSharingMenu.unit.spec.tsx+++ b/frontend/src/metabase/embedding/components/SharingMenu/test/DashboardSharingMenu.unit.spec.tsx@@ -1,10 +1,4 @@-import userEvent from "@testing-library/user-event";-import { screen } from "__support__/ui";-import {- createMockCard,- createMockDashboardCard,-} from "metabase-types/api/mocks";import { openMenu, setupDashboardSharingMenu } from "./setup";@@ -28,93 +22,6 @@ describe("DashboardSharingMenu", () => {expect(screen.queryByTestId("sharing-menu-button")).not.toBeInTheDocument();});- describe("dashboard subscriptions", () => {- describe("admins", () => {- it("should show the 'Subscriptions' menu item if email and slack are not setup", async () => {- setupDashboardSharingMenu({- isAdmin: true,- isEmailSetup: false,- isSlackSetup: false,- });- await openMenu();- expect(screen.getByText("Subscriptions")).toBeInTheDocument();- });-- it("should show the 'Subscriptions' menu item if email and slack are setup", async () => {- setupDashboardSharingMenu({- isAdmin: true,- isEmailSetup: true,- isSlackSetup: true,- });- await openMenu();- expect(screen.getByText("Subscriptions")).toBeInTheDocument();- });-- it("Should toggle the subscriptions sidebar on click", async () => {- setupDashboardSharingMenu({ isAdmin: true });- await openMenu();- await userEvent.click(screen.getByText("Subscriptions"));- expect(screen.getByTestId("fake-sidebar")).toHaveTextContent(- "Sidebar: sharing",- );- });-- it("should not show the subscriptions menu item if there are no data cards", async () => {- setupDashboardSharingMenu({- isAdmin: true,- dashboard: {- dashcards: [- createMockDashboardCard({- card: createMockCard({ display: "text" }),- }),- ],- },- });- await openMenu();- expect(screen.queryByText("Subscriptions")).not.toBeInTheDocument();- });- });-- describe("non-admins", () => {- it("should show 'subscriptions' option when email is set up, but slack is not setup", async () => {- setupDashboardSharingMenu({- isAdmin: false,- isEmailSetup: true,- isSlackSetup: false,- });- await openMenu();- expect(screen.getByText("Subscriptions")).toBeInTheDocument();- });-- it("should show 'subscriptions' option when email is not set up, but slack is setup", async () => {- setupDashboardSharingMenu({- isAdmin: false,- isEmailSetup: false,- isSlackSetup: true,- });- await openMenu();- expect(- await screen.findByText("Subscriptions", { exact: true }),- ).toBeInTheDocument();- });-- it("should not show the subscriptions menu item if there are no data cards", async () => {- setupDashboardSharingMenu({- isAdmin: false,- dashboard: {- dashcards: [- createMockDashboardCard({- card: createMockCard({ display: "heading" }),- }),- ],- },- });- await openMenu();- expect(screen.queryByText("Subscriptions")).not.toBeInTheDocument();- });- });- });-describe("pdf export", () => {["admin", "non-admin"].forEach((userType) => {it(`should show the "Export as PDF" menu item for ${userType}`, async () => {