Skip to content

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

Have a dedicated runner for SDK host/sample apps (#66378)

Nemanja Glumacb7ff644e7873
diff --git a/e2e/runner/embedding-sdk/sample-apps/start-sample-app-containers.ts b/e2e/runner/embedding-sdk/sample-apps/start-sample-app-containers.ts
index 8c3c70243a6..1c88c010e01 100644
--- a/e2e/runner/embedding-sdk/sample-apps/start-sample-app-containers.ts
+++ b/e2e/runner/embedding-sdk/sample-apps/start-sample-app-containers.ts
@@ -19,7 +19,7 @@ const userOptions = {
...process.env,
} as const;
-printBold(`Running Cypress Sample App Tests with options:
+printBold(`Setting up the Sample App environment with options:
- EMBEDDING_SDK_VERSION : ${userOptions.EMBEDDING_SDK_VERSION}
- SAMPLE_APP_BRANCH_NAME : ${userOptions.SAMPLE_APP_BRANCH_NAME}
`);
diff --git a/e2e/runner/run_cypress_host_sample_apps.ts b/e2e/runner/run_cypress_host_sample_apps.ts
new file mode 100644
index 00000000000..de05a4b5bc7
--- /dev/null
+++ b/e2e/runner/run_cypress_host_sample_apps.ts
@@ -0,0 +1,46 @@
+import { FAILURE_EXIT_CODE, SUCCESS_EXIT_CODE } from "./constants/exit-code";
+import runCypress from "./cypress-node-js-runner";
+import { booleanify, printBold } from "./cypress-runner-utils";
+import { startHostAppContainers } from "./embedding-sdk/host-apps/start-host-app-containers";
+import { startSampleAppContainers } from "./embedding-sdk/sample-apps/start-sample-app-containers";
+import { resolveSdkE2EConfig } from "./resolve-sdk-e2e-config";
+
+// if you want to change these, set them as environment variables in your shell
+const options = {
+ SDK_TEST_SUITE: "vite-6-host-app-e2e", // one of the many sample-app, or host-app Embedding SDK suites
+ OPEN_UI: false,
+ ...booleanify(process.env),
+};
+
+printBold(`Running Cypress with options:
+ - SDK_TEST_SUITE : ${options.SDK_TEST_SUITE}
+ - OPEN_UI : ${options.OPEN_UI}
+`);
+
+const init = async () => {
+ switch (options.SDK_TEST_SUITE) {
+ case "metabase-nodejs-react-sdk-embedding-sample-e2e":
+ case "metabase-nextjs-sdk-embedding-sample-e2e":
+ case "shoppy-e2e":
+ await startSampleAppContainers(options.SDK_TEST_SUITE);
+ break;
+
+ case "vite-6-host-app-e2e":
+ case "next-15-app-router-host-app-e2e":
+ case "next-15-pages-router-host-app-e2e":
+ case "angular-20-host-app-e2e":
+ await startHostAppContainers(options.SDK_TEST_SUITE);
+ break;
+ }
+
+ printBold("⏳ Starting Sample/Host App Cypress Tests");
+ const config = resolveSdkE2EConfig(options.SDK_TEST_SUITE);
+ await runCypress(config);
+};
+
+init()
+ .then(() => process.exit(SUCCESS_EXIT_CODE))
+ .catch((e) => {
+ console.error(e);
+ process.exit(FAILURE_EXIT_CODE);
+ });
diff --git a/e2e/runner/run_cypress_local.ts b/e2e/runner/run_cypress_local.ts
index 7d404da3fd5..e3d6b120df8 100644
--- a/e2e/runner/run_cypress_local.ts
+++ b/e2e/runner/run_cypress_local.ts
@@ -13,16 +13,12 @@ import {
shell,
unBooleanify,
} from "./cypress-runner-utils";
-import { startHostAppContainers } from "./embedding-sdk/host-apps/start-host-app-containers";
-import { startSampleAppContainers } from "./embedding-sdk/sample-apps/start-sample-app-containers";
-import { resolveSdkE2EConfig } from "./resolve-sdk-e2e-config";
let tempSampleDBDir: string | null = null;
// if you want to change these, set them as environment variables in your shell
const userOptions = {
CYPRESS_TESTING_TYPE: "e2e", // e2e | component
- SDK_TEST_SUITE: undefined, // one of the many sample-app, or host-app Embedding SDK suites
MB_EDITION: "ee", // ee | oss
START_CONTAINERS: true,
STOP_CONTAINERS: false,
@@ -66,7 +62,6 @@ if (options.MB_EDITION === "ee" && missingTokens.length > 0) {
printBold(`Running Cypress with options:
- CYPRESS_TESTING_TYPE : ${options.CYPRESS_TESTING_TYPE}
- - SDK_TEST_SUITE : ${options.SDK_TEST_SUITE}
- MB_EDITION : ${options.MB_EDITION}
- START_CONTAINERS : ${options.START_CONTAINERS}
- STOP_CONTAINERS : ${options.STOP_CONTAINERS}
@@ -145,27 +140,6 @@ const init = async () => {
);
}
- if (options.SDK_TEST_SUITE) {
- switch (options.SDK_TEST_SUITE) {
- case "metabase-nodejs-react-sdk-embedding-sample-e2e":
- case "metabase-nextjs-sdk-embedding-sample-e2e":
- case "shoppy-e2e":
- await startSampleAppContainers(options.SDK_TEST_SUITE);
- break;
-
- case "vite-6-host-app-e2e":
- case "next-15-app-router-host-app-e2e":
- case "next-15-pages-router-host-app-e2e":
- case "angular-20-host-app-e2e":
- await startHostAppContainers(options.SDK_TEST_SUITE);
- break;
- }
-
- printBold("⏳ Starting Sample/Host App Cypress Tests");
- const config = resolveSdkE2EConfig(options.SDK_TEST_SUITE);
- await runCypress(config);
- }
-
if (options.CYPRESS_TESTING_TYPE === "component") {
printBold("⏳ Starting Cypress SDK component tests");
await runCypress({
diff --git a/enterprise/frontend/src/embedding-sdk-package/dev.md b/enterprise/frontend/src/embedding-sdk-package/dev.md
index cb2a31010c3..dd3d33937ba 100644
--- a/enterprise/frontend/src/embedding-sdk-package/dev.md
+++ b/enterprise/frontend/src/embedding-sdk-package/dev.md
@@ -78,13 +78,13 @@ Define one of the following environment variables with enterprise token: `CYPRES
To run these tests locally, run:
```
-SDK_TEST_SUITE=<sample_app_repo_name>-e2e OPEN_UI=false EMBEDDING_SDK_VERSION=local START_METABASE=false GENERATE_SNAPSHOTS=false START_CONTAINERS=false yarn test-cypress
+SDK_TEST_SUITE=<sample_app_repo_name>-e2e yarn test-cypress-host-sample-apps
```
For example for the `metabase-nodejs-react-sdk-embedding-sample`, run:
```
-SDK_TEST_SUITE=metabase-nodejs-react-sdk-embedding-sample-e2e OPEN_UI=false EMBEDDING_SDK_VERSION=local START_METABASE=false GENERATE_SNAPSHOTS=false START_CONTAINERS=false yarn test-cypress
+SDK_TEST_SUITE=metabase-nodejs-react-sdk-embedding-sample-e2e yarn test-cypress-host-sample-apps
```
##### :warning: Obtaining the Shoppy's Metabase App DB Dump locally
@@ -130,13 +130,13 @@ Tests a bit similar to Sample App tests, but:
To run these tests locally, run:
```
-ENTERPRISE_TOKEN=<token> SDK_TEST_SUITE=<host_app_name>-e2e OPEN_UI=false EMBEDDING_SDK_VERSION=local HOST_APP_ENVIRONMENT=production yarn test-cypress
+ENTERPRISE_TOKEN=<token> SDK_TEST_SUITE=<host_app_name>-e2e HOST_APP_ENVIRONMENT=production yarn test-cypress-host-sample-apps
```
For example for the `vite-6-host-app` Host App, run:
```
-ENTERPRISE_TOKEN=<token> SDK_TEST_SUITE=vite-6-host-app-e2e OPEN_UI=false EMBEDDING_SDK_VERSION=local HOST_APP_ENVIRONMENT=production yarn test-cypress
+ENTERPRISE_TOKEN=<token> SDK_TEST_SUITE=vite-6-host-app-e2e HOST_APP_ENVIRONMENT=production yarn test-cypress-host-sample-apps
```
#### CI runs
diff --git a/package.json b/package.json
index 4dabb4c5862..99406ac8b97 100644
--- a/package.json
+++ b/package.json
@@ -467,6 +467,7 @@
"test": "yarn test-unit && yarn test-timezones && yarn test-cypress",
"test-cljs": "yarn && shadow-cljs compile test && node target/node-tests.js",
"test-cypress": "tsx ./e2e/runner/run_cypress_local.ts",
+ "test-cypress-host-sample-apps": "tsx ./e2e/runner/run_cypress_host_sample_apps.ts",
"test-debug": "yarn build:cljs && node --inspect-brk node_modules/.bin/jest --runInBand --detectOpenHandles",
"test-timezones": "yarn && ./frontend/test/__runner__/run_timezone_tests",
"test-timezones-unit": "yarn build:cljs && jest --silent --maxWorkers=4 --config jest.tz.unit.conf.js",