diff --git a/adminfront/playwright.config.ts b/adminfront/playwright.config.ts index ad5ce1f3..e2b56df4 100644 --- a/adminfront/playwright.config.ts +++ b/adminfront/playwright.config.ts @@ -85,9 +85,9 @@ export default defineConfig({ ? undefined : { command: process.env.CI - ? `pnpm run preview -- --port ${port}` - : `pnpm run dev -- --host localhost --port ${port}`, - url: `http://localhost:${port}`, + ? `pnpm exec vite preview --host 127.0.0.1 --port ${port} --strictPort` + : `pnpm exec vite --host 127.0.0.1 --port ${port} --strictPort`, + url: `http://127.0.0.1:${port}`, reuseExistingServer, timeout: 180 * 1000, }, diff --git a/adminfront/vite.config.ts b/adminfront/vite.config.ts index c20bcf0e..f9f2f264 100644 --- a/adminfront/vite.config.ts +++ b/adminfront/vite.config.ts @@ -24,4 +24,13 @@ export default defineConfig({ }, }, }, + preview: { + host: "127.0.0.1", + proxy: { + "/api": { + target: process.env.API_PROXY_TARGET || "http://localhost:3000", + changeOrigin: true, + }, + }, + }, }); diff --git a/scripts/run_adminfront_ci_tests.sh b/scripts/run_adminfront_ci_tests.sh index 4b752885..81511c94 100755 --- a/scripts/run_adminfront_ci_tests.sh +++ b/scripts/run_adminfront_ci_tests.sh @@ -295,7 +295,7 @@ fi echo "==> adminfront using PORT=$port" ( cd "$tmp_dir/adminfront" - PORT="$port" PLAYWRIGHT_WORKERS="${PLAYWRIGHT_WORKERS:-1}" \ + CI=true PORT="$port" PLAYWRIGHT_WORKERS="${PLAYWRIGHT_WORKERS:-1}" \ pnpm exec playwright test "${playwright_project_args[@]}" ) 2>&1 | tee reports/adminfront-test.log test_exit_code=${PIPESTATUS[0]}