import { defineConfig, devices } from "@playwright/test"; // 本机 http_proxy 会把 localhost 探活/请求也带进代理(502),E2E 内网请求必须直连 for (const key of [ "http_proxy", "https_proxy", "HTTP_PROXY", "HTTPS_PROXY", "all_proxy", "ALL_PROXY", ]) { delete process.env[key]; } process.env.NO_PROXY = "*"; export default defineConfig({ testDir: "./e2e", fullyParallel: true, forbidOnly: !!process.env.CI, retries: process.env.CI ? 2 : 0, reporter: [["list"]], use: { baseURL: "http://localhost:4321", trace: "on-first-retry", locale: "en-US", acceptLanguage: "en-US", }, projects: [ { name: "chromium", use: { ...devices["Desktop Chrome"] }, }, ], webServer: { command: "yarn dev:web", url: "http://localhost:4321", reuseExistingServer: !process.env.CI, timeout: 300_000, }, });