From e8d589d06ddc52c1f918c23e698cef77c34bf90d Mon Sep 17 00:00:00 2001 From: me Date: Wed, 6 May 2026 22:48:31 +0530 Subject: [PATCH] chore: update test webServer to use preview mode --- frontend/package.json | 136 +++++++++++++++++----------------- frontend/playwright.config.ts | 3 +- frontend/vite.config.ts | 5 ++ 3 files changed, 75 insertions(+), 69 deletions(-) diff --git a/frontend/package.json b/frontend/package.json index f2c0f19..5471727 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,70 +1,70 @@ { - "name": "frontend", - "private": true, - "version": "0.0.0", - "type": "module", - "scripts": { - "dev": "vite", - "build": "tsc -b & vite build", - "build:prod": "vite build --mode production", - "lint": "biome lint --write ./src", - "format": "biome format --write ./src", - "check": "biome check --write ./src", - "check-all": "biome check --write .", - "preview": "vite preview", - "test": "vitest run", - "test:watch": "vitest", - "test:coverage": "vitest run --coverage", - "test:e2e": "playwright test", - "test:e2e:ui": "playwright test --ui --ui-host=0.0.0.0 --ui-port=43008" - }, - "dependencies": { - "@fontsource-variable/jost": "^5.2.8", - "@fontsource-variable/playfair-display": "^5.2.8", - "@fontsource-variable/playwrite-hr-lijeva": "^5.2.7", - "@fontsource/architects-daughter": "^5.2.7", - "@fontsource/cutive-mono": "^5.2.8", - "@fontsource/kavivanar": "^5.2.8", - "@fontsource/knewave": "^5.2.7", - "@fontsource/redacted-script": "^5.2.8", - "@fontsource/space-mono": "^5.2.9", - "@hookform/resolvers": "^5.2.2", - "@phosphor-icons/react": "^2.1.10", - "@tailwindcss/vite": "^4.2.2", - "axios": "^1.15.0", - "daisyui": "^5.5.19", - "fabric": "^7.2.0", - "idb": "^8.0.3", - "lenis": "^1.3.23", - "motion": "^12.38.0", - "react": "^19.2.4", - "react-dom": "^19.2.4", - "react-hook-form": "^7.72.1", - "react-router-dom": "^7.14.0", - "tailwindcss": "^4.2.2", - "zod": "^4.3.6", - "zustand": "^5.0.12" - }, - "devDependencies": { - "@biomejs/biome": "^2.4.11", - "@playwright/test": "^1.59.1", - "@testing-library/jest-dom": "^6.9.1", - "@testing-library/react": "^16.3.2", - "@testing-library/user-event": "^14.6.1", - "@types/node": "^25.6.0", - "@types/react": "^19.2.14", - "@types/react-dom": "^19.2.3", - "@vitejs/plugin-basic-ssl": "^2.3.0", - "@vitejs/plugin-react": "^6.0.1", - "@vitest/coverage-v8": "^4.1.4", - "dotenv": "^17.4.2", - "fake-indexeddb": "^6.2.5", - "jsdom": "^29.0.2", - "msw": "^2.13.2", - "pino": "^10.3.1", - "pino-pretty": "^13.1.3", - "typescript": "~6.0.2", - "vite": "^8.0.4", - "vitest": "^4.1.4" - } + "name": "frontend", + "private": true, + "version": "0.0.0", + "type": "module", + "scripts": { + "dev": "vite", + "build": "tsc -b & vite build", + "build:prod": "vite build --mode production", + "lint": "biome lint --write ./src", + "format": "biome format --write ./src", + "check": "biome check --write ./src", + "check-all": "biome check --write .", + "preview": "vite preview", + "test": "vitest run", + "test:watch": "vitest", + "test:coverage": "vitest run --coverage", + "test:e2e": "playwright test", + "test:e2e:ui": "playwright test --ui --ui-host=0.0.0.0 --ui-port=43008" + }, + "dependencies": { + "@fontsource-variable/jost": "^5.2.8", + "@fontsource-variable/playfair-display": "^5.2.8", + "@fontsource-variable/playwrite-hr-lijeva": "^5.2.7", + "@fontsource/architects-daughter": "^5.2.7", + "@fontsource/cutive-mono": "^5.2.8", + "@fontsource/kavivanar": "^5.2.8", + "@fontsource/knewave": "^5.2.7", + "@fontsource/redacted-script": "^5.2.8", + "@fontsource/space-mono": "^5.2.9", + "@hookform/resolvers": "^5.2.2", + "@phosphor-icons/react": "^2.1.10", + "@tailwindcss/vite": "^4.2.2", + "axios": "^1.15.0", + "daisyui": "^5.5.19", + "fabric": "^7.2.0", + "idb": "^8.0.3", + "lenis": "^1.3.23", + "motion": "^12.38.0", + "react": "^19.2.4", + "react-dom": "^19.2.4", + "react-hook-form": "^7.72.1", + "react-router-dom": "^7.14.0", + "tailwindcss": "^4.2.2", + "zod": "^4.3.6", + "zustand": "^5.0.12" + }, + "devDependencies": { + "@biomejs/biome": "^2.4.11", + "@playwright/test": "^1.59.1", + "@testing-library/jest-dom": "^6.9.1", + "@testing-library/react": "^16.3.2", + "@testing-library/user-event": "^14.6.1", + "@types/node": "^25.6.0", + "@types/react": "^19.2.14", + "@types/react-dom": "^19.2.3", + "@vitejs/plugin-basic-ssl": "^2.3.0", + "@vitejs/plugin-react": "^6.0.1", + "@vitest/coverage-v8": "^4.1.4", + "dotenv": "^17.4.2", + "fake-indexeddb": "^6.2.5", + "jsdom": "^29.0.2", + "msw": "^2.13.2", + "pino": "^10.3.1", + "pino-pretty": "^13.1.3", + "typescript": "~6.0.2", + "vite": "^8.0.4", + "vitest": "^4.1.4" + } } diff --git a/frontend/playwright.config.ts b/frontend/playwright.config.ts index 8a81b4f..82e9662 100644 --- a/frontend/playwright.config.ts +++ b/frontend/playwright.config.ts @@ -60,7 +60,8 @@ export default defineConfig({ /* Run your local dev server before starting the tests */ webServer: { - command: "npm run dev -- --mode e2e", + // NOTE: using npm here for docker compat mainly + command: "npm run build -- --mode e2e && npm run preview -- --mode e2e", url: getBaseUrl( process.env.SSL_ENABLED === "true", process.env.FRONTEND_DOMAIN, diff --git a/frontend/vite.config.ts b/frontend/vite.config.ts index 0193b1d..e6cfa73 100644 --- a/frontend/vite.config.ts +++ b/frontend/vite.config.ts @@ -46,5 +46,10 @@ export default defineConfig(({ mode }) => { host: env.FRONTEND_DOMAIN, https: isSslEnabled ? sslCerts : undefined, }, + preview: { + port: Number(env.FRONTEND_PORT), + host: env.FRONTEND_DOMAIN, + https: isSslEnabled ? sslCerts : undefined, + }, }; });