|
| 1 | +import path from "path" |
| 2 | +import { fileURLToPath } from "url" |
| 3 | + |
| 4 | +import { defineConfig } from "@playwright/experimental-ct-react" |
| 5 | +import react from "@vitejs/plugin-react" |
| 6 | +import tailwindcss from "@tailwindcss/vite" |
| 7 | + |
| 8 | +const dirname = path.dirname(fileURLToPath(import.meta.url)) |
| 9 | + |
| 10 | +export default defineConfig({ |
| 11 | + testDir: "./src", |
| 12 | + testMatch: "**/*.visual.tsx", |
| 13 | + outputDir: process.env.CI ? path.resolve(dirname, "test-results") : "/tmp/webview-ui-playwright-test-results", |
| 14 | + snapshotPathTemplate: "{testDir}/{testFileDir}/__screenshots__/{arg}{ext}", |
| 15 | + fullyParallel: true, |
| 16 | + reporter: process.env.CI |
| 17 | + ? [["html", { open: "never", outputFolder: path.resolve(dirname, "playwright-report") }], ["github"], ["list"]] |
| 18 | + : [["html", { open: "never", outputFolder: "/tmp/webview-ui-playwright-report" }], ["list"]], |
| 19 | + use: { |
| 20 | + ctTemplateDir: "./playwright", |
| 21 | + ctViteConfig: { |
| 22 | + plugins: [ |
| 23 | + react({ |
| 24 | + babel: { |
| 25 | + plugins: [["babel-plugin-react-compiler", { target: "18" }]], |
| 26 | + }, |
| 27 | + }), |
| 28 | + tailwindcss(), |
| 29 | + ], |
| 30 | + resolve: { |
| 31 | + alias: { |
| 32 | + "@": path.resolve(dirname, "./src"), |
| 33 | + "@src": path.resolve(dirname, "./src"), |
| 34 | + "@roo": path.resolve(dirname, "../src/shared"), |
| 35 | + vscode: path.resolve(dirname, "./src/__mocks__/vscode.ts"), |
| 36 | + }, |
| 37 | + }, |
| 38 | + define: { |
| 39 | + "process.platform": JSON.stringify(process.platform), |
| 40 | + "process.env.NODE_ENV": JSON.stringify(process.env.NODE_ENV ?? "test"), |
| 41 | + "process.env.PKG_NAME": JSON.stringify("zoo-code"), |
| 42 | + "process.env.PKG_VERSION": JSON.stringify("0.0.0-test"), |
| 43 | + "process.env.PKG_OUTPUT_CHANNEL": JSON.stringify("Zoo-Code"), |
| 44 | + "process.env.PKG_RELEASE_CHANNEL": JSON.stringify("stable"), |
| 45 | + }, |
| 46 | + optimizeDeps: { |
| 47 | + exclude: ["@vscode/codicons"], |
| 48 | + }, |
| 49 | + }, |
| 50 | + viewport: { width: 520, height: 360 }, |
| 51 | + deviceScaleFactor: 1, |
| 52 | + colorScheme: "dark", |
| 53 | + }, |
| 54 | + expect: { |
| 55 | + toHaveScreenshot: { |
| 56 | + animations: "disabled", |
| 57 | + }, |
| 58 | + }, |
| 59 | + projects: [ |
| 60 | + { |
| 61 | + name: "chromium", |
| 62 | + use: { browserName: "chromium" }, |
| 63 | + }, |
| 64 | + ], |
| 65 | +}) |
0 commit comments