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
Run SDK embedding e2e tests in the pre-release sanity check (#85523)
Chris Vandoodewaard9f81a6dea2bc
diff --git a/.github/workflows/pre-release.yml b/.github/workflows/pre-release.ymlindex bc1a06b2d7d..0cb444f2c6c 100644--- a/.github/workflows/pre-release.yml+++ b/.github/workflows/pre-release.yml@@ -143,7 +143,7 @@ jobs:run-sanity-check:runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}- timeout-minutes: 30+ timeout-minutes: 45needs: [test-mode-config, release-artifact]strategy:matrix:@@ -177,6 +177,13 @@ jobs:uses: actions/checkout@v7with:ref: ${{ needs.release-artifact.outputs.commit }}+ - name: Find pre-release Embedding SDK component tests+ id: sdk-specs+ if: ${{ matrix.edition == 'ee' }}+ run: |+ specs=$(grep -rl --include='*.cy.spec.tsx' "@prerelease" e2e/test-component/scenarios/embedding-sdk | paste -sd, - || true)+ echo "Pre-release Embedding SDK component specs: ${specs:-none}"+ echo "specs=$specs" >> "$GITHUB_OUTPUT"- name: Prepare Docker containersuses: ./.github/actions/e2e-prepare-containerswith:@@ -191,6 +198,9 @@ jobs:uses: ./.github/actions/prepare-backend- name: Compile CLJSrun: ${{ needs.test-mode-config.outputs.package_manager }} run build-pure:cljs+ - name: Build Embedding SDK package+ if: ${{ matrix.edition == 'ee' && steps.sdk-specs.outputs.specs != '' }}+ run: ${{ needs.test-mode-config.outputs.package_manager }} run build-embedding-sdk-package- name: Prepare Cypress environmentid: cypress-prepuses: ./.github/actions/prepare-cypress@@ -236,6 +246,17 @@ jobs:"$CYPRESS_GREP_FLAG" grepTags="@prerelease+-@OSS" \--spec './e2e/test/scenarios/**/*.cy.spec.(js|ts)'+ - name: Run a few important Embedding SDK component tests as sanity check+ if: ${{ !cancelled() && matrix.edition == 'ee' && steps.sdk-specs.outputs.specs != '' }}+ env:+ CYPRESS_BROWSER: ${{ steps.cypress-prep.outputs.chrome-path }}+ SPECS: ${{ steps.sdk-specs.outputs.specs }}+ CYPRESS_VIDEO: "false"+ run: |+ node e2e/runner/run_cypress_ci.js component \+ "$CYPRESS_GREP_FLAG" grepTags="@prerelease" \+ --spec "$SPECS"+- name: Upload Cypress Artifacts upon failureuses: actions/upload-artifact@v7if: failure()diff --git a/e2e/test-component/scenarios/embedding-sdk/sdk-bundle.cy.spec.tsx b/e2e/test-component/scenarios/embedding-sdk/sdk-bundle.cy.spec.tsxindex df90c97a2fe..2672702e137 100644--- a/e2e/test-component/scenarios/embedding-sdk/sdk-bundle.cy.spec.tsx+++ b/e2e/test-component/scenarios/embedding-sdk/sdk-bundle.cy.spec.tsx@@ -54,7 +54,7 @@ describe([{ strictMode: false }, { strictMode: true }].forEach(({ strictMode }) => {describe(`Common cases ${strictMode ? "with" : "without"} strict mode`, () => {- it("should display an SDK question", () => {+ it("should display an SDK question", { tags: "@prerelease" }, () => {mountSdkContent(<InteractiveQuestion questionId={ORDERS_QUESTION_ID} />,{ strictMode },diff --git a/e2e/test/scenarios/embedding/sdk-iframe-embedding/guest-embed.cy.spec.ts b/e2e/test/scenarios/embedding/sdk-iframe-embedding/guest-embed.cy.spec.tsindex 85633e9e51a..1a602a82c65 100644--- a/e2e/test/scenarios/embedding/sdk-iframe-embedding/guest-embed.cy.spec.ts+++ b/e2e/test/scenarios/embedding/sdk-iframe-embedding/guest-embed.cy.spec.ts@@ -25,62 +25,66 @@ function guestEmbedSuite() {});});- it("shows an error for a component without guest embed support, and shows and downloads a static question", () => {- cy.log("component without guest embed support shows an error");- H.loadSdkIframeEmbedTestPage({- metabaseConfig: { isGuest: true },- elements: [- {- component: "metabase-browser",- attributes: {},- },- ],- }).within(() => {- cy.findByText("This component does not support guest embeds").should(- "be.visible",- );- });-- cy.log("static question shows and downloads as CSV");- cy.get("@questionId").then(async (questionId) => {- const token = await getSignedJwtForResource({- // Unjustified type cast. FIXME- resourceId: questionId as unknown as number,- resourceType: "question",- });-- const frame = H.loadSdkIframeEmbedTestPage({+ it(+ "shows an error for a component without guest embed support, and shows and downloads a static question",+ { tags: "@prerelease" },+ () => {+ cy.log("component without guest embed support shows an error");+ H.loadSdkIframeEmbedTestPage({metabaseConfig: { isGuest: true },elements: [{- component: "metabase-question",- attributes: {- token,- "with-downloads": true,- },+ component: "metabase-browser",+ attributes: {},},],+ }).within(() => {+ cy.findByText("This component does not support guest embeds").should(+ "be.visible",+ );});- cy.wait("@getCardQuery");+ cy.log("static question shows and downloads as CSV");+ cy.get("@questionId").then(async (questionId) => {+ const token = await getSignedJwtForResource({+ // Unjustified type cast. FIXME+ resourceId: questionId as unknown as number,+ resourceType: "question",+ });++ const frame = H.loadSdkIframeEmbedTestPage({+ metabaseConfig: { isGuest: true },+ elements: [+ {+ component: "metabase-question",+ attributes: {+ token,+ "with-downloads": true,+ },+ },+ ],+ });++ cy.wait("@getCardQuery");- frame.within(() => {- cy.findByText("Product ID").should("be.visible");- cy.findByText("Max of Quantity").should("be.visible");+ frame.within(() => {+ cy.findByText("Product ID").should("be.visible");+ cy.findByText("Max of Quantity").should("be.visible");- H.downloadAndAssert({- isDashboard: false,- isEmbed: true,- enableFormatting: true,- assertStatusCode: 200,- waitForDismiss: false,- fileType: "csv",- downloadUrl: "/api/embed/card/*/query/csv*",- downloadMethod: "GET",+ H.downloadAndAssert({+ isDashboard: false,+ isEmbed: true,+ enableFormatting: true,+ assertStatusCode: 200,+ waitForDismiss: false,+ fileType: "csv",+ downloadUrl: "/api/embed/card/*/query/csv*",+ downloadMethod: "GET",+ });});});- });- });+ },+ );}describe(diff --git a/e2e/test/scenarios/embedding/sdk-iframe-embedding/sdk-iframe-embedding.cy.spec.ts b/e2e/test/scenarios/embedding/sdk-iframe-embedding/sdk-iframe-embedding.cy.spec.tsindex 7423864809b..e1036115bcd 100644--- a/e2e/test/scenarios/embedding/sdk-iframe-embedding/sdk-iframe-embedding.cy.spec.ts+++ b/e2e/test/scenarios/embedding/sdk-iframe-embedding/sdk-iframe-embedding.cy.spec.ts@@ -15,7 +15,7 @@ describe("scenarios > embedding > modular embedding", () => {H.prepareSdkIframeEmbedTest();});- it("can find the embed.js file", () => {+ it("can find the embed.js file", { tags: ["@prerelease", "@EE"] }, () => {cy.request("http://localhost:4000/app/embed.js").then((response) => {expect(response.status).to.eq(200);expect(response.body).to.be.a("string").and.not.be.empty;@@ -99,24 +99,28 @@ describe("scenarios > embedding > modular embedding", () => {});});- it("displays a question using entity id", () => {- const frame = H.loadSdkIframeEmbedTestPage({- elements: [- {- component: "metabase-question",- attributes: {- questionId: ORDERS_QUESTION_ENTITY_ID,+ it(+ "displays a question using entity id",+ { tags: ["@prerelease", "@EE"] },+ () => {+ const frame = H.loadSdkIframeEmbedTestPage({+ elements: [+ {+ component: "metabase-question",+ attributes: {+ questionId: ORDERS_QUESTION_ENTITY_ID,+ },},- },- ],- });+ ],+ });- cy.wait("@getCardQuery");+ cy.wait("@getCardQuery");- frame.within(() => {- H.assertSdkInteractiveQuestionOrdersUsable();- });- });+ frame.within(() => {+ H.assertSdkInteractiveQuestionOrdersUsable();+ });+ },+ );it("displays the exploration template", () => {const frame = H.loadSdkIframeEmbedTestPage({