Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

Remove special embedding-sdk e2e test case (#65594)

Nemanja Glumacb614b64281af
diff --git a/.github/actions/run-embedding-sdk-storybook/action.yml b/.github/actions/run-embedding-sdk-storybook/action.yml
deleted file mode 100644
index 41d1635a0d6..00000000000
--- a/.github/actions/run-embedding-sdk-storybook/action.yml
+++ /dev/null
@@ -1,31 +0,0 @@
-name: Run Embedding SDK Storybook
-runs:
- using: "composite"
- steps:
- - name: Prepare frontend environment
- uses: ./.github/actions/prepare-frontend
-
- - name: Prepare back-end environment
- uses: ./.github/actions/prepare-backend
-
- - name: Compile CLJS
- run: yarn build-pure:cljs
- shell: bash
-
- - name: Build Storybook
- run: yarn build-storybook-embedding-sdk
- shell: bash
-
- - name: Serve Storybook
- run: yarn http-server storybook-static -p 6006 &
- shell: bash
-
- - name: Wait for Storybook to become available
- run: |
- echo "Waiting for Storybook to be served..."
- while ! curl --silent --fail http://localhost:6006; do
- sleep 5
- echo "Retrying..."
- done
- echo "Storybook is being served!"
- shell: bash
diff --git a/.github/scripts/build-e2e-matrix.js b/.github/scripts/build-e2e-matrix.js
index cdfe0488311..0194d70da3b 100755
--- a/.github/scripts/build-e2e-matrix.js
+++ b/.github/scripts/build-e2e-matrix.js
@@ -3,14 +3,8 @@
// grouping some specific tests together, other tests are split into chunks
const DEFAULT_SPEC_PATTERN = "./e2e/test/scenarios/**/*.cy.spec.*";
-const EMBEDDING_SDK_SPEC_PATTERN =
- "./e2e/test/scenarios/embedding-sdk/**.cy.spec.*";
const specialTestConfigs = [
- {
- name: "embedding-sdk",
- specs: EMBEDDING_SDK_SPEC_PATTERN,
- },
{
name: "oss-subset",
edition: "oss",
diff --git a/.github/scripts/build-e2e-matrix.unit.spec.js b/.github/scripts/build-e2e-matrix.unit.spec.js
index a010436b995..735e8590d86 100644
--- a/.github/scripts/build-e2e-matrix.unit.spec.js
+++ b/.github/scripts/build-e2e-matrix.unit.spec.js
@@ -11,7 +11,7 @@ describe("buildMatrix", () => {
it("should calculate correct regular chunks with default parameters", () => {
const result = testBuildMatrix("./e2e/test/scenarios/**/*.cy.spec.*", 30);
- expect(result.regularChunks).toBe(26);
+ expect(result.regularChunks).toBe(27);
});
it("should create correct number of configuration objects", () => {
@@ -23,7 +23,7 @@ describe("buildMatrix", () => {
it("should apply default specs path when empty entry is provided", () => {
const result = testBuildMatrix("", 6);
- expect(result.regularChunks).toBe(2);
+ expect(result.regularChunks).toBe(3);
expect(result.config.length).toBe(6);
});
@@ -39,14 +39,13 @@ describe("buildMatrix", () => {
});
it("should handle case when input chunks equals special tests count", () => {
- const result = testBuildMatrix("./e2e/test/scenarios/**/*.cy.spec.*", 4);
+ const result = testBuildMatrix("./e2e/test/scenarios/**/*.cy.spec.*", 3);
expect(result.regularChunks).toBe(0);
- expect(result.config.length).toBe(4);
- expect(result.config[0].name).toBe("embedding-sdk");
- expect(result.config[1].name).toBe("oss-subset");
- expect(result.config[2].name).toBe("mongo");
- expect(result.config[3].name).toBe("python");
+ expect(result.config.length).toBe(3);
+ expect(result.config[0].name).toBe("oss-subset");
+ expect(result.config[1].name).toBe("mongo");
+ expect(result.config[2].name).toBe("python");
});
it("should correctly calculate regularChunks for non-default spec pattern", () => {
@@ -84,7 +83,6 @@ describe("buildMatrix", () => {
it("should return special test configs when default spec pattern is provided", () => {
const result = testBuildMatrix("./e2e/test/scenarios/**/*.cy.spec.*", 50);
- expect(result.config[46].name).toBe("embedding-sdk");
expect(result.config[47].name).toBe("oss-subset");
expect(result.config[48].name).toBe("mongo");
expect(result.config[49].name).toBe("python");
diff --git a/.github/workflows/e2e-test.yml b/.github/workflows/e2e-test.yml
index 6dccd1eb7cd..7b75a813e54 100644
--- a/.github/workflows/e2e-test.yml
+++ b/.github/workflows/e2e-test.yml
@@ -59,7 +59,6 @@ jobs:
TZ: US/Pacific # to make node match the instance tz
CYPRESS_CI: true
CYPRESS_QA_DB_MONGO: ${{ inputs.name == 'mongo' }}
- CYPRESS_IS_EMBEDDING_SDK: "${{ inputs.name == 'embedding-sdk' }}"
steps:
- uses: actions/checkout@v4
with:
@@ -85,10 +84,6 @@ jobs:
mysql: ${{ inputs.name != 'mongo' }}
mongo: ${{ inputs.name == 'mongo' }}
- - name: Run Embedding SDK Storybook
- if: inputs.name == 'embedding-sdk'
- uses: ./.github/actions/run-embedding-sdk-storybook
-
- name: Retrieve uberjar artifact for ${{ inputs.edition }}
uses: ./.github/actions/fetch-artifact
with:
diff --git a/e2e/support/config.js b/e2e/support/config.js
index 091d28d34ee..2edf43fdfe0 100644
--- a/e2e/support/config.js
+++ b/e2e/support/config.js
@@ -49,17 +49,6 @@ const assetsResolverPlugin = {
},
};
-// these are special and shouldn't be chunked out arbitrarily
-const specBlacklist = ["/embedding-sdk/"];
-
-function getSplittableSpecs(specs) {
- return specs.filter((spec) => {
- return !specBlacklist.some((blacklistedPath) =>
- spec.includes(blacklistedPath),
- );
- });
-}
-
const defaultConfig = {
// This is the functionality of the old cypress-plugins.js file
setupNodeEvents(cypressOn, config) {
@@ -153,7 +142,7 @@ const defaultConfig = {
require("@cypress/grep/src/plugin")(config);
if (isCI) {
- cypressSplit(on, config, getSplittableSpecs);
+ cypressSplit(on, config);
collectFailingTests(on, config);
}
diff --git a/e2e/test/scenarios/embedding-sdk/static-dashboard-cors.cy.spec.js b/e2e/test/scenarios/embedding-sdk/static-dashboard-cors.cy.spec.js
deleted file mode 100644
index 6c532db9551..00000000000
--- a/e2e/test/scenarios/embedding-sdk/static-dashboard-cors.cy.spec.js
+++ /dev/null
@@ -1,185 +0,0 @@
-const { H } = cy;
-import { USERS } from "e2e/support/cypress_data";
-import {
- ORDERS_DASHBOARD_DASHCARD_ID,
- ORDERS_QUESTION_ID,
-} from "e2e/support/cypress_sample_instance_data";
-import { AUTH_PROVIDER_URL } from "e2e/support/helpers";
-import { visitFullAppEmbeddingUrl } from "e2e/support/helpers/e2e-embedding-helpers";
-import {
- EMBEDDING_SDK_STORY_HOST,
- getStorybookSdkRoot,
-} from "e2e/support/helpers/e2e-embedding-sdk-helpers";
-import {
- JWT_SHARED_SECRET,
- enableJwtAuth,
-} from "e2e/support/helpers/e2e-jwt-helpers";
-
-const STORYBOOK_ID = "embeddingsdk-cypressstaticdashboardwithcors--default";
-
-describe("scenarios > embedding-sdk > static-dashboard", () => {
- beforeEach(() => {
- H.restore();
- cy.signIn("admin", { skipCache: true });
- H.activateToken("pro-self-hosted");
- enableJwtAuth();
-
- const textCard = H.getTextCardDetails({ col: 16, text: "Text text card" });
- const questionCard = {
- id: ORDERS_DASHBOARD_DASHCARD_ID,
- card_id: ORDERS_QUESTION_ID,
- row: 0,
- col: 0,
- size_x: 16,
- size_y: 8,
- visualization_settings: {
- "card.title": "Test question card",
- },
- };
-
- H.createDashboard(
- {
- name: "Embedding Sdk Test Dashboard",
- dashcards: [questionCard, textCard],
- },
- { wrapId: true },
- );
-
- cy.intercept("GET", "/api/dashboard/*").as("getDashboard");
- cy.intercept("GET", "/api/user/current").as("getUser");
- cy.intercept("POST", "/api/dashboard/*/dashcard/*/card/*/query").as(
- "dashcardQuery",
- );
-
- cy.task("signJwt", {
- payload: {
- email: USERS.normal.email,
- exp: Math.round(Date.now() / 1000) + 10 * 60,
- },
- secret: JWT_SHARED_SECRET,
- }).then((jwtToken) => {
- cy.intercept("GET", `${AUTH_PROVIDER_URL}?response=json`, {
- jwt: jwtToken,
- });
- });
- });
-
- it("should not render dashboard when embedding SDK is not enabled", () => {
- cy.request("PUT", "/api/setting", {
- "enable-embedding-sdk": false,
- });
- cy.signOut();
-
- cy.get("@dashboardId").then((dashboardId) => {
- visitFullAppEmbeddingUrl({
- url: EMBEDDING_SDK_STORY_HOST,
- qs: { id: STORYBOOK_ID, viewMode: "story" },
- onBeforeLoad: (window) => {
- window.METABASE_INSTANCE_URL = Cypress.config().baseUrl;
- window.DASHBOARD_ID = dashboardId;
- },
- });
- });
-
- getStorybookSdkRoot().within(() => {
- cy.findByText(
- "Embedding SDK for React is disabled. Enable it in the embedding settings.",
- ).should("be.visible");
- });
- });
-
- it("should show dashboard content", () => {
- cy.request("PUT", "/api/setting", {
- "enable-embedding-sdk": true,
- });
- cy.signOut();
- cy.get("@dashboardId").then((dashboardId) => {
- visitFullAppEmbeddingUrl({
- url: EMBEDDING_SDK_STORY_HOST,
- qs: { id: STORYBOOK_ID, viewMode: "story" },
- onBeforeLoad: (window) => {
- window.METABASE_INSTANCE_URL = Cypress.config().baseUrl;
- window.DASHBOARD_ID = dashboardId;
- },
- });
- });
-
- cy.wait("@getUser").then(({ response }) => {
- expect(response?.statusCode).to.equal(200);
- });
-
- cy.wait("@getDashboard").then(({ response }) => {
- expect(response?.statusCode).to.equal(200);
- });
-
- getStorybookSdkRoot().within(() => {
- cy.findByText("Embedding Sdk Test Dashboard").should("be.visible"); // dashboard title
-
- cy.findByText("Text text card").should("be.visible"); // text card content
-
- cy.wait("@dashcardQuery");
- cy.findByText("Test question card").should("be.visible"); // question card content
- });
- });
-
- it("should not render the SDK on non localhost sites when embedding SDK origins is not set", () => {
- cy.request("PUT", "/api/setting", {
- "enable-embedding-sdk": true,
- });
- cy.signOut();
- cy.get("@dashboardId").then((dashboardId) => {
- visitFullAppEmbeddingUrl({
- url: "http://my-site.local:6006/iframe.html",
- qs: {
- id: STORYBOOK_ID,
- viewMode: "story",
- },
- onBeforeLoad: (window) => {
- window.METABASE_INSTANCE_URL = Cypress.config().baseUrl;
- window.DASHBOARD_ID = dashboardId;
- },
- });
- });
-
- getStorybookSdkRoot().within(() => {
- cy.findByText(
- "Unable to connect to instance at http://localhost:4000",
- ).should("be.visible");
- });
- });
-
- it("should show dashboard content", () => {
- cy.request("PUT", "/api/setting", {
- "enable-embedding-sdk": true,
- "embedding-app-origins-sdk": "my-site.local:6006",
- });
- cy.signOut();
- cy.get("@dashboardId").then((dashboardId) => {
- visitFullAppEmbeddingUrl({
- url: "http://my-site.local:6006/iframe.html",
- qs: { id: STORYBOOK_ID, viewMode: "story" },
- onBeforeLoad: (window) => {
- window.METABASE_INSTANCE_URL = Cypress.config().baseUrl;
- window.DASHBOARD_ID = dashboardId;
- },
- });
- });
-
- cy.wait("@getUser").then(({ response }) => {
- expect(response?.statusCode).to.equal(200);
- });
-
- cy.wait("@getDashboard").then(({ response }) => {
- expect(response?.statusCode).to.equal(200);
- });
-
- getStorybookSdkRoot().within(() => {
- cy.findByText("Embedding Sdk Test Dashboard").should("be.visible"); // dashboard title
-
- cy.findByText("Text text card").should("be.visible"); // text card content
-
- cy.wait("@dashcardQuery");
- cy.findByText("Test question card").should("be.visible"); // question card content
- });
- });
-});
diff --git a/package.json b/package.json
index 368ebd77cfc..a12a248c054 100644
--- a/package.json
+++ b/package.json
@@ -412,7 +412,6 @@
"build-static-viz:watch-wait": "yarn wait:cljs; yarn build-static-viz:watch",
"build-stats": "yarn && rspack --json > stats.json",
"build-storybook": "NODE_OPTIONS=--max-old-space-size=8192 storybook build",
- "build-storybook-embedding-sdk": "NODE_OPTIONS=--max-old-space-size=8192 IS_EMBEDDING_SDK=true storybook build -c enterprise/frontend/src/embedding-sdk-shared/.storybook --quiet",
"build-watch": "yarn concurrently -n 'cljs,js' 'yarn build-watch:cljs' 'yarn build-watch:js'",
"build-watch:cljs": "yarn && shadow-cljs watch app",
"build-watch:js": "yarn && NODE_OPTIONS=--max-old-space-size=8192 rspack serve --watch",