From 6669b186d74bcabf87b9c158e3cf7b6cd0ca1cfb Mon Sep 17 00:00:00 2001 From: Joe Li Date: Thu, 30 Apr 2026 19:27:47 -0700 Subject: [PATCH] ci(embedded-e2e): build SDK and configure test environment - Add a build-embedded-sdk step to bashlib.sh and wire it into the superset-playwright and superset-e2e workflows so the SDK bundle is compiled before Playwright runs. - Set SUPERSET_FEATURE_EMBEDDED_SUPERSET=true via workflow env so the feature flag only affects Playwright jobs. Setting it in the shared integration test config breaks unrelated Python tests because the security manager's guest-user paths access g.user through paths that most tests don't mock. - Add CORS for localhost:9000 and TALISMAN_ENABLED=False to the integration test config. Talisman defaults to X-Frame-Options: SAMEORIGIN, which blocks the embedded dashboard from rendering inside an iframe hosted on a different port. --- .github/workflows/bashlib.sh | 9 +++++++++ .github/workflows/superset-e2e.yml | 6 ++++++ .github/workflows/superset-playwright.yml | 6 ++++++ tests/integration_tests/superset_test_config.py | 10 ++++++++++ 4 files changed, 31 insertions(+) diff --git a/.github/workflows/bashlib.sh b/.github/workflows/bashlib.sh index 76f44d28f1b..39dacd216ed 100644 --- a/.github/workflows/bashlib.sh +++ b/.github/workflows/bashlib.sh @@ -59,6 +59,15 @@ build-assets() { say "::endgroup::" } +build-embedded-sdk() { + cd "$GITHUB_WORKSPACE/superset-embedded-sdk" + + say "::group::Build embedded SDK bundle for E2E tests" + npm ci + npm run build + say "::endgroup::" +} + build-instrumented-assets() { cd "$GITHUB_WORKSPACE/superset-frontend" diff --git a/.github/workflows/superset-e2e.yml b/.github/workflows/superset-e2e.yml index 43aea2833e3..c8fe616e7ec 100644 --- a/.github/workflows/superset-e2e.yml +++ b/.github/workflows/superset-e2e.yml @@ -169,6 +169,7 @@ jobs: PYTHONPATH: ${{ github.workspace }} REDIS_PORT: 16379 GITHUB_TOKEN: ${{ github.token }} + SUPERSET_FEATURE_EMBEDDED_SUPERSET: "true" services: postgres: image: postgres:17-alpine @@ -239,6 +240,11 @@ jobs: uses: ./.github/actions/cached-dependencies with: run: build-instrumented-assets + - name: Build embedded SDK + if: steps.check.outputs.python || steps.check.outputs.frontend + uses: ./.github/actions/cached-dependencies + with: + run: build-embedded-sdk - name: Install Playwright if: steps.check.outputs.python || steps.check.outputs.frontend uses: ./.github/actions/cached-dependencies diff --git a/.github/workflows/superset-playwright.yml b/.github/workflows/superset-playwright.yml index 915833fe3ce..0d0f9007275 100644 --- a/.github/workflows/superset-playwright.yml +++ b/.github/workflows/superset-playwright.yml @@ -43,6 +43,7 @@ jobs: PYTHONPATH: ${{ github.workspace }} REDIS_PORT: 16379 GITHUB_TOKEN: ${{ github.token }} + SUPERSET_FEATURE_EMBEDDED_SUPERSET: "true" services: postgres: image: postgres:17-alpine @@ -113,6 +114,11 @@ jobs: uses: ./.github/actions/cached-dependencies with: run: build-instrumented-assets + - name: Build embedded SDK + if: steps.check.outputs.python || steps.check.outputs.frontend + uses: ./.github/actions/cached-dependencies + with: + run: build-embedded-sdk - name: Install Playwright if: steps.check.outputs.python || steps.check.outputs.frontend uses: ./.github/actions/cached-dependencies diff --git a/tests/integration_tests/superset_test_config.py b/tests/integration_tests/superset_test_config.py index c16591ed375..bacc36d9fcb 100644 --- a/tests/integration_tests/superset_test_config.py +++ b/tests/integration_tests/superset_test_config.py @@ -78,6 +78,15 @@ FEATURE_FLAGS = { WEBDRIVER_BASEURL = "http://0.0.0.0:8081/" +# Enable CORS for embedded dashboard E2E tests (test app on port 9000) +ENABLE_CORS = True +CORS_OPTIONS: dict = { + "origins": [ + "http://localhost:9000", + ], + "supports_credentials": True, +} + def GET_FEATURE_FLAGS_FUNC(ff): # noqa: N802 ff_copy = copy(ff) @@ -86,6 +95,7 @@ def GET_FEATURE_FLAGS_FUNC(ff): # noqa: N802 TESTING = True +TALISMAN_ENABLED = False WTF_CSRF_ENABLED = False FAB_ROLES = {"TestRole": [["Security", "menu_access"], ["List Users", "menu_access"]]}