chore(e2e): update execSync command to use 'docker compose' format

This commit is contained in:
sumit_chaturvedi
2025-06-25 11:04:08 +05:30
parent 6080343eaf
commit 6c3ceda58a
4 changed files with 30 additions and 16 deletions
+14
View File
@@ -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",
+2 -1
View File
@@ -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"
}
}
+13 -7
View File
@@ -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
},
});
+1 -8
View File
@@ -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' });
});
}