mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-01-31 06:42:03 +00:00
The vite-plugin-electron was trying to spawn Electron during the Vite dev server startup, which fails in CI because there's no X11 display. - Use Vite's function config to check command type (serve vs build) - Only skip electron plugin during dev server (command=serve) in CI - Always include electron plugin during build for dist-electron/main.js - Add VITE_SKIP_ELECTRON env var support for explicit control - Update playwright.config.ts to pass VITE_SKIP_ELECTRON in CI 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
62 lines
1.9 KiB
TypeScript
62 lines
1.9 KiB
TypeScript
import { defineConfig, devices } from "@playwright/test";
|
|
|
|
const port = process.env.TEST_PORT || 5173;
|
|
const serverPort = process.env.TEST_SERVER_PORT || 3008;
|
|
const reuseServer = process.env.TEST_REUSE_SERVER === "true";
|
|
const mockAgent = process.env.CI === "true" || process.env.AUTOMAKER_MOCK_AGENT === "true";
|
|
|
|
export default defineConfig({
|
|
testDir: "./tests",
|
|
fullyParallel: true,
|
|
forbidOnly: !!process.env.CI,
|
|
retries: process.env.CI ? 2 : 0,
|
|
workers: process.env.CI ? 1 : undefined,
|
|
reporter: "html",
|
|
timeout: 30000,
|
|
use: {
|
|
baseURL: `http://localhost:${port}`,
|
|
trace: "on-first-retry",
|
|
screenshot: "only-on-failure",
|
|
},
|
|
projects: [
|
|
{
|
|
name: "chromium",
|
|
use: { ...devices["Desktop Chrome"] },
|
|
},
|
|
],
|
|
...(reuseServer
|
|
? {}
|
|
: {
|
|
webServer: [
|
|
// Backend server - runs with mock agent enabled in CI
|
|
{
|
|
command: `cd ../server && npm run dev`,
|
|
url: `http://localhost:${serverPort}/api/health`,
|
|
reuseExistingServer: true,
|
|
timeout: 60000,
|
|
env: {
|
|
...process.env,
|
|
PORT: String(serverPort),
|
|
// Enable mock agent in CI to avoid real API calls
|
|
AUTOMAKER_MOCK_AGENT: mockAgent ? "true" : "false",
|
|
// Allow access to test directories and common project paths
|
|
ALLOWED_PROJECT_DIRS: "/Users,/home,/tmp,/var/folders",
|
|
},
|
|
},
|
|
// Frontend Vite dev server
|
|
{
|
|
command: `npm run dev`,
|
|
url: `http://localhost:${port}`,
|
|
reuseExistingServer: true,
|
|
timeout: 120000,
|
|
env: {
|
|
...process.env,
|
|
VITE_SKIP_SETUP: "true",
|
|
// Skip electron plugin in CI - no display available for Electron
|
|
VITE_SKIP_ELECTRON: process.env.CI === "true" ? "true" : undefined,
|
|
},
|
|
},
|
|
],
|
|
}),
|
|
});
|