From 6c3ceda58a73334b519af5c5e8dba756af3986bf Mon Sep 17 00:00:00 2001 From: sumit_chaturvedi Date: Wed, 25 Jun 2025 11:04:08 +0530 Subject: [PATCH] chore(e2e): update execSync command to use 'docker compose' format --- ui/package-lock.json | 14 ++++++++++++++ ui/package.json | 3 ++- ui/playwright.config.ts | 20 +++++++++++++------- ui/tests/e2e/global-setup.ts | 9 +-------- 4 files changed, 30 insertions(+), 16 deletions(-) diff --git a/ui/package-lock.json b/ui/package-lock.json index b6885ee7fe..9cca3b13b5 100644 --- a/ui/package-lock.json +++ b/ui/package-lock.json @@ -71,6 +71,7 @@ "@typescript-eslint/eslint-plugin": "^7.10.0", "@typescript-eslint/parser": "^7.10.0", "autoprefixer": "10.4.19", + "dotenv": "^16.5.0", "eslint": "^8.56.0", "eslint-config-next": "^14.2.23", "eslint-config-prettier": "^10.0.1", @@ -10096,6 +10097,19 @@ "csstype": "^3.0.2" } }, + "node_modules/dotenv": { + "version": "16.5.0", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.5.0.tgz", + "integrity": "sha512-m/C+AwOAr9/W1UOIZUo232ejMNnJAJtYQjUbHoNTBNTJSvqzzDh7vnrei3o3r3m9blf6ZoDkvcw0VmozNRFJxg==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://dotenvx.com" + } + }, "node_modules/dunder-proto": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", diff --git a/ui/package.json b/ui/package.json index 24235cfbfa..730745923d 100644 --- a/ui/package.json +++ b/ui/package.json @@ -63,6 +63,7 @@ "@typescript-eslint/eslint-plugin": "^7.10.0", "@typescript-eslint/parser": "^7.10.0", "autoprefixer": "10.4.19", + "dotenv": "^16.5.0", "eslint": "^8.56.0", "eslint-config-next": "^14.2.23", "eslint-config-prettier": "^10.0.1", @@ -104,4 +105,4 @@ "@react-types/shared": "3.26.0" }, "version": "0.0.1" -} \ No newline at end of file +} diff --git a/ui/playwright.config.ts b/ui/playwright.config.ts index 22e5ed59c4..abaf3b117c 100644 --- a/ui/playwright.config.ts +++ b/ui/playwright.config.ts @@ -1,4 +1,6 @@ import { defineConfig, devices } from "@playwright/test"; +import * as dotenv from "dotenv"; +dotenv.config(); const isLocal = process.env.LOCAL === "true"; @@ -10,7 +12,9 @@ export default defineConfig({ retries: isLocal ? 0 : 2, workers: isLocal ? undefined : 1, reporter: "html", - globalSetup: require.resolve("./tests/e2e/global-setup"), + globalSetup: isLocal + ? undefined + : require.resolve("./tests/e2e/global-setup"), use: { baseURL: "http://localhost:3000", trace: "on-first-retry", @@ -57,10 +61,12 @@ export default defineConfig({ ], /* Run your local dev server before starting the tests */ - webServer: { - command: "npm run dev", - url: "http://localhost:3000", - reuseExistingServer: !isLocal, - timeout: 300 * 1000, // 5 minute - }, + webServer: isLocal + ? undefined // Skip web server in local runs + : { + command: "npm run dev", + url: "http://localhost:3000", + reuseExistingServer: true, + timeout: 300 * 1000, // 5 minute + }, }); diff --git a/ui/tests/e2e/global-setup.ts b/ui/tests/e2e/global-setup.ts index 429e3a05c7..6a1c576741 100644 --- a/ui/tests/e2e/global-setup.ts +++ b/ui/tests/e2e/global-setup.ts @@ -2,13 +2,6 @@ import { FullConfig } from '@playwright/test'; import { execSync } from 'child_process'; async function globalSetup(config: FullConfig) { - const isLocal = process.env.LOCAL === 'true'; - - if (isLocal) { - console.log('LOCAL=true detected — skipping Docker startup.'); - return; - } - // Start Docker containers (for CI or non-local runs) console.log('Starting Docker containers...'); execSync( @@ -23,7 +16,7 @@ async function globalSetup(config: FullConfig) { // Register cleanup function process.on('exit', () => { console.log('Cleaning up containers...'); - execSync('docker-compose -f ../docker-compose-dev.yml down', { stdio: 'inherit' }); + execSync('docker compose -f ../docker-compose-dev.yml down', { stdio: 'inherit' }); }); }