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 embed setup wizard e2e specs (#83911)
Chris Vandoodewaardb162165a6bc4
diff --git a/e2e/test/scenarios/embedding/sdk-iframe-embedding-setup/common-oss-and-starter.cy.spec.ts b/e2e/test/scenarios/embedding/sdk-iframe-embedding-setup/common-oss-and-starter.cy.spec.tsdeleted file mode 100644index b0d1dd9f2a2..00000000000--- a/e2e/test/scenarios/embedding/sdk-iframe-embedding-setup/common-oss-and-starter.cy.spec.ts+++ /dev/null@@ -1,48 +0,0 @@-import { ORDERS_COUNT_QUESTION_ID } from "e2e/support/cypress_sample_instance_data";--import { visitNewEmbedPage } from "./helpers";--const { H } = cy;--describe("scenarios > embedding > sdk iframe embed setup > common (oss and starter)", () => {- describe("OSS", { tags: "@OSS" }, () => runTests({ token: null }));-- describe("Starter", () => runTests({ token: "starter" }));-- function runTests({ token }: { token: "starter" | null }) {- beforeEach(() => {- H.restore();- cy.signInAsAdmin();-- if (token) {- H.activateToken(token);- }-- H.enableTracking();-- cy.intercept("GET", "/api/dashboard/**").as("dashboard");-- H.mockEmbedJsToDevServer();- });-- it("allows to select the `guest` item even when static embedding setting is disabled", () => {- H.updateSetting("enable-embedding-modular", false);-- H.visitQuestion(ORDERS_COUNT_QUESTION_ID);-- visitNewEmbedPage({ waitForResource: false });-- cy.findByLabelText("Guest").should("be.enabled");- });-- it("does not allow to select the `Metabase Account`, when token feature is missing (oss)", () => {- H.updateSetting("enable-embedding-modular", false);-- H.visitQuestion(ORDERS_COUNT_QUESTION_ID);-- visitNewEmbedPage({ waitForResource: false });-- cy.findByLabelText("Metabase account (SSO)").should("be.disabled");- });- }-});diff --git a/e2e/test/scenarios/embedding/sdk-iframe-embedding-setup/common-ee.cy.spec.ts b/e2e/test/scenarios/embedding/sdk-iframe-embedding-setup/common.cy.spec.tssimilarity index 68%rename from e2e/test/scenarios/embedding/sdk-iframe-embedding-setup/common-ee.cy.spec.tsrename to e2e/test/scenarios/embedding/sdk-iframe-embedding-setup/common.cy.spec.tsindex d1e28a749bb..cf69ba9c11c 100644--- a/e2e/test/scenarios/embedding/sdk-iframe-embedding-setup/common-ee.cy.spec.ts+++ b/e2e/test/scenarios/embedding/sdk-iframe-embedding-setup/common.cy.spec.ts@@ -1,7 +1,4 @@-import {- ORDERS_COUNT_QUESTION_ID,- ORDERS_QUESTION_ID,-} from "e2e/support/cypress_sample_instance_data";+import { ORDERS_QUESTION_ID } from "e2e/support/cypress_sample_instance_data";import { enableJwtAuth } from "e2e/support/helpers/e2e-jwt-helpers";import {@@ -31,7 +28,7 @@ describe("scenarios > embedding > sdk iframe embed setup > common", () => {H.mockEmbedJsToDevServer();});- it("should close wizard when clicking `close` button on the modal", () => {+ it("should close wizard when clicking `close` button on the modal and `Done` button on the last step", () => {navigateToEntitySelectionStep({experience: "dashboard",resourceName: DASHBOARD_NAME,@@ -47,9 +44,7 @@ describe("scenarios > embedding > sdk iframe embed setup > common", () => {cy.findByTestId("embedding-hub-main").findByRole("heading", { name: "Security" }).should("be.visible");- });- it("should close wizard when clicking `Done` button on the last step", () => {navigateToGetCodeStep({experience: "dashboard",resourceName: DASHBOARD_NAME,@@ -98,23 +93,12 @@ describe("scenarios > embedding > sdk iframe embed setup > common", () => {});describe("auth type switch", () => {- it("allows to select the `guest` item even when modular embedding is disabled", () => {+ it("allows to select the `guest` and `Metabase Account` items even when modular embedding is disabled", () => {H.updateSetting("enable-embedding-modular", false);- H.visitQuestion(ORDERS_COUNT_QUESTION_ID);-visitNewEmbedPage({ waitForResource: false });cy.findByLabelText("Guest").should("be.enabled");- });-- it("allows to select the `Metabase Account` item even when modular embedding is disabled", () => {- H.updateSetting("enable-embedding-modular", false);-- H.visitQuestion(ORDERS_COUNT_QUESTION_ID);-- visitNewEmbedPage({ waitForResource: false });-cy.findByLabelText("Metabase account (SSO)").should("be.enabled");});@@ -165,7 +149,7 @@ describe("scenarios > embedding > sdk iframe embed setup > common", () => {assertCheckedAuth("sso");});- it("defaults to Guest from all entry points when SSO is not configured", () => {+ it("defaults to Guest from all entry points when SSO is not configured, and does not reset experience when changing auth type from an entity page", () => {openFromCommandPalette();assertCheckedAuth("guest");@@ -174,37 +158,71 @@ describe("scenarios > embedding > sdk iframe embed setup > common", () => {openFromSharingMenu();assertCheckedAuth("guest");- });- });- it("should not reset experience when changing auth type for Embed JS wizard opened from an entity page", () => {- H.visitQuestion(ORDERS_QUESTION_ID);+ getEmbedSidebar().within(() => {+ H.waitForSimpleEmbedIframesToLoad();- H.openSharingMenu("Embed");+ H.getSimpleEmbedIframeContent().within(() => {+ cy.findByText("Orders").should("be.visible");+ });- getEmbedSidebar().within(() => {- H.waitForSimpleEmbedIframesToLoad();+ cy.findByText("Set default values").should("be.visible");- H.getSimpleEmbedIframeContent().within(() => {- cy.findByText("Orders").should("be.visible");- });+ cy.findByLabelText("Metabase account (SSO)").click();- cy.findByLabelText("Metabase account (SSO)").click();+ H.waitForSimpleEmbedIframesToLoad();- H.waitForSimpleEmbedIframesToLoad();+ H.getSimpleEmbedIframeContent().within(() => {+ cy.findByText("Orders").should("be.visible");+ });- H.getSimpleEmbedIframeContent().within(() => {- cy.findByText("Orders").should("be.visible");- });+ cy.findByText("Set default values").should("be.visible");++ cy.findByLabelText("Guest").click();- cy.findByLabelText("Guest").click();+ H.waitForSimpleEmbedIframesToLoad();- H.waitForSimpleEmbedIframesToLoad();+ H.getSimpleEmbedIframeContent().within(() => {+ cy.findByText("Orders").should("be.visible");+ });- H.getSimpleEmbedIframeContent().within(() => {- cy.findByText("Orders").should("be.visible");+ cy.findByText("Set default values").should("be.visible");});});});});});++describe("scenarios > embedding > sdk iframe embed setup > common (oss and starter)", () => {+ describe("OSS", { tags: "@OSS" }, () =>+ runOssAndStarterTests({ token: null }),+ );++ describe("Starter", () => runOssAndStarterTests({ token: "starter" }));++ function runOssAndStarterTests({ token }: { token: "starter" | null }) {+ beforeEach(() => {+ H.restore();+ cy.signInAsAdmin();++ if (token) {+ H.activateToken(token);+ }++ H.enableTracking();++ cy.intercept("GET", "/api/dashboard/**").as("dashboard");++ H.mockEmbedJsToDevServer();+ });++ it("allows to select the `guest` item when modular embedding is disabled, but not the `Metabase Account` item when token feature is missing", () => {+ H.updateSetting("enable-embedding-modular", false);++ visitNewEmbedPage({ waitForResource: false });++ cy.findByLabelText("Guest").should("be.enabled");+ cy.findByLabelText("Metabase account (SSO)").should("be.disabled");+ });+ }+});diff --git a/e2e/test/scenarios/embedding/sdk-iframe-embedding-setup/embed-flow-enable-embed-js-ee.cy.spec.ts b/e2e/test/scenarios/embedding/sdk-iframe-embedding-setup/embed-flow-enable-embed-js-ee.cy.spec.tsdeleted file mode 100644index a232fcacb56..00000000000--- a/e2e/test/scenarios/embedding/sdk-iframe-embedding-setup/embed-flow-enable-embed-js-ee.cy.spec.ts+++ /dev/null@@ -1,170 +0,0 @@-import { ORDERS_DASHBOARD_ID } from "e2e/support/cypress_sample_instance_data";-import {- embedModalEnableEmbeddingCard,- openSharingMenu,-} from "e2e/support/helpers";--import { clickNewEmbedButton, getEmbedSidebar } from "./helpers";--const { H } = cy;--const DATA_BY_EMBEDDING_TYPE = {- guest: {- path: "/embedding/security",- token: null,- authMethodLabel: "Guest",- cardText:- "To continue, enable embedding and agree to the usage conditions.",- embeddingSettingName: "enable-embedding-modular",- showTermsSettingName: "show-static-embed-terms",- tooltipText:- /You should, however, read the license text linked above as that is the actual license that you will be agreeing to by enabling this feature/,- },- modular: {- path: "/embedding/security",- token: "bleeding-edge",- authMethodLabel: "Metabase account (SSO)",- cardText:- "To continue, enable modular embedding and agree to the usage conditions.",- embeddingSettingName: "enable-embedding-modular",- showTermsSettingName: "show-modular-embed-terms",- tooltipText: /Sharing Metabase accounts is a security risk/,- },-} as const;--describe("scenarios > embedding > sdk iframe embed setup > enable embed js (EE)", () => {- beforeEach(() => {- H.restore();- cy.signInAsAdmin();-- H.mockEmbedJsToDevServer();- });-- Object.entries(DATA_BY_EMBEDDING_TYPE).forEach(([key, value]) => {- describe(key, () => {- const {- path,- token,- authMethodLabel,- embeddingSettingName,- showTermsSettingName,- cardText,- tooltipText,- } = value;-- beforeEach(() => {- if (token) {- H.activateToken(token);- }- });-- it("shows the Enable to Continue button and enables embedding on click", () => {- H.updateSetting(embeddingSettingName, false);- H.updateSetting(showTermsSettingName, true);-- cy.visit(path);-- clickNewEmbedButton();-- cy.findByLabelText(authMethodLabel).click();-- embedModalEnableEmbeddingCard().should("contain.text", cardText);-- cy.log("shows tooltip with fair usage info");- embedModalEnableEmbeddingCard()- .findByLabelText("info icon")- .trigger("mouseover");-- H.hovercard().contains(tooltipText).should("be.visible");-- embedModalEnableEmbeddingCard()- .findByLabelText("info icon")- .trigger("mouseout");-- cy.findByRole("button", { name: "Agree and enable" }).should(- "be.visible",- );-- cy.log("preview panel should show placeholder");- cy.get('[alt="No results"]').should("be.visible");-- cy.findByRole("button", { name: "Agree and enable" }).click();-- cy.log("button should change to Enabled state");- cy.findByRole("button", { name: /Enabled/ })- .should("be.visible")- .should("be.disabled");-- // Selecting "Orders in a dashboard" explicitly on the first step- // because sometimes it selects another one that's been used recently- // see EMB-1106- cy.log("Selecting an item to embed on the first step");- cy.findByTestId("embed-browse-entity-button").click();- H.entityPickerModal()- .findAllByText("Orders in a dashboard")- .first()- .click();-- cy.log("Preview should load after embedding is enabled");- H.waitForSimpleEmbedIframesToLoad();- H.getSimpleEmbedIframeContent().within(() => {- cy.findByText("Orders in a dashboard", { timeout: 60_000 }).should(- "be.visible",- );- });- });-- it("shows the enable card with fair usage terms when embedding is already enabled", () => {- H.updateSetting(embeddingSettingName, true);- H.updateSetting(showTermsSettingName, true);-- cy.visit(path);-- clickNewEmbedButton();-- cy.findByLabelText(authMethodLabel).click();-- embedModalEnableEmbeddingCard().should(- "contain.text",- "Agree to the usage conditions to continue.",- );-- embedModalEnableEmbeddingCard().within(() => {- cy.findByText(cardText).should("not.exist");- });-- cy.log("shows tooltip with fair usage info");- getEmbedSidebar().findByLabelText("info icon").trigger("mouseover");-- H.hovercard().contains(tooltipText).should("be.visible");- });-- it("hides the enable card when embedding is already enabled", () => {- H.updateSetting(embeddingSettingName, true);- H.updateSetting(showTermsSettingName, false);-- cy.visit(path);-- clickNewEmbedButton();-- cy.findByLabelText(authMethodLabel).click();-- getEmbedSidebar().contains(cardText).should("not.exist");- });- });- });-- it("shows guest embed status bar when guest embedding is toggled from disabled to enabled state", () => {- H.updateSetting("enable-embedding-modular", false);-- H.visitDashboard(ORDERS_DASHBOARD_ID);-- openSharingMenu("Embed");-- cy.findByTestId("embed-modal-content-status-bar").should("not.exist");-- cy.findByRole("button", { name: "Agree and enable" }).click();-- cy.findByTestId("embed-modal-content-status-bar").should("exist");- });-});diff --git a/e2e/test/scenarios/embedding/sdk-iframe-embedding-setup/embed-flow-enable-embed-js-oss-and-starter.cy.spec.ts b/e2e/test/scenarios/embedding/sdk-iframe-embedding-setup/embed-flow-enable-embed-js-oss-and-starter.cy.spec.tsdeleted file mode 100644index 58c0a3a4ce7..00000000000--- a/e2e/test/scenarios/embedding/sdk-iframe-embedding-setup/embed-flow-enable-embed-js-oss-and-starter.cy.spec.ts+++ /dev/null@@ -1,168 +0,0 @@-import { embedModalEnableEmbeddingCard } from "e2e/support/helpers";--import { clickNewEmbedButton, getEmbedSidebar } from "./helpers";--const { H } = cy;--describe("scenarios > embedding > sdk iframe embed setup > enable embed js (oss and starter)", () => {- describe("OSS", { tags: "@OSS" }, () => runTests({ token: null }));-- describe("Starter", () => runTests({ token: "starter" }));-- function runTests({ token }: { token: "starter" | null }) {- beforeEach(() => {- H.restore();- cy.signInAsAdmin();-- if (token) {- H.activateToken(token);- }-- H.mockEmbedJsToDevServer();- });-- describe("guest", () => {- it("shows the Enable to Continue button and enables embedding on click", () => {- H.updateSetting("enable-embedding-modular", false);- H.updateSetting("show-static-embed-terms", true);-- cy.visit("/embedding/security");-- clickNewEmbedButton();-- embedModalEnableEmbeddingCard().should(- "contain.text",- "To continue, enable embedding and agree to the usage conditions.",- );-- embedModalEnableEmbeddingCard().within(() => {- cy.log("usage conditions should be a link");- cy.findByRole("link", { name: "usage conditions" })- .should(- "have.attr",- "href",- "https://metabase.com/license/embedding",- )- .should("have.attr", "target", "_blank");- });-- cy.log("shows tooltip with fair usage info");- embedModalEnableEmbeddingCard()- .findByLabelText("info icon")- .trigger("mouseover");-- H.hovercard()- .contains(- /You should, however, read the license text linked above as that is the actual license that you will be agreeing to by enabling this feature/,- )- .should("be.visible");-- embedModalEnableEmbeddingCard()- .findByLabelText("info icon")- .trigger("mouseout");-- cy.findByRole("button", { name: "Agree and enable" }).should(- "be.visible",- );-- cy.log("preview panel should show placeholder");- cy.get('[alt="No results"]').should("be.visible");-- cy.findByRole("button", { name: "Agree and enable" }).click();-- cy.log("button should change to Enabled state");- cy.findByRole("button", { name: /Enabled/ })- .should("be.visible")- .should("be.disabled");-- // Selecting "Orders in a dashboard" explicitly on the first step- // because sometimes it selects another one that's been used recently- // see EMB-1106- cy.log("Selecting an item to embed on the first step");- cy.findByTestId("embed-browse-entity-button").click();- H.entityPickerModal()- .findAllByText("Orders in a dashboard")- .first()- .click();-- cy.log("Preview should load after embedding is enabled");- H.waitForSimpleEmbedIframesToLoad();- H.getSimpleEmbedIframeContent().within(() => {- cy.findByText("Orders in a dashboard", { timeout: 60_000 }).should(- "be.visible",- );- });- });-- it("shows the enable card with fair usage terms when embedding is already enabled", () => {- H.updateSetting("enable-embedding-modular", true);- H.updateSetting("show-static-embed-terms", true);-- cy.visit("/embedding/security");-- clickNewEmbedButton();-- embedModalEnableEmbeddingCard()- .should("contain.text", "Agree to the")- .should("contain.text", "to continue.");-- embedModalEnableEmbeddingCard().within(() => {- cy.findByRole("link", { name: "usage conditions" })- .should(- "have.attr",- "href",- "https://metabase.com/license/embedding",- )- .should("have.attr", "target", "_blank");-- cy.findByText(- "To continue, enable embedding and agree to the usage conditions.",- ).should("not.exist");- });-- cy.log("shows tooltip with fair usage info");- getEmbedSidebar().findByLabelText("info icon").trigger("mouseover");-- H.hovercard()- .contains(- /You should, however, read the license text linked above as that is the actual license that you will be agreeing to by enabling this feature/,- )- .should("be.visible");- });-- it("hides the enable card when embedding is already enabled", () => {- H.updateSetting("enable-embedding-modular", true);- H.updateSetting("show-static-embed-terms", false);-- cy.visit("/embedding/security");-- clickNewEmbedButton();-- getEmbedSidebar()- .contains(- "To continue, enable embedding and agree to the usage conditions.",- )- .should("not.exist");- });- });-- describe("Metabase account (sso)", () => {- it("does not show the Enable to Continue button and disables item", () => {- H.updateSetting("enable-embedding-modular", false);- H.updateSetting("show-modular-embed-terms", true);-- cy.visit("/embedding/security");-- clickNewEmbedButton();-- embedModalEnableEmbeddingCard().within(() => {- cy.findByText(- "To continue, enable embedding and agree to the usage conditions.",- ).should("not.exist");- });-- cy.findByLabelText("Metabase account (SSO)").should("be.disabled");- });- });- }-});diff --git a/e2e/test/scenarios/embedding/sdk-iframe-embedding-setup/embed-flow-enable-embed-js.cy.spec.ts b/e2e/test/scenarios/embedding/sdk-iframe-embedding-setup/embed-flow-enable-embed-js.cy.spec.tsnew file mode 100644index 00000000000..9d4341a778d--- /dev/null+++ b/e2e/test/scenarios/embedding/sdk-iframe-embedding-setup/embed-flow-enable-embed-js.cy.spec.ts@@ -0,0 +1,314 @@+import { ORDERS_DASHBOARD_ID } from "e2e/support/cypress_sample_instance_data";+import {+ embedModalEnableEmbeddingCard,+ openSharingMenu,+} from "e2e/support/helpers";++import { clickNewEmbedButton, getEmbedSidebar } from "./helpers";++const { H } = cy;++const DATA_BY_EMBEDDING_TYPE = {+ guest: {+ path: "/embedding/security",+ token: null,+ authMethodLabel: "Guest",+ cardText:+ "To continue, enable embedding and agree to the usage conditions.",+ embeddingSettingName: "enable-embedding-modular",+ showTermsSettingName: "show-static-embed-terms",+ tooltipText:+ /You should, however, read the license text linked above as that is the actual license that you will be agreeing to by enabling this feature/,+ },+ modular: {+ path: "/embedding/security",+ token: "bleeding-edge",+ authMethodLabel: "Metabase account (SSO)",+ cardText:+ "To continue, enable modular embedding and agree to the usage conditions.",+ embeddingSettingName: "enable-embedding-modular",+ showTermsSettingName: "show-modular-embed-terms",+ tooltipText: /Sharing Metabase accounts is a security risk/,+ },+} as const;++describe("scenarios > embedding > sdk iframe embed setup > enable embed js (EE)", () => {+ beforeEach(() => {+ H.restore();+ cy.signInAsAdmin();++ H.mockEmbedJsToDevServer();+ });++ Object.entries(DATA_BY_EMBEDDING_TYPE).forEach(([key, value]) => {+ describe(key, () => {+ const {+ path,+ token,+ authMethodLabel,+ embeddingSettingName,+ showTermsSettingName,+ cardText,+ tooltipText,+ } = value;++ beforeEach(() => {+ if (token) {+ H.activateToken(token);+ }+ });++ const openNewEmbed = () => {+ cy.visit(path);++ clickNewEmbedButton();++ cy.findByLabelText(authMethodLabel).click();+ };++ it("shows or hides the enable card depending on the embedding and terms settings", () => {+ cy.log("embedding is enabled and terms are not accepted");+ H.updateSetting(embeddingSettingName, true);+ H.updateSetting(showTermsSettingName, true);++ openNewEmbed();++ embedModalEnableEmbeddingCard().should(+ "contain.text",+ "Agree to the usage conditions to continue.",+ );++ embedModalEnableEmbeddingCard().should("not.contain.text", cardText);++ cy.log("shows tooltip with fair usage info");+ getEmbedSidebar().findByLabelText("info icon").trigger("mouseover");++ H.hovercard().contains(tooltipText).should("be.visible");++ cy.log("embedding is disabled");+ H.updateSetting(embeddingSettingName, false);+ H.updateSetting(showTermsSettingName, true);++ openNewEmbed();++ embedModalEnableEmbeddingCard().should("contain.text", cardText);++ cy.log("shows tooltip with fair usage info");+ embedModalEnableEmbeddingCard()+ .findByLabelText("info icon")+ .trigger("mouseover");++ H.hovercard().contains(tooltipText).should("be.visible");++ embedModalEnableEmbeddingCard()+ .findByLabelText("info icon")+ .trigger("mouseout");++ cy.findByRole("button", { name: "Agree and enable" }).should(+ "be.visible",+ );++ cy.log("preview panel should show placeholder");+ cy.get('[alt="No results"]').should("be.visible");++ cy.findByRole("button", { name: "Agree and enable" }).click();++ cy.log("button should change to Enabled state");+ cy.findByRole("button", { name: /Enabled/ })+ .should("be.visible")+ .should("be.disabled");++ // Selecting "Orders in a dashboard" explicitly on the first step+ // because sometimes it selects another one that's been used recently+ // see EMB-1106+ cy.log("Selecting an item to embed on the first step");+ cy.findByTestId("embed-browse-entity-button").click();+ H.entityPickerModal()+ .findAllByText("Orders in a dashboard")+ .first()+ .click();++ cy.log("Preview should load after embedding is enabled");+ H.waitForSimpleEmbedIframesToLoad();+ H.getSimpleEmbedIframeContent().within(() => {+ cy.findByText("Orders in a dashboard", { timeout: 60_000 }).should(+ "be.visible",+ );+ });++ cy.log("embedding is enabled and terms are accepted");+ H.updateSetting(embeddingSettingName, true);+ H.updateSetting(showTermsSettingName, false);++ openNewEmbed();++ H.waitForSimpleEmbedIframesToLoad();+ getEmbedSidebar().contains(cardText).should("not.exist");+ });+ });+ });++ it("shows guest embed status bar when guest embedding is toggled from disabled to enabled state", () => {+ H.updateSetting("enable-embedding-modular", false);++ H.visitDashboard(ORDERS_DASHBOARD_ID);++ openSharingMenu("Embed");++ cy.findByRole("button", { name: "Agree and enable" }).should("be.visible");+ cy.findByTestId("embed-modal-content-status-bar").should("not.exist");++ cy.findByRole("button", { name: "Agree and enable" }).click();++ cy.findByTestId("embed-modal-content-status-bar").should("exist");+ });+});++describe("scenarios > embedding > sdk iframe embed setup > enable embed js (oss and starter)", () => {+ describe("OSS", { tags: "@OSS" }, () =>+ runOssAndStarterTests({ token: null }),+ );++ describe("Starter", () => runOssAndStarterTests({ token: "starter" }));++ function runOssAndStarterTests({ token }: { token: "starter" | null }) {+ beforeEach(() => {+ H.restore();+ cy.signInAsAdmin();++ if (token) {+ H.activateToken(token);+ }++ H.mockEmbedJsToDevServer();+ });++ const openNewGuestEmbed = () => {+ cy.visit("/embedding/security");++ clickNewEmbedButton();+ };++ describe("guest", () => {+ it("shows or hides the enable card depending on the embedding and terms settings", () => {+ cy.log("embedding is enabled and terms are not accepted");+ H.updateSetting("enable-embedding-modular", true);+ H.updateSetting("show-static-embed-terms", true);++ openNewGuestEmbed();++ embedModalEnableEmbeddingCard()+ .should("contain.text", "Agree to the")+ .should("contain.text", "to continue.");++ embedModalEnableEmbeddingCard().within(() => {+ cy.findByRole("link", { name: "usage conditions" })+ .should(+ "have.attr",+ "href",+ "https://metabase.com/license/embedding",+ )+ .should("have.attr", "target", "_blank");++ cy.findByText(+ /To continue, enable embedding and agree to the/,+ ).should("not.exist");+ });++ cy.log("shows tooltip with fair usage info");+ getEmbedSidebar().findByLabelText("info icon").trigger("mouseover");++ H.hovercard()+ .contains(+ /You should, however, read the license text linked above as that is the actual license that you will be agreeing to by enabling this feature/,+ )+ .should("be.visible");++ cy.log("Metabase account (SSO) is disabled without the token feature");+ cy.findByLabelText("Metabase account (SSO)").should("be.disabled");++ cy.log("embedding is disabled");+ H.updateSetting("enable-embedding-modular", false);+ H.updateSetting("show-static-embed-terms", true);++ openNewGuestEmbed();++ embedModalEnableEmbeddingCard().should(+ "contain.text",+ "To continue, enable embedding and agree to the usage conditions.",+ );++ embedModalEnableEmbeddingCard().within(() => {+ cy.log("usage conditions should be a link");+ cy.findByRole("link", { name: "usage conditions" })+ .should(+ "have.attr",+ "href",+ "https://metabase.com/license/embedding",+ )+ .should("have.attr", "target", "_blank");+ });++ cy.log("shows tooltip with fair usage info");+ embedModalEnableEmbeddingCard()+ .findByLabelText("info icon")+ .trigger("mouseover");++ H.hovercard()+ .contains(+ /You should, however, read the license text linked above as that is the actual license that you will be agreeing to by enabling this feature/,+ )+ .should("be.visible");++ embedModalEnableEmbeddingCard()+ .findByLabelText("info icon")+ .trigger("mouseout");++ cy.findByRole("button", { name: "Agree and enable" }).should(+ "be.visible",+ );++ cy.log("preview panel should show placeholder");+ cy.get('[alt="No results"]').should("be.visible");++ cy.findByRole("button", { name: "Agree and enable" }).click();++ cy.log("button should change to Enabled state");+ cy.findByRole("button", { name: /Enabled/ })+ .should("be.visible")+ .should("be.disabled");++ // Selecting "Orders in a dashboard" explicitly on the first step+ // because sometimes it selects another one that's been used recently+ // see EMB-1106+ cy.log("Selecting an item to embed on the first step");+ cy.findByTestId("embed-browse-entity-button").click();+ H.entityPickerModal()+ .findAllByText("Orders in a dashboard")+ .first()+ .click();++ cy.log("Preview should load after embedding is enabled");+ H.waitForSimpleEmbedIframesToLoad();+ H.getSimpleEmbedIframeContent().within(() => {+ cy.findByText("Orders in a dashboard", { timeout: 60_000 }).should(+ "be.visible",+ );+ });++ cy.log("embedding is enabled and terms are accepted");+ H.updateSetting("enable-embedding-modular", true);+ H.updateSetting("show-static-embed-terms", false);++ openNewGuestEmbed();++ cy.findByLabelText("Guest").should("be.checked");+ getEmbedSidebar()+ .contains(+ "To continue, enable embedding and agree to the usage conditions.",+ )+ .should("not.exist");+ });+ });+ }+});diff --git a/e2e/test/scenarios/embedding/sdk-iframe-embedding-setup/embed-parameters.cy.spec.ts b/e2e/test/scenarios/embedding/sdk-iframe-embedding-setup/embed-parameters.cy.spec.tsindex 05724a9b77c..64df4f716db 100644--- a/e2e/test/scenarios/embedding/sdk-iframe-embedding-setup/embed-parameters.cy.spec.ts+++ b/e2e/test/scenarios/embedding/sdk-iframe-embedding-setup/embed-parameters.cy.spec.ts@@ -4,7 +4,6 @@ import {codeBlock,getEmbedSidebar,navigateToEmbedOptionsStep,- navigateToEntitySelectionStep,} from "./helpers";const { ORDERS, ORDERS_ID } = SAMPLE_DATABASE;@@ -25,7 +24,7 @@ describe(suiteTitle, () => {// the Agree CTA. Every test here preselects SSO, but the wizard opens in// guest mode while SSO is unconfigured, so an unaccepted guest CTA would// otherwise have to be clicked through first. That flow is covered by- // embed-flow-enable-embed-js-*.+ // embed-flow-enable-embed-js.cy.spec.ts.H.updateSetting("enable-embedding-modular", true);H.updateSetting("show-modular-embed-terms", false);H.updateSetting("show-static-embed-terms", false);@@ -58,36 +57,6 @@ describe(suiteTitle, () => {});});- it("loads parameters into parameter settings", () => {- navigateToEmbedOptionsStep({- experience: "dashboard",- resourceName: "Dashboard with Parameters",- preselectSso: true,- });-- getEmbedSidebar().within(() => {- cy.findByText("Parameters").should("be.visible");-- cy.log("parameter inputs should be visible");- cy.findByLabelText("ID").should("be.visible");- cy.findByLabelText("Product ID").should("be.visible");-- cy.log("parameters should be visible by default");-- parameterVisibilityToggle("id").should(- "have.attr",- "data-hidden",- "false",- );-- parameterVisibilityToggle("product_id").should(- "have.attr",- "data-hidden",- "false",- );- });- });-it("can set default parameter values", () => {navigateToEmbedOptionsStep({experience: "dashboard",@@ -131,20 +100,60 @@ describe(suiteTitle, () => {});});- it("can hide dashboard parameters", () => {+ it("loads parameters into parameter settings and can hide them", () => {navigateToEmbedOptionsStep({experience: "dashboard",resourceName: "Dashboard with Parameters",preselectSso: true,});+ getEmbedSidebar().within(() => {+ cy.findByText("Parameters").should("be.visible");++ cy.log("parameter inputs should be visible");+ cy.findByLabelText("ID").should("be.visible");+ cy.findByLabelText("Product ID").should("be.visible");++ cy.log("parameters should be visible by default");++ parameterVisibilityToggle("id").should(+ "have.attr",+ "data-hidden",+ "false",+ );++ parameterVisibilityToggle("product_id").should(+ "have.attr",+ "data-hidden",+ "false",+ );+ });++ H.getSimpleEmbedIframeContent()+ .findByTestId("dashboard-parameters-widget-container")+ .should("exist");+cy.log("hide both parameters");getEmbedSidebar().within(() => {parameterVisibilityToggle("id").click();parameterVisibilityToggle("product_id").click();++ parameterVisibilityToggle("id").should(+ "have.attr",+ "data-hidden",+ "true",+ );+ parameterVisibilityToggle("product_id").should(+ "have.attr",+ "data-hidden",+ "true",+ );});cy.log("parameter widget container should not exist");+ H.getSimpleEmbedIframeContent()+ .findByText("Dashboard with Parameters")+ .should("be.visible");H.getSimpleEmbedIframeContent().findByTestId("dashboard-parameters-widget-container").should("not.exist");@@ -238,55 +247,6 @@ describe(suiteTitle, () => {});});});-- describe("resources without parameters", () => {- it("shows no parameters message for dashboards without parameters", () => {- navigateToEmbedOptionsStep({- experience: "dashboard",- resourceName: "Orders in a dashboard",- preselectSso: true,- });-- getEmbedSidebar().within(() => {- cy.findByText(- "Parameters are not available for this dashboard.",- ).should("be.visible");- });- });-- it("shows no parameters message for questions without parameters", () => {- navigateToEmbedOptionsStep({- experience: "chart",- resourceName: "Orders, Count",- preselectSso: true,- });-- getEmbedSidebar().within(() => {- cy.findByText("Parameters are not available for this chart.").should(- "be.visible",- );- });- });-- it("should not show parameter settings for exploration template", () => {- navigateToEntitySelectionStep({- experience: "exploration",- preselectSso: true,- });-- getEmbedSidebar().within(() => {- cy.log("go to embed options step");- cy.findByText("Next").click();-- cy.log("should still contain appearance and behavior");- cy.findByText("Appearance").should("be.visible");- cy.findByText("Behavior").should("be.visible");-- cy.log("should not contain parameters");- cy.findByText("Parameters").should("not.exist");- });- });- });});const parameterVisibilityToggle = (slug: string) =>diff --git a/e2e/test/scenarios/embedding/sdk-iframe-embedding-setup/get-code.cy.spec.ts b/e2e/test/scenarios/embedding/sdk-iframe-embedding-setup/get-code.cy.spec.tsindex dd72ad04d68..30eb9ef7542 100644--- a/e2e/test/scenarios/embedding/sdk-iframe-embedding-setup/get-code.cy.spec.ts+++ b/e2e/test/scenarios/embedding/sdk-iframe-embedding-setup/get-code.cy.spec.ts@@ -5,7 +5,12 @@ import {import { enableJwtAuth } from "e2e/support/helpers/e2e-jwt-helpers";import { enableSamlAuth } from "e2e/support/helpers/embedding-sdk-testing";-import { codeBlock, getEmbedSidebar, navigateToGetCodeStep } from "./helpers";+import {+ codeBlock,+ getEmbedSidebar,+ navigateToEmbedOptionsStep,+ navigateToGetCodeStep,+} from "./helpers";const { H } = cy;@@ -20,14 +25,12 @@ describe("scenarios > embedding > sdk iframe embed setup > get code step", () =>H.activateToken("pro-self-hosted");H.enableTracking();// Accept the embedding terms up front so the wizard never shows the- // Agree CTA — its flow is covered by embed-flow-enable-embed-js-*.+ // Agree CTA — its flow is covered by embed-flow-enable-embed-js.cy.spec.ts.H.updateSetting("enable-embedding-modular", true);H.updateSetting("show-modular-embed-terms", false);H.updateSetting("show-static-embed-terms", false);cy.intercept("GET", "/api/dashboard/**").as("dashboard");- cy.intercept("POST", "/api/card/*/query").as("cardQuery");- cy.intercept("GET", "/api/activity/recents?*").as("recentActivity");H.mockEmbedJsToDevServer();});@@ -36,13 +39,21 @@ describe("scenarios > embedding > sdk iframe embed setup > get code step", () =>H.expectNoBadSnowplowEvents();});- it("should disable SSO radio button (and show info message) when JWT and SAML are not configured", () => {- navigateToGetCodeStep({+ it("shows the dashboard code snippet and disables SSO when JWT and SAML are not configured, then enables SSO once SAML is configured", () => {+ navigateToEmbedOptionsStep({experience: "dashboard",resourceName: DASHBOARD_NAME,preselectSso: true,});+ getEmbedSidebar().within(() => {+ cy.findByText("Parameters are not available for this dashboard.").should(+ "be.visible",+ );++ cy.findByText("Get code").click();+ });+getEmbedSidebar().within(() => {cy.findByLabelText("Single sign-on").should("be.disabled");cy.findByLabelText("Existing session (local testing only)").should(@@ -54,40 +65,15 @@ describe("scenarios > embedding > sdk iframe embed setup > get code step", () =>cy.findByText(/The code below will only work for local testing/).should("be.visible",);- });- });-- it("should not display a warning when a user session is selected and JWT is configured", () => {- enableJwtAuth();-- navigateToGetCodeStep({- experience: "dashboard",- resourceName: DASHBOARD_NAME,- preselectSso: true,- });-- getEmbedSidebar().within(() => {- cy.findByLabelText("Existing session (local testing only)").click();- cy.findByText(/The code below will only work for local testing/).should(- "not.exist",- );- });- });- it("should enable SSO radio button when JWT is configured", () => {- enableJwtAuth();- navigateToGetCodeStep({- experience: "dashboard",- resourceName: DASHBOARD_NAME,- preselectSso: true,- });-- getEmbedSidebar().within(() => {- cy.findByLabelText("Single sign-on").should("not.be.disabled");+ cy.findByText("Embed code").should("be.visible");+ codeBlock().should("be.visible");+ codeBlock().should("contain", "defineMetabaseConfig");+ codeBlock().should("contain", "metabase-dashboard");+ codeBlock().should("contain", `dashboard-id="${ORDERS_DASHBOARD_ID}"`);});- });- it("should enable SSO radio button when SAML is configured", () => {+ cy.log("SSO should be enabled once SAML is configured");enableSamlAuth();navigateToGetCodeStep({experience: "dashboard",@@ -100,22 +86,7 @@ describe("scenarios > embedding > sdk iframe embed setup > get code step", () =>});});- it("should display code snippet with syntax highlighting", () => {- navigateToGetCodeStep({- experience: "dashboard",- resourceName: DASHBOARD_NAME,- preselectSso: true,- });-- getEmbedSidebar().within(() => {- cy.findByText("Embed code").should("be.visible");- codeBlock().should("be.visible");- codeBlock().should("contain", "defineMetabaseConfig");- codeBlock().should("contain", "metabase-dashboard");- });- });-- it("should include useExistingUserSession when user session is selected", () => {+ it("enables SSO when JWT is configured and adds useExistingUserSession without a warning when user session is selected", () => {enableJwtAuth();navigateToGetCodeStep({experience: "dashboard",@@ -124,9 +95,14 @@ describe("scenarios > embedding > sdk iframe embed setup > get code step", () =>});getEmbedSidebar().within(() => {+ cy.findByLabelText("Single sign-on").should("not.be.disabled");+codeBlock().should("not.contain", '"useExistingUserSession": true');cy.findByLabelText("Existing session (local testing only)").click();codeBlock().should("contain", '"useExistingUserSession": true');+ cy.findByText(/The code below will only work for local testing/).should(+ "not.exist",+ );cy.findByText(/Copy code/).click();@@ -150,18 +126,6 @@ describe("scenarios > embedding > sdk iframe embed setup > get code step", () =>});});- it("should set dashboard-id for regular dashboard experience", () => {- navigateToGetCodeStep({- experience: "dashboard",- resourceName: DASHBOARD_NAME,- preselectSso: true,- });-- getEmbedSidebar().within(() => {- codeBlock().should("contain", `dashboard-id="${ORDERS_DASHBOARD_ID}"`);- });- });-it("should set question-id for regular chart experience", () => {enableJwtAuth();navigateToGetCodeStep({@@ -180,15 +144,7 @@ describe("scenarios > embedding > sdk iframe embed setup > get code step", () =>});});- it("should use metabase-question for exploration experience", () => {- navigateToGetCodeStep({ experience: "exploration" });-- getEmbedSidebar().within(() => {- codeBlock().should("contain", "metabase-question");- });- });-- it("should not include entity-types when model count is 1", () => {+ it("shows no parameter settings and uses metabase-question without entity-types for exploration when model count is 1", () => {cy.intercept({method: "GET",@@ -201,11 +157,20 @@ describe("scenarios > embedding > sdk iframe embed setup > get code step", () =>},).as("searchModels");- navigateToGetCodeStep({ experience: "exploration" });+ navigateToEmbedOptionsStep({ experience: "exploration" });++ getEmbedSidebar().within(() => {+ cy.findByText("Appearance").should("be.visible");+ cy.findByText("Behavior").should("be.visible");+ cy.findByText("Parameters").should("not.exist");++ cy.findByText("Get code").click();+ });cy.wait("@searchModels");getEmbedSidebar().within(() => {+ codeBlock().should("contain", "metabase-question");codeBlock().should("not.contain", "entity-types");});diff --git a/e2e/test/scenarios/embedding/sdk-iframe-embedding-setup/guest-embed-ee.cy.spec.ts b/e2e/test/scenarios/embedding/sdk-iframe-embedding-setup/guest-embed-ee.cy.spec.tsdeleted file mode 100644index 4361562615f..00000000000--- a/e2e/test/scenarios/embedding/sdk-iframe-embedding-setup/guest-embed-ee.cy.spec.ts+++ /dev/null@@ -1,419 +0,0 @@-import { SAMPLE_DATABASE } from "e2e/support/cypress_sample_database";-import {- JWT_SHARED_SECRET,- embedModalEnableEmbedding,- entityPickerModal,-} from "e2e/support/helpers";-import { enableJwtAuth } from "e2e/support/helpers/e2e-jwt-helpers";--import {- codeBlock,- getEmbedSidebar,- navigateToEmbedOptionsStep,- visitNewEmbedPage,-} from "./helpers";--const { H } = cy;--const { ORDERS_ID } = SAMPLE_DATABASE;--const DASHBOARD_NAME = "Dashboard with Parameters";-const DASHBOARD_PARAMETERS = [- {- name: "ID",- slug: "id",- id: "11111111",- type: "id",- },- {- name: "Product ID",- slug: "product_id",- id: "22222222",- type: "id",- },-];--const FIRST_QUESTION_NAME = "Question With Params 1";-const SECOND_QUESTION_NAME = "Question With Params 2";--describe("scenarios > embedding > sdk iframe embed setup > guest-embed", () => {- beforeEach(() => {- H.restore();- H.resetSnowplow();- cy.signInAsAdmin();- H.activateToken("pro-self-hosted");- H.enableTracking();-- H.updateSetting("embedding-secret-key", JWT_SHARED_SECRET);-- H.createQuestionAndDashboard({- questionDetails: {- name: "Orders table",- query: { "source-table": ORDERS_ID },- },- dashboardDetails: {- name: DASHBOARD_NAME,- parameters: DASHBOARD_PARAMETERS,- },- }).then(({ body: card }) => {- cy.wrap(card.dashboard_id).as("dashboardId");- });-- H.createNativeQuestion(- {- name: FIRST_QUESTION_NAME,- native: {- query: "select {{text}}",- "template-tags": {- text: {- id: "abc-123",- name: "text",- "display-name": "Text",- type: "text",- default: null,- },- },- },- enable_embedding: false,- },- {- wrapId: true,- idAlias: "question1Id",- },- );-- H.createNativeQuestion(- {- name: SECOND_QUESTION_NAME,- native: {- query: "select {{text}}",- "template-tags": {- text1: {- id: "abc-123",- name: "text1",- "display-name": "Text1",- type: "text",- default: null,- required: true,- },- text2: {- id: "abc-456",- name: "text2",- "display-name": "Text2",- type: "text",- default: null,- required: false,- },- },- },- enable_embedding: true,- embedding_params: {- text1: "enabled",- state2: "disabled",- },- },- {- wrapId: true,- idAlias: "question2Id",- },- );-- H.mockEmbedJsToDevServer();- });-- afterEach(() => {- H.expectNoBadSnowplowEvents();- });-- describe("Happy path", () => {- it("Navigates through the guest-embed flow for a question and opens its embed page", () => {- cy.intercept("GET", "api/preview_embed/card/*").as("previewEmbed");- visitNewEmbedPage();-- H.expectUnstructuredSnowplowEvent({ event: "embed_wizard_opened" });-- H.waitForSimpleEmbedIframesToLoad();-- // Switch to Guest auth (wizard now defaults to SSO when SSO isn't configured)- getEmbedSidebar().within(() => {- cy.findByLabelText("Guest").click();- });- embedModalEnableEmbedding();-- // Combined experience + resource step- getEmbedSidebar().within(() => {- cy.findByLabelText("Guest").should("be.visible").should("be.checked");-- cy.findByTestId("upsell-card").should("not.exist");-- cy.findByText("Chart").click();-- cy.findByTestId("embed-browse-entity-button").click();- });-- H.entityPickerModal().within(() => {- cy.findByTestId("item-picker-level-0")- .findByText("Our analytics")- .click();-- cy.findByText("Select a chart").should("be.visible");- cy.findByText(FIRST_QUESTION_NAME).click();- });-- getEmbedSidebar().within(() => {- cy.findByText("Next").click();- });-- H.expectUnstructuredSnowplowEvent({- event: "embed_wizard_experience_completed",- event_detail:- "authType=guest-embed,experience=chart,isDefaultExperience=false",- });-- H.expectUnstructuredSnowplowEvent({- event: "embed_wizard_resource_selection_completed",- event_detail: "isDefaultResource=false,experience=chart",- });-- // Options step- cy.findByLabelText("Guest").should("not.exist");- cy.findByLabelText("Allow people to drill through on data points")- .should("be.visible")- .should("be.disabled");- cy.findByLabelText("Allow downloads")- .should("be.visible")- .should("not.be.disabled")- .should("not.be.checked");- cy.findByLabelText("Allow people to save new questions")- .should("be.visible")- .should("be.disabled");-- getEmbedSidebar().findByTestId("behavior-docs-link").should("be.visible");- getEmbedSidebar()- .findByTestId("behavior-docs-link")- .should("have.attr", "href")- .and("include", "embedding/guest-embedding");-- H.setEmbeddingParameter("Text", "Locked");- cy.findAllByTestId("parameter-widget").find("input").type("Foo Bar Baz");-- getEmbedSidebar().within(() => {- cy.findByTestId("upsell-card").should("not.exist");- });-- H.publishChanges("card");- cy.button("Unpublish").should("be.visible");-- H.getSimpleEmbedIframeContent().within(() => {- cy.findByText("Foo Bar Baz").should("be.visible");- });-- H.getSimpleEmbedIframeContent()- .findByTestId("embedding-footer")- .should("not.exist");-- getEmbedSidebar().within(() => {- cy.findByText("Get code").click();- });-- H.expectUnstructuredSnowplowEvent({- event: "embed_wizard_options_completed",- event_detail:- 'settings=custom,experience=chart,guestEmbedEnabled=true,guestEmbedType=guest-embed,authType=guest-embed,drills=false,withDownloads=false,withAlerts=false,withTitle=true,isSaveEnabled=false,params={"disabled":0,"locked":1,"enabled":0},theme=default',- });-- // Get code step- getEmbedSidebar().within(() => {- cy.findByTestId("publish-guest-embed-link").should("not.exist");- });-- cy.log(- 'Embed preview requests should not have "X-Metabase-Client" header (EMB-945)',- );- cy.wait("@previewEmbed").then(({ request }) => {- expect(request?.headers?.["x-metabase-embedded-preview"]).to.equal(- "true",- );- });-- H.unpublishChanges("card");-- getEmbedSidebar().within(() => {- cy.findByTestId("publish-guest-embed-link").should("be.visible");-- cy.findByText(/Copy code/).should("not.exist");- });-- H.publishChanges("card");-- getEmbedSidebar().within(() => {- cy.findByTestId("publish-guest-embed-link").should("not.exist");- });-- getEmbedSidebar().within(() => {- cy.findAllByText(/Copy code/)- .first()- .click();- });-- H.expectUnstructuredSnowplowEvent({- event: "embed_wizard_code_copied",- event_detail:- "experience=chart,snippetType=frontend,guestEmbedEnabled=true,guestEmbedType=guest-embed,authSubType=none",- });-- // Visit embed page- getEmbedSidebar().within(() => {- codeBlock()- .invoke("text")- .then((code: string) => {- const match = code.match(/token="([^"]+)"/);- expect(match, "JWT token present in code block").to.not.be.null;- const jwtToken = match ? match[1] : "";- cy.wrap(jwtToken).as("guestEmbedToken");- });- });-- cy.get<string>("@guestEmbedToken").then((token) => {- const frame = H.loadSdkIframeEmbedTestPage({- metabaseConfig: { isGuest: true },- elements: [- {- component: "metabase-question",- attributes: {- token,- },- },- ],- });-- frame.within(() => {- cy.findByText("Foo Bar Baz").should("be.visible");-- cy.findByTestId("embedding-footer").should("not.exist");- });- });- });-- it("Properly re-initializes embedding parameters and Guest Embed navbar", () => {- cy.get("@question1Id").then((questionId) => {- cy.request("PUT", `/api/card/${questionId}`, {- enable_embedding: true,- });-- navigateToEmbedOptionsStep({- experience: "chart",- resourceName: FIRST_QUESTION_NAME,- preselectGuest: true,- });-- cy.button("Unpublish").should("be.visible");-- H.assertEmbeddingParameter("Text", "Disabled");-- getEmbedSidebar().within(() => {- cy.findByText("Back").click();-- cy.findByTestId("embed-browse-entity-button").click();- });-- entityPickerModal().within(() => {- cy.findByTestId("item-picker-level-0")- .findByText("Our analytics")- .click();- cy.findAllByText(SECOND_QUESTION_NAME).first().click();- });-- getEmbedSidebar().within(() => {- cy.findByText("Next").click();- });-- cy.button("Unpublish").should("be.visible");-- H.assertEmbeddingParameter("Text1", "Editable");-- H.assertEmbeddingParameter("Text2", "Disabled");-- H.setEmbeddingParameter("Text1", "Locked");-- cy.button("Publish changes").should("be.visible");-- getEmbedSidebar().within(() => {- cy.findByText("Back").click();-- cy.findByTestId("embed-browse-entity-button").click();- });-- entityPickerModal().within(() => {- cy.findByTestId("item-picker-level-0")- .findByText("Our analytics")- .click();- cy.findAllByText(FIRST_QUESTION_NAME).first().click();- });-- getEmbedSidebar().within(() => {- cy.findByText("Next").click();- });-- cy.button("Unpublish").should("be.visible");-- H.assertEmbeddingParameter("Text", "Disabled");- });- });-- it("Properly adjusts EmbedJS options when switching between guest/sso modes for a Dashboard", () => {- cy.get("@dashboardId").then((dashboardId) => {- cy.request("PUT", `/api/dashboard/${dashboardId}`, {- enable_embedding: true,- });-- enableJwtAuth();-- navigateToEmbedOptionsStep({- experience: "dashboard",- resourceName: DASHBOARD_NAME,- preselectGuest: true,- });-- getEmbedSidebar().within(() => {- cy.findByLabelText("Guest").should("not.exist");- });-- H.setEmbeddingParameter("Product ID", "Locked");-- getEmbedSidebar().within(() => {- cy.findByText("Get code").click();-- codeBlock().first().should("contain", "token=");-- codeBlock().first().should("not.contain", "dashboard-id=");- codeBlock().first().should("not.contain", "hidden-parameters=");- codeBlock().first().should("not.contain", "locked-parameters=");-- cy.findByText("Back").click();- cy.findByText("Back").click();-- cy.findByLabelText("Guest").should("be.visible").should("be.checked");-- cy.findByLabelText("Metabase account (SSO)").click();- });-- embedModalEnableEmbedding();-- getEmbedSidebar().within(() => {- cy.findByText("Next").click();- cy.findByText("Get code").click();-- codeBlock().first().should("contain", "dashboard-id=");-- // hiddenParameters is reset to [] when switching from guest to SSO mode,- // so hidden-parameters= should not appear in the code.- codeBlock().first().should("not.contain", "hidden-parameters=");-- codeBlock().first().should("not.contain", "token=");- codeBlock().first().should("not.contain", "locked-parameters=");- });- });- });- });-});diff --git a/e2e/test/scenarios/embedding/sdk-iframe-embedding-setup/guest-embed-oss.cy.spec.ts b/e2e/test/scenarios/embedding/sdk-iframe-embedding-setup/guest-embed-oss.cy.spec.tsdeleted file mode 100644index bac888fbf0d..00000000000--- a/e2e/test/scenarios/embedding/sdk-iframe-embedding-setup/guest-embed-oss.cy.spec.ts+++ /dev/null@@ -1,294 +0,0 @@-import { SAMPLE_DATABASE } from "e2e/support/cypress_sample_database";-import { JWT_SHARED_SECRET } from "e2e/support/helpers";--import { codeBlock, getEmbedSidebar, visitNewEmbedPage } from "./helpers";--const { H } = cy;--const { ORDERS_ID } = SAMPLE_DATABASE;--const DASHBOARD_NAME = "Dashboard with Parameters";-const DASHBOARD_PARAMETERS = [- {- name: "ID",- slug: "id",- id: "11111111",- type: "id",- },- {- name: "Product ID",- slug: "product_id",- id: "22222222",- type: "id",- },-];--const FIRST_QUESTION_NAME = "Question With Params 1";-const SECOND_QUESTION_NAME = "Question With Params 2";--describe(- "scenarios > embedding > sdk iframe embed setup > guest-embed",- { tags: "@OSS" },- () => {- beforeEach(() => {- H.restore();- H.resetSnowplow();- cy.signInAsAdmin();- H.enableTracking();-- H.updateSetting("embedding-secret-key", JWT_SHARED_SECRET);-- H.createQuestionAndDashboard({- questionDetails: {- name: "Orders table",- query: { "source-table": ORDERS_ID },- },- dashboardDetails: {- name: DASHBOARD_NAME,- parameters: DASHBOARD_PARAMETERS,- },- }).then(({ body: card }) => {- cy.wrap(card.dashboard_id).as("dashboardId");- });-- H.createNativeQuestion(- {- name: FIRST_QUESTION_NAME,- native: {- query: "select {{text}}",- "template-tags": {- text: {- id: "abc-123",- name: "text",- "display-name": "Text",- type: "text",- default: null,- },- },- },- enable_embedding: false,- },- {- wrapId: true,- idAlias: "question1Id",- },- );-- H.createNativeQuestion(- {- name: SECOND_QUESTION_NAME,- native: {- query: "select {{text}}",- "template-tags": {- text1: {- id: "abc-123",- name: "text1",- "display-name": "Text1",- type: "text",- default: null,- required: true,- },- text2: {- id: "abc-456",- name: "text2",- "display-name": "Text2",- type: "text",- default: null,- required: false,- },- },- },- enable_embedding: true,- embedding_params: {- text1: "enabled",- state2: "disabled",- },- },- {- wrapId: true,- idAlias: "question2Id",- },- );-- H.mockEmbedJsToDevServer();- });-- afterEach(() => {- H.expectNoBadSnowplowEvents();- });-- describe("Happy path", () => {- it("Navigates through the guest-embed flow for a question and opens its embed page", () => {- cy.intercept("GET", "api/preview_embed/card/*").as("previewEmbed");- visitNewEmbedPage();-- H.expectUnstructuredSnowplowEvent({ event: "embed_wizard_opened" });-- H.waitForSimpleEmbedIframesToLoad();-- // Combined experience + resource step- getEmbedSidebar().within(() => {- cy.findByLabelText("Guest").should("be.visible").should("be.checked");-- ["Metabase account (SSO)", "Exploration", "Browser"].forEach(- (label) => {- cy.findByLabelText(label).should("be.disabled");- },- );-- cy.findByTestId("upsell-card").should("be.visible");-- cy.findByText("Chart").click();-- cy.findByTestId("embed-browse-entity-button").click();- });-- H.entityPickerModal().within(() => {- cy.findByText("Select a chart").should("be.visible");- cy.findByTestId("item-picker-level-0")- .findByText("Our analytics")- .click();- cy.findByText(FIRST_QUESTION_NAME).click();- });-- getEmbedSidebar().within(() => {- cy.findByText("Next").click();- });-- H.expectUnstructuredSnowplowEvent({- event: "embed_wizard_experience_completed",- event_detail:- "authType=guest-embed,experience=chart,isDefaultExperience=false",- });-- H.expectUnstructuredSnowplowEvent({- event: "embed_wizard_resource_selection_completed",- event_detail: "isDefaultResource=false,experience=chart",- });-- // Options step- cy.findByLabelText("Allow people to drill through on data points")- .scrollIntoView()- .should("be.visible")- .should("be.disabled");- cy.findByLabelText("Allow downloads")- .scrollIntoView()- .should("be.visible")- .should("be.disabled")- .should("be.checked");- cy.findByLabelText("Allow people to save new questions")- .scrollIntoView()- .should("be.visible")- .should("be.disabled");-- [- "Allow people to drill through on data points",- "Allow downloads",- "Allow people to save new questions",- ].forEach((label) => {- cy.findByLabelText(label).should("be.disabled");- });-- cy.findByTestId("upsell-card").should("exist");-- H.setEmbeddingParameter("Text", "Locked");- cy.findAllByTestId("parameter-widget")- .find("input")- .type("Foo Bar Baz");-- H.getSimpleEmbedIframeContent()- .findByTestId("embedding-footer")- .should("be.visible");-- H.getSimpleEmbedIframeContent()- .findByTestId("question-download-widget-button")- .should("have.css", "background-color", "rgb(255, 255, 255)");-- getEmbedSidebar().within(() => {- cy.findByTestId("appearance-section").within(() => {- cy.findByText("Dark").click();- });- });-- H.getSimpleEmbedIframeContent()- .findByTestId("question-download-widget-button")- .should("have.css", "background-color", "rgb(7, 23, 34)");-- H.publishChanges("card");- cy.button("Unpublish").should("be.visible");-- H.getSimpleEmbedIframeContent().within(() => {- cy.findByText("Foo Bar Baz").should("be.visible");- });-- getEmbedSidebar().within(() => {- cy.findByText("Get code").click();- });-- H.expectUnstructuredSnowplowEvent({- event: "embed_wizard_options_completed",- event_detail:- 'settings=custom,experience=chart,guestEmbedEnabled=true,guestEmbedType=guest-embed,authType=guest-embed,drills=false,withDownloads=true,withAlerts=false,withTitle=true,isSaveEnabled=false,params={"disabled":0,"locked":1,"enabled":0},theme=default',- });-- // Get code step- getEmbedSidebar().within(() => {- codeBlock()- .invoke("text")- .should("match", /"theme":\s*\{\s*"preset":\s*"dark"\s*},/);-- cy.findAllByText(/Copy code/)- .first()- .click();- });-- cy.log(- 'Embed preview requests should not have "X-Metabase-Client" header (EMB-945)',- );- cy.wait("@previewEmbed").then(({ request }) => {- expect(request?.headers?.["x-metabase-embedded-preview"]).to.equal(- "true",- );- });-- H.expectUnstructuredSnowplowEvent({- event: "embed_wizard_code_copied",- event_detail:- "experience=chart,snippetType=frontend,guestEmbedEnabled=true,guestEmbedType=guest-embed,authSubType=none",- });-- // Visit embed page- getEmbedSidebar().within(() => {- codeBlock()- .invoke("text")- .then((code: string) => {- const match = code.match(/token="([^"]+)"/);- expect(match, "JWT token present in code block").to.not.be.null;- const jwtToken = match ? match[1] : "";- cy.wrap(jwtToken).as("guestEmbedToken");- });- });-- cy.get<string>("@guestEmbedToken").then((token) => {- const frame = H.loadSdkIframeEmbedTestPage({- metabaseConfig: { isGuest: true },- elements: [- {- component: "metabase-question",- attributes: {- token,- },- },- ],- });-- frame.within(() => {- cy.findByText("Foo Bar Baz").should("be.visible");-- cy.findByTestId("embedding-footer").should("be.visible");- });- });- });- });- },-);diff --git a/e2e/test/scenarios/embedding/sdk-iframe-embedding-setup/guest-embed.cy.spec.ts b/e2e/test/scenarios/embedding/sdk-iframe-embedding-setup/guest-embed.cy.spec.tsnew file mode 100644index 00000000000..b6f7afd919c--- /dev/null+++ b/e2e/test/scenarios/embedding/sdk-iframe-embedding-setup/guest-embed.cy.spec.ts@@ -0,0 +1,624 @@+import { SAMPLE_DATABASE } from "e2e/support/cypress_sample_database";+import {+ JWT_SHARED_SECRET,+ embedModalEnableEmbedding,+ entityPickerModal,+} from "e2e/support/helpers";+import { enableJwtAuth } from "e2e/support/helpers/e2e-jwt-helpers";++import {+ codeBlock,+ getEmbedSidebar,+ navigateToEmbedOptionsStep,+ visitNewEmbedPage,+} from "./helpers";++const { H } = cy;++const { ORDERS_ID } = SAMPLE_DATABASE;++const DASHBOARD_NAME = "Dashboard with Parameters";+const DASHBOARD_PARAMETERS = [+ {+ name: "ID",+ slug: "id",+ id: "11111111",+ type: "id",+ },+ {+ name: "Product ID",+ slug: "product_id",+ id: "22222222",+ type: "id",+ },+];++const FIRST_QUESTION_NAME = "Question With Params 1";+const SECOND_QUESTION_NAME = "Question With Params 2";++const setupGuestEmbedContent = () => {+ H.createQuestionAndDashboard({+ questionDetails: {+ name: "Orders table",+ query: { "source-table": ORDERS_ID },+ },+ dashboardDetails: {+ name: DASHBOARD_NAME,+ parameters: DASHBOARD_PARAMETERS,+ },+ }).then(({ body: card }) => {+ cy.wrap(card.dashboard_id).as("dashboardId");+ });++ H.createNativeQuestion(+ {+ name: FIRST_QUESTION_NAME,+ native: {+ query: "select {{text}}",+ "template-tags": {+ text: {+ id: "abc-123",+ name: "text",+ "display-name": "Text",+ type: "text",+ default: null,+ },+ },+ },+ enable_embedding: false,+ },+ {+ wrapId: true,+ idAlias: "question1Id",+ },+ );++ H.createNativeQuestion(+ {+ name: SECOND_QUESTION_NAME,+ native: {+ query: "select {{text}}",+ "template-tags": {+ text1: {+ id: "abc-123",+ name: "text1",+ "display-name": "Text1",+ type: "text",+ default: null,+ required: true,+ },+ text2: {+ id: "abc-456",+ name: "text2",+ "display-name": "Text2",+ type: "text",+ default: null,+ required: false,+ },+ },+ },+ enable_embedding: true,+ embedding_params: {+ text1: "enabled",+ state2: "disabled",+ },+ },+ {+ wrapId: true,+ idAlias: "question2Id",+ },+ );+};++describe("scenarios > embedding > sdk iframe embed setup > guest-embed", () => {+ describe("OSS", { tags: "@OSS" }, () => {+ beforeEach(() => {+ H.restore();+ H.resetSnowplow();+ cy.signInAsAdmin();+ H.enableTracking();++ H.updateSetting("embedding-secret-key", JWT_SHARED_SECRET);++ setupGuestEmbedContent();++ H.mockEmbedJsToDevServer();+ });++ afterEach(() => {+ H.expectNoBadSnowplowEvents();+ });++ describe("Happy path", () => {+ it("Navigates through the guest-embed flow for a question and opens its embed page", () => {+ cy.intercept("GET", "api/preview_embed/card/*").as("previewEmbed");+ visitNewEmbedPage();++ H.expectUnstructuredSnowplowEvent({ event: "embed_wizard_opened" });++ H.waitForSimpleEmbedIframesToLoad();++ // Combined experience + resource step+ getEmbedSidebar().within(() => {+ cy.findByLabelText("Guest").should("be.visible").should("be.checked");++ ["Metabase account (SSO)", "Exploration", "Browser"].forEach(+ (label) => {+ cy.findByLabelText(label).should("be.disabled");+ },+ );++ cy.findByTestId("upsell-card").should("be.visible");++ cy.findByText("Chart").click();++ cy.findByTestId("embed-browse-entity-button").click();+ });++ H.entityPickerModal().within(() => {+ cy.findByText("Select a chart").should("be.visible");+ cy.findByTestId("item-picker-level-0")+ .findByText("Our analytics")+ .click();+ cy.findByText(FIRST_QUESTION_NAME).click();+ });++ getEmbedSidebar().within(() => {+ cy.findByText("Next").click();+ });++ H.expectUnstructuredSnowplowEvent({+ event: "embed_wizard_experience_completed",+ event_detail:+ "authType=guest-embed,experience=chart,isDefaultExperience=false",+ });++ H.expectUnstructuredSnowplowEvent({+ event: "embed_wizard_resource_selection_completed",+ event_detail: "isDefaultResource=false,experience=chart",+ });++ // Options step+ cy.findByLabelText("Allow people to drill through on data points")+ .scrollIntoView()+ .should("be.visible")+ .should("be.disabled");+ cy.findByLabelText("Allow downloads")+ .scrollIntoView()+ .should("be.visible")+ .should("be.disabled")+ .should("be.checked");+ cy.findByLabelText("Allow people to save new questions")+ .scrollIntoView()+ .should("be.visible")+ .should("be.disabled");++ [+ "Allow people to drill through on data points",+ "Allow downloads",+ "Allow people to save new questions",+ ].forEach((label) => {+ cy.findByLabelText(label).should("be.disabled");+ });++ cy.findByTestId("upsell-card").should("exist");++ H.setEmbeddingParameter("Text", "Locked");+ cy.findAllByTestId("parameter-widget")+ .find("input")+ .type("Foo Bar Baz");++ H.getSimpleEmbedIframeContent()+ .findByTestId("embedding-footer")+ .should("be.visible");++ H.getSimpleEmbedIframeContent()+ .findByTestId("question-download-widget-button")+ .should("have.css", "background-color", "rgb(255, 255, 255)");++ getEmbedSidebar().within(() => {+ cy.findByTestId("appearance-section").within(() => {+ cy.findByText("Dark").click();+ });+ });++ H.getSimpleEmbedIframeContent()+ .findByTestId("question-download-widget-button")+ .should("have.css", "background-color", "rgb(7, 23, 34)");++ H.publishChanges("card");+ cy.button("Unpublish").should("be.visible");++ H.getSimpleEmbedIframeContent().within(() => {+ cy.findByText("Foo Bar Baz").should("be.visible");+ });++ getEmbedSidebar().within(() => {+ cy.findByText("Get code").click();+ });++ H.expectUnstructuredSnowplowEvent({+ event: "embed_wizard_options_completed",+ event_detail:+ 'settings=custom,experience=chart,guestEmbedEnabled=true,guestEmbedType=guest-embed,authType=guest-embed,drills=false,withDownloads=true,withAlerts=false,withTitle=true,isSaveEnabled=false,params={"disabled":0,"locked":1,"enabled":0},theme=default',+ });++ // Get code step+ getEmbedSidebar().within(() => {+ codeBlock()+ .invoke("text")+ .should("match", /"theme":\s*\{\s*"preset":\s*"dark"\s*},/);++ cy.findAllByText(/Copy code/)+ .first()+ .click();+ });++ cy.log(+ 'Embed preview requests should not have "X-Metabase-Client" header (EMB-945)',+ );+ cy.wait("@previewEmbed").then(({ request }) => {+ expect(request?.headers?.["x-metabase-embedded-preview"]).to.equal(+ "true",+ );+ });++ H.expectUnstructuredSnowplowEvent({+ event: "embed_wizard_code_copied",+ event_detail:+ "experience=chart,snippetType=frontend,guestEmbedEnabled=true,guestEmbedType=guest-embed,authSubType=none",+ });++ // Visit embed page+ getEmbedSidebar().within(() => {+ codeBlock()+ .invoke("text")+ .then((code: string) => {+ const match = code.match(/token="([^"]+)"/);+ expect(match, "JWT token present in code block").to.not.be.null;+ const jwtToken = match ? match[1] : "";+ cy.wrap(jwtToken).as("guestEmbedToken");+ });+ });++ cy.get<string>("@guestEmbedToken").then((token) => {+ const frame = H.loadSdkIframeEmbedTestPage({+ metabaseConfig: { isGuest: true },+ elements: [+ {+ component: "metabase-question",+ attributes: {+ token,+ },+ },+ ],+ });++ frame.within(() => {+ cy.findByText("Foo Bar Baz").should("be.visible");++ cy.findByTestId("embedding-footer").should("be.visible");+ });+ });+ });+ });+ });++ describe("EE", () => {+ beforeEach(() => {+ H.restore();+ H.resetSnowplow();+ cy.signInAsAdmin();+ H.activateToken("pro-self-hosted");+ H.enableTracking();++ H.updateSetting("embedding-secret-key", JWT_SHARED_SECRET);++ setupGuestEmbedContent();++ H.mockEmbedJsToDevServer();+ });++ afterEach(() => {+ H.expectNoBadSnowplowEvents();+ });++ describe("Happy path", () => {+ it("Navigates through the guest-embed flow for a question and opens its embed page", () => {+ cy.intercept("GET", "api/preview_embed/card/*").as("previewEmbed");+ visitNewEmbedPage();++ H.expectUnstructuredSnowplowEvent({ event: "embed_wizard_opened" });++ H.waitForSimpleEmbedIframesToLoad();++ getEmbedSidebar().within(() => {+ cy.findByLabelText("Guest").click();+ });+ embedModalEnableEmbedding();++ // Combined experience + resource step+ getEmbedSidebar().within(() => {+ cy.findByLabelText("Guest").should("be.visible").should("be.checked");++ cy.findByTestId("upsell-card").should("not.exist");++ cy.findByText("Chart").click();++ cy.findByTestId("embed-browse-entity-button").click();+ });++ H.entityPickerModal().within(() => {+ cy.findByTestId("item-picker-level-0")+ .findByText("Our analytics")+ .click();++ cy.findByText("Select a chart").should("be.visible");+ cy.findByText(FIRST_QUESTION_NAME).click();+ });++ getEmbedSidebar().within(() => {+ cy.findByText("Next").click();+ });++ H.expectUnstructuredSnowplowEvent({+ event: "embed_wizard_experience_completed",+ event_detail:+ "authType=guest-embed,experience=chart,isDefaultExperience=false",+ });++ H.expectUnstructuredSnowplowEvent({+ event: "embed_wizard_resource_selection_completed",+ event_detail: "isDefaultResource=false,experience=chart",+ });++ // Options step+ cy.findByLabelText("Guest").should("not.exist");+ cy.findByLabelText("Allow people to drill through on data points")+ .should("be.visible")+ .should("be.disabled");+ cy.findByLabelText("Allow downloads")+ .should("be.visible")+ .should("not.be.disabled")+ .should("not.be.checked");+ cy.findByLabelText("Allow people to save new questions")+ .should("be.visible")+ .should("be.disabled");++ getEmbedSidebar()+ .findByTestId("behavior-docs-link")+ .should("be.visible");+ getEmbedSidebar()+ .findByTestId("behavior-docs-link")+ .should("have.attr", "href")+ .and("include", "embedding/guest-embedding");++ H.setEmbeddingParameter("Text", "Locked");+ cy.findAllByTestId("parameter-widget")+ .find("input")+ .type("Foo Bar Baz");++ getEmbedSidebar().within(() => {+ cy.findByTestId("upsell-card").should("not.exist");+ });++ H.publishChanges("card");+ cy.button("Unpublish").should("be.visible");++ H.getSimpleEmbedIframeContent().within(() => {+ cy.findByText("Foo Bar Baz").should("be.visible");+ });++ H.getSimpleEmbedIframeContent()+ .findByTestId("embedding-footer")+ .should("not.exist");++ getEmbedSidebar().within(() => {+ cy.findByText("Get code").click();+ });++ H.expectUnstructuredSnowplowEvent({+ event: "embed_wizard_options_completed",+ event_detail:+ 'settings=custom,experience=chart,guestEmbedEnabled=true,guestEmbedType=guest-embed,authType=guest-embed,drills=false,withDownloads=false,withAlerts=false,withTitle=true,isSaveEnabled=false,params={"disabled":0,"locked":1,"enabled":0},theme=default',+ });++ // Get code step+ getEmbedSidebar().within(() => {+ codeBlock().should("exist");+ cy.findByTestId("publish-guest-embed-link").should("not.exist");+ });++ cy.log(+ 'Embed preview requests should not have "X-Metabase-Client" header (EMB-945)',+ );+ cy.wait("@previewEmbed").then(({ request }) => {+ expect(request?.headers?.["x-metabase-embedded-preview"]).to.equal(+ "true",+ );+ });++ H.unpublishChanges("card");++ getEmbedSidebar().within(() => {+ cy.findByTestId("publish-guest-embed-link").should("be.visible");++ cy.findByText(/Copy code/).should("not.exist");+ });++ H.publishChanges("card");++ getEmbedSidebar().within(() => {+ cy.findByTestId("publish-guest-embed-link").should("not.exist");+ });++ getEmbedSidebar().within(() => {+ cy.findAllByText(/Copy code/)+ .first()+ .click();+ });++ H.expectUnstructuredSnowplowEvent({+ event: "embed_wizard_code_copied",+ event_detail:+ "experience=chart,snippetType=frontend,guestEmbedEnabled=true,guestEmbedType=guest-embed,authSubType=none",+ });++ // Visit embed page+ getEmbedSidebar().within(() => {+ codeBlock()+ .invoke("text")+ .then((code: string) => {+ const match = code.match(/token="([^"]+)"/);+ expect(match, "JWT token present in code block").to.not.be.null;+ const jwtToken = match ? match[1] : "";+ cy.wrap(jwtToken).as("guestEmbedToken");+ });+ });++ cy.get<string>("@guestEmbedToken").then((token) => {+ const frame = H.loadSdkIframeEmbedTestPage({+ metabaseConfig: { isGuest: true },+ elements: [+ {+ component: "metabase-question",+ attributes: {+ token,+ },+ },+ ],+ });++ frame.within(() => {+ cy.findByText("Foo Bar Baz").should("be.visible");++ cy.findByTestId("embedding-footer").should("not.exist");+ });+ });+ });++ it("Properly re-initializes embedding parameters and Guest Embed navbar", () => {+ cy.get("@question1Id").then((questionId) => {+ cy.request("PUT", `/api/card/${questionId}`, {+ enable_embedding: true,+ });++ navigateToEmbedOptionsStep({+ experience: "chart",+ resourceName: FIRST_QUESTION_NAME,+ preselectGuest: true,+ });++ cy.button("Unpublish").should("be.visible");++ H.assertEmbeddingParameter("Text", "Disabled");++ getEmbedSidebar().within(() => {+ cy.findByText("Back").click();++ cy.findByTestId("embed-browse-entity-button").click();+ });++ entityPickerModal().within(() => {+ cy.findByTestId("item-picker-level-0")+ .findByText("Our analytics")+ .click();+ cy.findAllByText(SECOND_QUESTION_NAME).first().click();+ });++ getEmbedSidebar().within(() => {+ cy.findByText("Next").click();+ });++ cy.button("Unpublish").should("be.visible");++ H.assertEmbeddingParameter("Text1", "Editable");++ H.assertEmbeddingParameter("Text2", "Disabled");++ H.setEmbeddingParameter("Text1", "Locked");++ cy.button("Publish changes").should("be.visible");++ getEmbedSidebar().within(() => {+ cy.findByText("Back").click();++ cy.findByTestId("embed-browse-entity-button").click();+ });++ entityPickerModal().within(() => {+ cy.findByTestId("item-picker-level-0")+ .findByText("Our analytics")+ .click();+ cy.findAllByText(FIRST_QUESTION_NAME).first().click();+ });++ getEmbedSidebar().within(() => {+ cy.findByText("Next").click();+ });++ cy.button("Unpublish").should("be.visible");++ H.assertEmbeddingParameter("Text", "Disabled");+ });+ });++ it("Properly adjusts EmbedJS options when switching between guest/sso modes for a Dashboard", () => {+ cy.get("@dashboardId").then((dashboardId) => {+ cy.request("PUT", `/api/dashboard/${dashboardId}`, {+ enable_embedding: true,+ });++ enableJwtAuth();++ navigateToEmbedOptionsStep({+ experience: "dashboard",+ resourceName: DASHBOARD_NAME,+ preselectGuest: true,+ });++ getEmbedSidebar().within(() => {+ cy.findByLabelText("Guest").should("not.exist");+ });++ H.setEmbeddingParameter("Product ID", "Locked");++ getEmbedSidebar().within(() => {+ cy.findByText("Get code").click();++ codeBlock().first().should("contain", "token=");++ codeBlock().first().should("not.contain", "dashboard-id=");+ codeBlock().first().should("not.contain", "hidden-parameters=");+ codeBlock().first().should("not.contain", "locked-parameters=");++ cy.findByText("Back").click();+ cy.findByText("Back").click();++ cy.findByLabelText("Guest")+ .should("be.visible")+ .should("be.checked");++ cy.findByLabelText("Metabase account (SSO)").click();+ });++ embedModalEnableEmbedding();++ getEmbedSidebar().within(() => {+ cy.findByText("Next").click();+ cy.findByText("Get code").click();++ codeBlock().first().should("contain", "dashboard-id=");++ // hiddenParameters is reset to [] when switching from guest to SSO mode,+ // so hidden-parameters= should not appear in the code.+ codeBlock().first().should("not.contain", "hidden-parameters=");++ codeBlock().first().should("not.contain", "token=");+ codeBlock().first().should("not.contain", "locked-parameters=");+ });+ });+ });+ });+ });+});diff --git a/e2e/test/scenarios/embedding/sdk-iframe-embedding-setup/helpers/index.ts b/e2e/test/scenarios/embedding/sdk-iframe-embedding-setup/helpers/index.tsindex 4e3371107d4..d4280b17a92 100644--- a/e2e/test/scenarios/embedding/sdk-iframe-embedding-setup/helpers/index.ts+++ b/e2e/test/scenarios/embedding/sdk-iframe-embedding-setup/helpers/index.ts@@ -193,13 +193,4 @@ export const navigateToGetCodeStep = (options: NavigateToStepOptions) => {});};-export const completeWizard = (options: NavigateToStepOptions) => {- navigateToGetCodeStep(options);-- cy.log("complete wizard");- getEmbedSidebar().within(() => {- cy.findByText("Done").click();- });-};-export const codeBlock = () => cy.get(".cm-content");diff --git a/e2e/test/scenarios/embedding/sdk-iframe-embedding-setup/select-embed-entity.cy.spec.ts b/e2e/test/scenarios/embedding/sdk-iframe-embedding-setup/select-embed-entity.cy.spec.tsindex b9675889620..30751873205 100644--- a/e2e/test/scenarios/embedding/sdk-iframe-embedding-setup/select-embed-entity.cy.spec.ts+++ b/e2e/test/scenarios/embedding/sdk-iframe-embedding-setup/select-embed-entity.cy.spec.ts@@ -4,10 +4,7 @@ import {ORDERS_COUNT_QUESTION_ID,ORDERS_DASHBOARD_ID,} from "e2e/support/cypress_sample_instance_data";-import {- embedModalEnableEmbedding,- mockEmbedJsToDevServer,-} from "e2e/support/helpers";+import { mockEmbedJsToDevServer } from "e2e/support/helpers";import {getEmbedSidebar,@@ -35,8 +32,6 @@ describe(suiteTitle, () => {H.updateSetting("enable-embedding-modular", true);cy.intercept("GET", "/api/dashboard/**").as("dashboard");- cy.intercept("POST", "/api/card/*/query").as("cardQuery");- cy.intercept("GET", "/api/activity/recents?*").as("recentActivity");mockEmbedJsToDevServer();});@@ -45,24 +40,6 @@ describe(suiteTitle, () => {H.expectNoBadSnowplowEvents();});- it("tracks event details with `isDefaultResource=true` when keeping the default dashboard selection", () => {- visitNewEmbedPage();-- getEmbedSidebar().within(() => {- cy.findByText("Select a dashboard to embed").should("be.visible");-- cy.log("a default dashboard is preselected");- getResourceSelectorButton().should("contain", FIRST_DASHBOARD_NAME);-- cy.findByText("Next").click();- });-- H.expectUnstructuredSnowplowEvent({- event: "embed_wizard_resource_selection_completed",- event_detail: "isDefaultResource=true,experience=dashboard",- });- });-it("tracks event details with `isDefaultResource=false` when selecting a different dashboard", () => {cy.intercept("GET", "api/preview_embed/dashboard/*").as("previewEmbed");cy.log("add two dashboards to activity log");@@ -71,7 +48,6 @@ describe(suiteTitle, () => {({ body: { id: secondDashboardId } }) => {logRecent("dashboard", secondDashboardId);logRecent("dashboard", ORDERS_DASHBOARD_ID);- cy.wrap(secondDashboardId).as("secondDashboardId");},);@@ -92,6 +68,8 @@ describe(suiteTitle, () => {});H.entityPickerModal().within(() => {+ cy.findByText("Select a dashboard").should("be.visible");+cy.findByText(FIRST_DASHBOARD_NAME).click();});@@ -165,118 +143,6 @@ describe(suiteTitle, () => {cy.findByText(SECOND_QUESTION_NAME).should("be.visible");});});-- it("can search and select a dashboard", () => {- H.createDashboard({ name: SECOND_DASHBOARD_NAME }).then(- ({ body: { id: dashboardId } }) => {- cy.wrap(dashboardId).as("secondDashboardId");- },- );- visitNewEmbedPage();-- getEmbedSidebar().within(() => {- getResourceSelectorButton().click();- });-- H.entityPickerModal().within(() => {- cy.findByText("Select a dashboard").should("be.visible");-- // The picker opens on "Recent items" by default. Navigate via the- // root sidebar to disambiguate from any matching recent entries.- cy.findByTestId("item-picker-level-0")- .findByText("Our analytics")- .click();- cy.findByTestId("item-picker-level-1")- .findByText(SECOND_DASHBOARD_NAME)- .click();- });-- cy.log("button reflects the newly selected dashboard");- getEmbedSidebar().within(() => {- getResourceSelectorButton().should("contain", SECOND_DASHBOARD_NAME);- });-- cy.wait("@dashboard");- H.getSimpleEmbedIframeContent().within(() => {- cy.findByText(SECOND_DASHBOARD_NAME).should("be.visible");- });- });-- it("can search and select a question", () => {- visitNewEmbedPage();-- getEmbedSidebar().within(() => {- cy.findByText("Chart").click();- getResourceSelectorButton().click();- });-- H.entityPickerModal().within(() => {- cy.findByText("Select a chart").should("be.visible");- cy.findByText("Our analytics").click();- cy.findByText(FIRST_QUESTION_NAME).click();- });-- cy.log("button reflects the newly selected question");- getEmbedSidebar().within(() => {- getResourceSelectorButton().should("contain", FIRST_QUESTION_NAME);-- cy.findByText("Next").click();- });-- H.expectUnstructuredSnowplowEvent({- event: "embed_wizard_resource_selection_completed",- event_detail: "isDefaultResource=false,experience=chart",- });-- H.getSimpleEmbedIframeContent().within(() => {- cy.findByText(FIRST_QUESTION_NAME).should("be.visible");- });- });-- it("can search and select a collection for browser", () => {- visitNewEmbedPage();-- getEmbedSidebar().within(() => {- cy.findByLabelText("Metabase account (SSO)").click();- });-- embedModalEnableEmbedding();-- getEmbedSidebar().within(() => {- cy.findByText("Browser").click();- cy.findByText("Select initial collection").should("be.visible");- getResourceSelectorButton().click();- });-- H.entityPickerModal().within(() => {- cy.findByText("Select initial collection").should("be.visible");-- // The picker opens on "Recent items" by default. Navigate via the- // root sidebar to disambiguate from any matching recent entries.- cy.findByTestId("item-picker-level-0")- .findByText("Our analytics")- .click();- cy.findByTestId("item-picker-level-1")- .findByText("First collection")- .click();- cy.findByText("Select").click();- });-- cy.log("button reflects the newly selected collection");- getEmbedSidebar().within(() => {- getResourceSelectorButton().should("contain", "First collection");- });-- cy.log("collection is shown in the breadcrumbs and preview");- H.getSimpleEmbedIframeContent().within(() => {- cy.findByTestId("sdk-breadcrumbs")- .findAllByText("First collection")- .first()- .should("be.visible");-- cy.findByText("Second collection").should("be.visible");- });- });});const logRecent = (model: "dashboard" | "card", modelId: number | string) =>@@ -294,8 +160,6 @@ describe("recently created dashboards", () => {H.updateSetting("enable-embedding-modular", true);cy.intercept("GET", "/api/dashboard/**").as("dashboard");- cy.intercept("GET", "/api/activity/recents?*").as("recentActivity");- cy.intercept("GET", "/api/search?*").as("searchQuery");mockEmbedJsToDevServer();});diff --git a/e2e/test/scenarios/embedding/sdk-iframe-embedding-setup/select-embed-experience.cy.spec.ts b/e2e/test/scenarios/embedding/sdk-iframe-embedding-setup/select-embed-experience.cy.spec.tsindex f2b9626e5f9..115ed1ab2bc 100644--- a/e2e/test/scenarios/embedding/sdk-iframe-embedding-setup/select-embed-experience.cy.spec.ts+++ b/e2e/test/scenarios/embedding/sdk-iframe-embedding-setup/select-embed-experience.cy.spec.ts@@ -8,6 +8,7 @@ import {assertDashboard,assertRecentItemName,getEmbedSidebar,+ getResourceSelectorButton,visitNewEmbedPage,} from "./helpers";@@ -54,6 +55,11 @@ describe(suiteTitle, () => {embedModalEnableEmbedding();getEmbedSidebar().within(() => {+ cy.findByText("Select a dashboard to embed").should("be.visible");++ cy.log("a default dashboard is preselected");+ getResourceSelectorButton().should("contain", dashboardName);+cy.findByText("Next").click();});@@ -63,6 +69,11 @@ describe(suiteTitle, () => {"authType=guest-embed,experience=dashboard,isDefaultExperience=true",});+ H.expectUnstructuredSnowplowEvent({+ event: "embed_wizard_resource_selection_completed",+ event_detail: "isDefaultResource=true,experience=dashboard",+ });+H.getSimpleEmbedIframeContent().within(() => {cy.log("dashboard title is visible");cy.findByText(dashboardName).should("be.visible");@@ -105,7 +116,7 @@ describe(suiteTitle, () => {});});- it("shows browser template when selected", () => {+ it("shows browser template when selected and can pick a collection", () => {visitNewEmbedPage();getEmbedSidebar().within(() => {@@ -135,6 +146,40 @@ describe(suiteTitle, () => {cy.log("collection is visible in browser");cy.findAllByText("Orders in a dashboard").should("be.visible");});++ cy.log("a different collection can be selected via the picker");+ getEmbedSidebar().within(() => {+ cy.findByText("Back").click();+ cy.findByText("Select initial collection").should("be.visible");+ getResourceSelectorButton().click();+ });++ H.entityPickerModal().within(() => {+ cy.findByText("Select initial collection").should("be.visible");++ cy.findByTestId("item-picker-level-0")+ .findByText("Our analytics")+ .click();+ cy.findByTestId("item-picker-level-1")+ .findByText("First collection")+ .click();+ cy.findByText("Select").click();+ });++ cy.log("button reflects the newly selected collection");+ getEmbedSidebar().within(() => {+ getResourceSelectorButton().should("contain", "First collection");+ });++ cy.log("collection is shown in the breadcrumbs and preview");+ H.getSimpleEmbedIframeContent().within(() => {+ cy.findByTestId("sdk-breadcrumbs")+ .findAllByText("First collection")+ .first()+ .should("be.visible");++ cy.findByText("Second collection").should("be.visible");+ });});});@@ -239,28 +284,4 @@ describe(suiteTitle, () => {cy.findByAltText("No results").should("be.visible");});-- it("shows Metabot experience when selected", () => {- visitNewEmbedPage();-- getEmbedSidebar().within(() => {- cy.findByLabelText("Metabase account (SSO)").click();- });-- embedModalEnableEmbedding();-- getEmbedSidebar().within(() => {- cy.findByText("Metabot").click();- cy.findByText("Next").click();- });-- H.expectUnstructuredSnowplowEvent({- event: "embed_wizard_experience_completed",- event_detail: "authType=sso,experience=metabot,isDefaultExperience=false",- });-- H.getSimpleEmbedIframeContent().within(() => {- cy.findByText("Ask questions to AI.").should("be.visible");- });- });});diff --git a/e2e/test/scenarios/embedding/sdk-iframe-embedding-setup/select-embed-options.cy.spec.ts b/e2e/test/scenarios/embedding/sdk-iframe-embedding-setup/select-embed-options.cy.spec.tsindex 6214bd6005d..b87b9037218 100644--- a/e2e/test/scenarios/embedding/sdk-iframe-embedding-setup/select-embed-options.cy.spec.ts+++ b/e2e/test/scenarios/embedding/sdk-iframe-embedding-setup/select-embed-options.cy.spec.ts@@ -36,7 +36,6 @@ describe("OSS", { tags: "@OSS" }, () => {H.updateSetting("enable-embedding-modular", true);cy.intercept("GET", "/api/dashboard/**").as("dashboard");- cy.intercept("POST", "/api/card/*/query").as("cardQuery");mockEmbedJsToDevServer();});@@ -72,7 +71,6 @@ describe("EE without license", () => {H.updateSetting("enable-embedding-modular", true);cy.intercept("GET", "/api/dashboard/**").as("dashboard");- cy.intercept("POST", "/api/card/*/query").as("cardQuery");mockEmbedJsToDevServer();});@@ -99,7 +97,6 @@ describe(suiteTitle, () => {H.setupAnthropicLlmProvider();cy.intercept("GET", "/api/dashboard/**").as("dashboard");- cy.intercept("POST", "/api/card/*/query").as("cardQuery");cy.intercept("PUT", "/api/setting/sdk-iframe-embed-setup-settings").as("persistSettings",);@@ -111,7 +108,7 @@ describe(suiteTitle, () => {H.expectNoBadSnowplowEvents();});- it("toggles drill-throughs for dashboards when SSO auth method is selected", () => {+ it("toggles downloads and drill-throughs for dashboards when SSO auth method is selected", () => {navigateToEmbedOptionsStep({experience: "dashboard",resourceName: DASHBOARD_NAME,@@ -119,26 +116,25 @@ describe(suiteTitle, () => {});getEmbedSidebar()- .findByLabelText("Allow people to drill through on data points")- .should("be.checked");+ .findByLabelText("Allow downloads")+ .should("not.be.checked");- cy.log("drill-through should be enabled in the preview");- H.getSimpleEmbedIframeContent().within(() => {- cy.findByText("110.93").click();- cy.findByText("Filter by this value").should("be.visible");- });+ H.getSimpleEmbedIframeContent()+ .findByText(DASHBOARD_NAME)+ .should("be.visible");+ H.getSimpleEmbedIframeContent()+ .findByTestId("export-as-pdf-button")+ .should("not.exist");- cy.log("turn off drill-through");+ cy.log("turn on downloads");getEmbedSidebar()- .findByLabelText("Allow people to drill through on data points")+ .findByLabelText("Allow downloads").click()- .should("not.be.checked");+ .should("be.checked");- cy.log("drill-through should be disabled in the preview");- H.getSimpleEmbedIframeContent().within(() => {- cy.findByText("110.93").click();- cy.findByText("Filter by this value").should("not.exist");- });+ H.getSimpleEmbedIframeContent()+ .findByTestId("export-as-pdf-button")+ .should("be.visible");cy.log("snippet should be updated");getEmbedSidebar().findByText("Get code").click();@@ -146,36 +142,45 @@ describe(suiteTitle, () => {H.expectUnstructuredSnowplowEvent({event: "embed_wizard_options_completed",event_detail:- "settings=custom,experience=dashboard,authType=sso,drills=false,withDownloads=false,withSubscriptions=false,withTitle=true,theme=default",+ "settings=custom,experience=dashboard,authType=sso,drills=true,withDownloads=true,withSubscriptions=false,withTitle=true,theme=default",});- codeBlock().should("contain", 'drills="false"');- });-- it("toggles downloads for dashboard", () => {- navigateToEmbedOptionsStep({- experience: "dashboard",- resourceName: DASHBOARD_NAME,- preselectSso: true,- });+ codeBlock().should("contain", 'with-downloads="true"');+ codeBlock().should("contain", 'with-subscriptions="false"');+ cy.log("go back and turn off downloads");+ getEmbedSidebar().findByText("Back").click();getEmbedSidebar().findByLabelText("Allow downloads")+ .should("be.checked")+ .click().should("not.be.checked");H.getSimpleEmbedIframeContent().findByTestId("export-as-pdf-button").should("not.exist");- cy.log("turn on downloads");getEmbedSidebar()- .findByLabelText("Allow downloads")- .click()+ .findByLabelText("Allow people to drill through on data points").should("be.checked");- H.getSimpleEmbedIframeContent()- .findByTestId("export-as-pdf-button")- .should("be.visible");+ cy.log("drill-through should be enabled in the preview");+ H.getSimpleEmbedIframeContent().within(() => {+ cy.findByText("110.93").should("be.visible").click();+ cy.findByText("Filter by this value").should("be.visible");+ });++ cy.log("turn off drill-through");+ getEmbedSidebar()+ .findByLabelText("Allow people to drill through on data points")+ .click()+ .should("not.be.checked");++ cy.log("drill-through should be disabled in the preview");+ H.getSimpleEmbedIframeContent().within(() => {+ cy.findByText("110.93").should("be.visible").click();+ cy.findByText("Filter by this value").should("not.exist");+ });cy.log("snippet should be updated");getEmbedSidebar().findByText("Get code").click();@@ -183,10 +188,10 @@ describe(suiteTitle, () => {H.expectUnstructuredSnowplowEvent({event: "embed_wizard_options_completed",event_detail:- "settings=custom,experience=dashboard,authType=sso,drills=true,withDownloads=true,withSubscriptions=false,withTitle=true,theme=default",+ "settings=custom,experience=dashboard,authType=sso,drills=false,withDownloads=false,withSubscriptions=false,withTitle=true,theme=default",});- codeBlock().should("contain", 'with-subscriptions="false"');+ codeBlock().should("contain", 'drills="false"');});it("cannot select subscriptions for dashboard when email is not set up", () => {@@ -385,84 +390,6 @@ describe(suiteTitle, () => {codeBlock().should("contain", 'with-subscriptions="true"');});- it("toggles dashboard title for dashboards", () => {- navigateToEmbedOptionsStep({- experience: "dashboard",- resourceName: DASHBOARD_NAME,- preselectGuest: true,- });-- H.publishChanges("dashboard");-- cy.button("Unpublish").should("be.visible");-- getEmbedSidebar()- .findByLabelText("Show dashboard title")- .should("be.checked");-- H.getSimpleEmbedIframeContent()- .findByText("Orders in a dashboard")- .should("be.visible");-- cy.log("turn off title");- getEmbedSidebar()- .findByLabelText("Show dashboard title")- .click()- .should("not.be.checked");-- H.getSimpleEmbedIframeContent()- .findByText("Orders in a dashboard")- .should("not.exist");-- cy.log("snippet should be updated");- getEmbedSidebar().findByText("Get code").click();-- H.expectUnstructuredSnowplowEvent({- event: "embed_wizard_options_completed",- event_detail:- 'settings=custom,experience=dashboard,guestEmbedEnabled=true,guestEmbedType=guest-embed,authType=guest-embed,drills=false,withDownloads=false,withSubscriptions=false,withTitle=false,params={"disabled":0,"locked":0,"enabled":0},theme=default',- });-- codeBlock().should("contain", 'with-title="false"');- });-- it("toggles drill-through for charts for SSO auth mode", () => {- navigateToEmbedOptionsStep({- experience: "chart",- resourceName: QUESTION_NAME,- preselectSso: true,- });-- getEmbedSidebar()- .findByLabelText("Allow people to drill through on data points")- .should("be.checked");-- cy.log("drill-through should be disabled by default in chart preview");- H.getSimpleEmbedIframeContent().within(() => {- cy.findByText("18,760").click();- cy.findByText("See these Orders").should("exist");- });-- cy.log("turn off drill-through");- getEmbedSidebar()- .findByLabelText("Allow people to drill through on data points")- .click()- .should("not.be.checked");-- cy.log("drill-through should be disabled in chart preview");- H.getSimpleEmbedIframeContent().within(() => {- cy.findByText("18,760").click();- cy.findByText("See these Orders").should("not.exist");- });-- cy.log("allow downloads should be visible when drills are off (EMB-712)");- getEmbedSidebar().findByLabelText("Allow downloads").should("be.visible");-- cy.log("snippet should be updated");- getEmbedSidebar().findByText("Get code").click();- codeBlock().should("contain", 'drills="false"');- });-it("toggles downloads for charts", () => {navigateToEmbedOptionsStep({experience: "chart",@@ -478,6 +405,9 @@ describe(suiteTitle, () => {.findByLabelText("Allow downloads").should("not.be.checked");+ H.getSimpleEmbedIframeContent()+ .findByText(QUESTION_NAME)+ .should("be.visible");H.getSimpleEmbedIframeContent().findByTestId("question-download-widget-button").should("not.exist");@@ -504,13 +434,24 @@ describe(suiteTitle, () => {codeBlock().should("contain", 'with-downloads="true"');});- it("toggles chart title for charts", () => {+ it("toggles chart title and drill-through for charts for SSO auth mode", () => {navigateToEmbedOptionsStep({experience: "chart",resourceName: QUESTION_NAME,preselectSso: true,});+ getEmbedSidebar().within(() => {+ cy.findByText("Parameters are not available for this chart.").should(+ "be.visible",+ );++ cy.findByTestId("behavior-docs-link").should("be.visible");+ cy.findByTestId("behavior-docs-link")+ .should("have.attr", "href")+ .and("include", "embedding/question-reference");+ });+cy.log("chart title should be visible by default");getEmbedSidebar().findByLabelText("Show chart title").should("be.checked");H.getSimpleEmbedIframeContent()@@ -528,6 +469,13 @@ describe(suiteTitle, () => {.findByText("Orders, Count").should("not.exist");+ cy.log("drill-through should be enabled by default in chart preview");+ H.getSimpleEmbedIframeContent().within(() => {+ cy.findByTestId("interactive-question-result-toolbar").should("exist");+ cy.findByText("18,760").should("be.visible").click();+ cy.findByText("See these Orders").should("exist");+ });+cy.log("set drills to false");getEmbedSidebar().findByLabelText("Allow people to drill through on data points")@@ -535,6 +483,19 @@ describe(suiteTitle, () => {.click().should("not.be.checked");+ cy.log("allow downloads should be visible when drills are off (EMB-712)");+ getEmbedSidebar().findByLabelText("Allow downloads").should("be.visible");++ cy.log("drill-through should be disabled in chart preview");+ H.getSimpleEmbedIframeContent().within(() => {+ cy.log("the static question has no interactive toolbar");+ cy.findByTestId("interactive-question-result-toolbar", {+ timeout: RERENDER_TIMEOUT,+ }).should("not.exist");+ cy.findByText("18,760").should("be.visible").click();+ cy.findByText("See these Orders").should("not.exist");+ });+cy.log("chart title state should remain unchecked");getEmbedSidebar().findByLabelText("Show chart title")@@ -548,6 +509,7 @@ describe(suiteTitle, () => {cy.log("snippet should be updated");getEmbedSidebar().findByText("Get code").click();codeBlock().should("contain", 'with-title="false"');+ codeBlock().should("contain", 'drills="false"');cy.log("go back to embed options step");getEmbedSidebar().findByText("Back").click();@@ -563,6 +525,17 @@ describe(suiteTitle, () => {H.getSimpleEmbedIframeContent().findByText("Orders, Count").should("be.visible");++ cy.log("docs link should not be shown for metabot");+ getEmbedSidebar().within(() => {+ cy.findByText("Back").click();++ cy.findByText("Metabot").click();+ cy.findByText("Next").click();++ cy.findByLabelText("Auto").should("exist");+ cy.findByTestId("behavior-docs-link").should("not.exist");+ });});it("cannot select alerts for question when email is not set up", () => {@@ -711,28 +684,6 @@ describe(suiteTitle, () => {codeBlock().should("contain", 'with-alerts="true"');});- it("shows a docs icon in behavior section depending on a component", () => {- navigateToEmbedOptionsStep({- experience: "chart",- resourceName: QUESTION_NAME,- preselectSso: true,- });-- getEmbedSidebar().within(() => {- cy.findByTestId("behavior-docs-link").should("be.visible");- cy.findByTestId("behavior-docs-link")- .should("have.attr", "href")- .and("include", "embedding/question-reference");-- cy.findByText("Back").click();-- cy.findByText("Metabot").click();- cy.findByText("Next").click();-- cy.findByTestId("behavior-docs-link").should("not.exist");- });- });-["exploration", "chart"].forEach((experience) => {it(`toggles save button for ${experience}`, () => {navigateToEmbedOptionsStep(@@ -796,31 +747,6 @@ describe(suiteTitle, () => {});});- it("toggles save button for metabot", () => {- navigateToEmbedOptionsStep({ experience: "metabot" });-- getEmbedSidebar()- .findByLabelText("Allow people to save new questions")- .should("not.be.checked");-- cy.log("turn on save option");- getEmbedSidebar()- .findByLabelText("Allow people to save new questions")- .click()- .should("be.checked");-- cy.log("snippet should be updated");- getEmbedSidebar().findByText("Get code").click();-- H.expectUnstructuredSnowplowEvent({- event: "embed_wizard_options_completed",- event_detail:- "settings=custom,experience=metabot,authType=sso,isSaveEnabled=true,theme=default",- });-- codeBlock().should("contain", 'is-save-enabled="true"');- });-it("can toggle read-only setting for browser", () => {navigateToEmbedOptionsStep({experience: "browser",@@ -832,6 +758,7 @@ describe(suiteTitle, () => {.should("not.be.checked");H.getSimpleEmbedIframeContent().within(() => {+ cy.findByText("Second collection").should("be.visible");cy.findByText("New dashboard").should("not.exist");});@@ -857,7 +784,7 @@ describe(suiteTitle, () => {codeBlock().should("contain", 'read-only="false"');});- it("can change brand color and reset colors", () => {+ it("can change brand color, reset colors and toggle dashboard title", () => {navigateToEmbedOptionsStep({experience: "dashboard",resourceName: DASHBOARD_NAME,@@ -935,6 +862,38 @@ describe(suiteTitle, () => {event: "embed_wizard_options_completed",event_detail: "settings=default",});++ cy.log("go back to embed options step to toggle the dashboard title");+ getEmbedSidebar().findByText("Back").click();++ getEmbedSidebar()+ .findByLabelText("Show dashboard title")+ .should("be.checked");++ H.getSimpleEmbedIframeContent()+ .findByText("Orders in a dashboard")+ .should("be.visible");++ cy.log("turn off title");+ getEmbedSidebar()+ .findByLabelText("Show dashboard title")+ .click()+ .should("not.be.checked");++ H.getSimpleEmbedIframeContent()+ .findByText("Orders in a dashboard")+ .should("not.exist");++ cy.log("snippet should be updated");+ getEmbedSidebar().findByText("Get code").click();++ H.expectUnstructuredSnowplowEvent({+ event: "embed_wizard_options_completed",+ event_detail:+ 'settings=custom,experience=dashboard,guestEmbedEnabled=true,guestEmbedType=guest-embed,authType=guest-embed,drills=false,withDownloads=false,withSubscriptions=false,withTitle=false,params={"disabled":0,"locked":0,"enabled":0},theme=default',+ });++ codeBlock().should("contain", 'with-title="false"');});it("derives colors for dark theme palette", () => {@@ -1007,9 +966,47 @@ describe(suiteTitle, () => {cy.wait("@persistSettings");});- it("can toggle the Metabot layout from auto to stacked to sidebar", () => {+ it("shows Metabot and toggles its save button and layout", () => {navigateToEmbedOptionsStep({ experience: "metabot" });+ H.expectUnstructuredSnowplowEvent({+ event: "embed_wizard_experience_completed",+ event_detail: "authType=sso,experience=metabot,isDefaultExperience=false",+ });++ H.getSimpleEmbedIframeContent().within(() => {+ cy.findByText("Ask questions to AI.").should("be.visible");+ });++ getEmbedSidebar()+ .findByLabelText("Allow people to save new questions")+ .should("not.be.checked");++ cy.log("turn on save option");+ getEmbedSidebar()+ .findByLabelText("Allow people to save new questions")+ .click()+ .should("be.checked");++ cy.log("snippet should be updated");+ getEmbedSidebar().findByText("Get code").click();++ H.expectUnstructuredSnowplowEvent({+ event: "embed_wizard_options_completed",+ event_detail:+ "settings=custom,experience=metabot,authType=sso,isSaveEnabled=true,theme=default",+ });++ codeBlock().should("contain", 'is-save-enabled="true"');++ cy.log("go back and turn off save option");+ getEmbedSidebar().findByText("Back").click();+ getEmbedSidebar()+ .findByLabelText("Allow people to save new questions")+ .click()+ .should("not.be.checked");++ cy.log("toggle the layout from auto to stacked to sidebar");getEmbedSidebar().findByLabelText("Auto").should("be.checked");getEmbedSidebar().findByLabelText("Stacked").click().should("be.checked");