Major changes: - Shift from "OpenFang desktop client" to "independent AI Agent desktop app" - Add decision principle: "Is this useful for ZCLAW? Does it affect ZCLAW?" - Simplify project structure and tech stack sections - Replace OpenClaw vs OpenFang comparison with unified backend approach - Consolidate troubleshooting from scattered sections into organized FAQ - Update Hands system documentation with 8 capabilities and status - Stream
121 lines
2.6 KiB
TypeScript
121 lines
2.6 KiB
TypeScript
import { defineConfig, devices } from '@playwright/test';
|
|
|
|
/**
|
|
* ZCLAW E2E 测试配置
|
|
*
|
|
* 支持三种测试类型:
|
|
* - functional: 基础功能测试
|
|
* - data-flow: 数据流深度验证
|
|
* - store-state: Store 状态验证
|
|
* - edge-cases: 边界情况测试
|
|
*/
|
|
export default defineConfig({
|
|
testDir: './specs',
|
|
|
|
// 测试超时配置
|
|
timeout: 120000, // 单个测试最大 2 分钟
|
|
expect: {
|
|
timeout: 10000, // 断言超时 10 秒
|
|
},
|
|
|
|
// 并行执行配置
|
|
fullyParallel: true,
|
|
forbidOnly: !!process.env.CI,
|
|
retries: process.env.CI ? 2 : 0,
|
|
workers: process.env.CI ? 1 : undefined,
|
|
|
|
// 报告配置
|
|
reporter: [
|
|
['html', { outputFolder: 'test-results/html-report' }],
|
|
['json', { outputFile: 'test-results/results.json' }],
|
|
['list'], // 控制台输出
|
|
],
|
|
|
|
// 全局配置
|
|
use: {
|
|
baseURL: 'http://localhost:1420',
|
|
trace: 'on-first-retry',
|
|
screenshot: 'only-on-failure',
|
|
video: 'retain-on-failure',
|
|
// 网络超时
|
|
actionTimeout: 10000,
|
|
navigationTimeout: 30000,
|
|
},
|
|
|
|
// 测试项目配置
|
|
projects: [
|
|
// 主要测试项目 - Chromium
|
|
{
|
|
name: 'chromium',
|
|
use: {
|
|
...devices['Desktop Chrome'],
|
|
viewport: { width: 1280, height: 720 },
|
|
},
|
|
},
|
|
|
|
// Firefox 浏览器测试(可选)
|
|
// {
|
|
// name: 'firefox',
|
|
// use: { ...devices['Desktop Firefox'] },
|
|
// },
|
|
|
|
// WebKit 浏览器测试(可选)
|
|
// {
|
|
// name: 'webkit',
|
|
// use: { ...devices['Desktop Safari'] },
|
|
// },
|
|
|
|
// 移动端测试(可选)
|
|
// {
|
|
// name: 'Mobile Chrome',
|
|
// use: { ...devices['Pixel 5'] },
|
|
// },
|
|
// {
|
|
// name: 'Mobile Safari',
|
|
// use: { ...devices['iPhone 12'] },
|
|
// },
|
|
|
|
// 数据流测试专用项目
|
|
{
|
|
name: 'data-flow',
|
|
testMatch: /data-flow\.spec\.ts/,
|
|
use: {
|
|
...devices['Desktop Chrome'],
|
|
viewport: { width: 1920, height: 1080 },
|
|
},
|
|
},
|
|
|
|
// Store 状态测试专用项目
|
|
{
|
|
name: 'store-state',
|
|
testMatch: /store-state\.spec\.ts/,
|
|
use: {
|
|
...devices['Desktop Chrome'],
|
|
},
|
|
},
|
|
|
|
// 边界情况测试专用项目
|
|
{
|
|
name: 'edge-cases',
|
|
testMatch: /edge-cases\.spec\.ts/,
|
|
use: {
|
|
...devices['Desktop Chrome'],
|
|
},
|
|
timeout: 180000, // 边界情况测试可能需要更长时间
|
|
},
|
|
],
|
|
|
|
// 开发服务器配置
|
|
webServer: {
|
|
command: 'pnpm dev',
|
|
url: 'http://localhost:1420',
|
|
reuseExistingServer: !process.env.CI,
|
|
timeout: 120000,
|
|
stdout: 'pipe',
|
|
stderr: 'pipe',
|
|
},
|
|
|
|
// 输出目录
|
|
outputDir: 'test-results/artifacts',
|
|
});
|