Some checks failed
Deploy / deploy (push) Has been cancelled
Full-stack web application for Telegram management - Frontend: Vue 3 + Vben Admin - Backend: NestJS - Features: User management, group broadcast, statistics 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
119 lines
2.2 KiB
TypeScript
119 lines
2.2 KiB
TypeScript
import { defineConfig, devices } from '@playwright/test';
|
|
|
|
/**
|
|
* Playwright 测试配置
|
|
* 用于端到端测试
|
|
*/
|
|
|
|
export default defineConfig({
|
|
// 测试目录
|
|
testDir: './tests/e2e',
|
|
|
|
// 并行运行测试
|
|
fullyParallel: true,
|
|
|
|
// 在CI环境中禁止重试
|
|
forbidOnly: !!process.env.CI,
|
|
|
|
// 测试失败时重试次数
|
|
retries: process.env.CI ? 2 : 0,
|
|
|
|
// 并发worker数量
|
|
workers: process.env.CI ? 1 : undefined,
|
|
|
|
// 报告配置
|
|
reporter: [
|
|
['html', { outputFolder: 'test-results/html-report' }],
|
|
['json', { outputFile: 'test-results/results.json' }],
|
|
['junit', { outputFile: 'test-results/results.xml' }],
|
|
['line'],
|
|
],
|
|
|
|
// 全局测试配置
|
|
use: {
|
|
// 基础URL
|
|
baseURL: 'http://localhost:5173',
|
|
|
|
// 测试追踪
|
|
trace: 'on-first-retry',
|
|
|
|
// 截图配置
|
|
screenshot: 'only-on-failure',
|
|
|
|
// 视频录制
|
|
video: 'retain-on-failure',
|
|
|
|
// 忽略HTTPS错误
|
|
ignoreHTTPSErrors: true,
|
|
|
|
// 请求拦截
|
|
extraHTTPHeaders: {
|
|
'Accept-Language': 'zh-CN,zh;q=0.9,en;q=0.8',
|
|
},
|
|
|
|
// 浏览器上下文配置
|
|
viewport: { width: 1280, height: 720 },
|
|
|
|
// 超时设置
|
|
actionTimeout: 10000,
|
|
navigationTimeout: 30000,
|
|
},
|
|
|
|
// 项目配置 - 不同浏览器
|
|
projects: [
|
|
{
|
|
name: 'chromium',
|
|
use: { ...devices['Desktop Chrome'] },
|
|
},
|
|
|
|
{
|
|
name: 'firefox',
|
|
use: { ...devices['Desktop Firefox'] },
|
|
},
|
|
|
|
{
|
|
name: 'webkit',
|
|
use: { ...devices['Desktop Safari'] },
|
|
},
|
|
|
|
// 移动端测试
|
|
{
|
|
name: 'Mobile Chrome',
|
|
use: { ...devices['Pixel 5'] },
|
|
},
|
|
|
|
{
|
|
name: 'Mobile Safari',
|
|
use: { ...devices['iPhone 12'] },
|
|
},
|
|
|
|
// Edge浏览器
|
|
{
|
|
name: 'Microsoft Edge',
|
|
use: { ...devices['Desktop Edge'], channel: 'msedge' },
|
|
},
|
|
],
|
|
|
|
// 本地开发服务器
|
|
webServer: {
|
|
command: 'pnpm dev',
|
|
port: 5173,
|
|
reuseExistingServer: !process.env.CI,
|
|
timeout: 120000,
|
|
},
|
|
|
|
// 输出目录
|
|
outputDir: 'test-results/artifacts',
|
|
|
|
// 全局设置
|
|
globalSetup: './tests/global-setup.ts',
|
|
globalTeardown: './tests/global-teardown.ts',
|
|
|
|
// 测试超时
|
|
timeout: 30000,
|
|
expect: {
|
|
// 断言超时
|
|
timeout: 5000,
|
|
},
|
|
});
|