mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-03-17 10:03:08 +00:00
* Changes from fix/memory-and-context-mobile-friendly * fix: Improve file extension detection and add path traversal protection * refactor: Extract file extension utilities and add path traversal guards Code review improvements: - Extract isMarkdownFilename and isImageFilename to shared image-utils.ts - Remove duplicated code from context-view.tsx and memory-view.tsx - Add path traversal guard for context fixture utilities (matching memory) - Add 7 new tests for context fixture path traversal protection - Total 61 tests pass Addresses code review feedback from PR #813 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * test: Add e2e tests for profiles crud and board background persistence * Update apps/ui/playwright.config.ts Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * fix: Add robust test navigation handling and file filtering * fix: Format NODE_OPTIONS configuration on single line * test: Update profiles and board background persistence tests * test: Replace iPhone 13 Pro with Pixel 5 for mobile test consistency --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
89 lines
3.5 KiB
TypeScript
89 lines
3.5 KiB
TypeScript
import { defineConfig, devices } from '@playwright/test';
|
|
|
|
const port = process.env.TEST_PORT || 3107;
|
|
const serverPort = process.env.TEST_SERVER_PORT || 3108;
|
|
const reuseServer = process.env.TEST_REUSE_SERVER === 'true';
|
|
const useExternalBackend = !!process.env.VITE_SERVER_URL;
|
|
// Always use mock agent for tests (disables rate limiting, uses mock Claude responses)
|
|
const mockAgent = true;
|
|
|
|
export default defineConfig({
|
|
testDir: './tests',
|
|
fullyParallel: true,
|
|
forbidOnly: !!process.env.CI,
|
|
retries: 0,
|
|
workers: 1, // Run sequentially to avoid auth conflicts with shared server
|
|
reporter: 'html',
|
|
timeout: 30000,
|
|
use: {
|
|
baseURL: `http://localhost:${port}`,
|
|
trace: 'on-failure',
|
|
screenshot: 'only-on-failure',
|
|
serviceWorkers: 'block',
|
|
},
|
|
// Global setup - authenticate before each test
|
|
globalSetup: require.resolve('./tests/global-setup.ts'),
|
|
projects: [
|
|
{
|
|
name: 'chromium',
|
|
use: { ...devices['Desktop Chrome'] },
|
|
},
|
|
],
|
|
...(reuseServer
|
|
? {}
|
|
: {
|
|
webServer: [
|
|
// Backend server - runs with mock agent enabled in CI
|
|
// Uses dev:test (no file watching) to avoid port conflicts from server restarts
|
|
...(useExternalBackend
|
|
? []
|
|
: [
|
|
{
|
|
command: `cd ../server && npm run dev:test`,
|
|
url: `http://localhost:${serverPort}/api/health`,
|
|
// Don't reuse existing server to ensure we use the test API key
|
|
reuseExistingServer: false,
|
|
timeout: 60000,
|
|
env: {
|
|
...process.env,
|
|
PORT: String(serverPort),
|
|
// Enable mock agent in CI to avoid real API calls
|
|
AUTOMAKER_MOCK_AGENT: mockAgent ? 'true' : 'false',
|
|
// Set a test API key for web mode authentication
|
|
AUTOMAKER_API_KEY:
|
|
process.env.AUTOMAKER_API_KEY || 'test-api-key-for-e2e-tests',
|
|
// Hide the API key banner to reduce log noise
|
|
AUTOMAKER_HIDE_API_KEY: 'true',
|
|
// Explicitly unset ALLOWED_ROOT_DIRECTORY to allow all paths for testing
|
|
// (prevents inheriting /projects from Docker or other environments)
|
|
ALLOWED_ROOT_DIRECTORY: '',
|
|
// Simulate containerized environment to skip sandbox confirmation dialogs
|
|
IS_CONTAINERIZED: 'true',
|
|
// Increase Node.js memory limit to prevent OOM during tests
|
|
NODE_OPTIONS: [process.env.NODE_OPTIONS, '--max-old-space-size=4096']
|
|
.filter(Boolean)
|
|
.join(' '),
|
|
},
|
|
},
|
|
]),
|
|
// Frontend Vite dev server
|
|
{
|
|
command: `npm run dev`,
|
|
url: `http://localhost:${port}`,
|
|
reuseExistingServer: false,
|
|
timeout: 120000,
|
|
env: {
|
|
...process.env,
|
|
// Must set AUTOMAKER_WEB_PORT to match the port Playwright waits for
|
|
AUTOMAKER_WEB_PORT: String(port),
|
|
// Must set AUTOMAKER_SERVER_PORT so Vite proxy forwards to the correct backend port
|
|
AUTOMAKER_SERVER_PORT: String(serverPort),
|
|
VITE_SKIP_SETUP: 'true',
|
|
// Always skip electron plugin during tests - prevents duplicate server spawning
|
|
VITE_SKIP_ELECTRON: 'true',
|
|
},
|
|
},
|
|
],
|
|
}),
|
|
});
|