mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-01-30 06:12:03 +00:00
This commit refactors the handling of ALLOWED_ROOT_DIRECTORY by removing legacy support for ALLOWED_PROJECT_DIRS and simplifying the security logic. Key changes include: - Removed deprecated ALLOWED_PROJECT_DIRS references from .env.example and security.ts. - Updated initAllowedPaths() to focus solely on ALLOWED_ROOT_DIRECTORY and DATA_DIR. - Enhanced logging for ALLOWED_ROOT_DIRECTORY configuration status. - Adjusted route handlers to utilize the new workspace directory logic. - Introduced a centralized storage module for localStorage operations to improve consistency and error handling. These changes aim to enhance security and maintainability by consolidating directory management into a single variable. Tests: All unit tests passing.
63 lines
1.9 KiB
TypeScript
63 lines
1.9 KiB
TypeScript
import { defineConfig, devices } from "@playwright/test";
|
|
|
|
const port = process.env.TEST_PORT || 3007;
|
|
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: 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",
|
|
// No ALLOWED_ROOT_DIRECTORY restriction - allow all paths for testing
|
|
},
|
|
},
|
|
// 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,
|
|
},
|
|
},
|
|
],
|
|
}),
|
|
});
|