Skip to content

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

E2E setup follow up (#66588)

Nemanja Glumac3f8c3b946ae7
diff --git a/e2e/runner/cypress-runner-backend.js b/e2e/runner/cypress-runner-backend.js
index 5a3f0aeb015..067c105416c 100755
--- a/e2e/runner/cypress-runner-backend.js
+++ b/e2e/runner/cypress-runner-backend.js
@@ -18,7 +18,7 @@ function getJvmOptsFromDepsEdn(alias = "e2e") {
process.env.MB_DB_FILE = process.env.MB_DB_FILE || tempDbPath;
process.env.MB_JETTY_PORT = process.env.MB_JETTY_PORT || 4000;
-if (!process.CI) {
+if (!process.env.CI) {
// Use a temporary copy of the sample db so it won't use and lock the db used for local development
process.env.MB_INTERNAL_DO_NOT_USE_SAMPLE_DB_DIR = path.resolve(
__dirname,
@@ -85,9 +85,10 @@ const CypressBackend = {
},
};
-const isBackendRunning = shell(
- `lsof -ti:${process.env.MB_JETTY_PORT} || echo ""`,
- { quiet: true },
-);
+function getBackendPid() {
+ return shell(`lsof -ti:${process.env.MB_JETTY_PORT} || echo ""`, {
+ quiet: true,
+ });
+}
-module.exports = { ...CypressBackend, isBackendRunning };
+module.exports = { ...CypressBackend, getBackendPid };
diff --git a/e2e/runner/run_cypress_local.ts b/e2e/runner/run_cypress_local.ts
index 8da1bc1c114..5b5f1cf23a5 100644
--- a/e2e/runner/run_cypress_local.ts
+++ b/e2e/runner/run_cypress_local.ts
@@ -46,7 +46,8 @@ const init = async () => {
const cliArguments = process.argv.slice(2);
const userOverrides = await parseArguments(cliArguments);
- const { isBackendRunning } = CypressBackend;
+ const backendPid = CypressBackend.getBackendPid();
+ const isBackendRunning = !!backendPid;
const runningFromJar = !!options.JAR_PATH;
@@ -58,7 +59,7 @@ const init = async () => {
printBold("⚠️ Your backend is already running");
console.log(`You wanted to test against a pre-built Metabase JAR:
- It will spin up both the backend and the frontend for you
- - Kill the backend pid ${isBackendRunning} and run the script again
+ - Kill the backend pid ${backendPid} and run the script again
- Alternatively, use a different MB_JETTY_PORT in this shell and try again
`);
@@ -71,7 +72,7 @@ const init = async () => {
if (isBackendRunning) {
printBold("⚠️ Your backend is already running");
console.log(`If tests fail or if something doesn't work:
- - Kill the pid ${isBackendRunning}
+ - Kill the pid ${backendPid}
- Run *yarn test-cypress* again
- This will spin up the live backend with the correct settings for e2e tests
`);