| 123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- /**
- * Playwright API 级测试配置(远程后端)
- * ================================================================
- * 用途:针对远程后端 API(http://cfc.iwintrue.com)运行「API 级 e2e」。
- * 特点:
- * - 无 globalSetup(绝不重置远程数据库)
- * - 独立 outputDir(.api-artifacts):API 用例不产出截图/trace,
- * 避免累积大量产物触发本地 safe-delete 批量守卫,导致运行前被中断
- * - 仅 list reporter,不生成 html 报告目录
- * - 用例通过 request fixture 直连 /api/*,不依赖前端 SPA
- *
- * 运行:npx playwright test <spec> -c playwright.config.api.js --project=desktop
- */
- var path = require('path');
- module.exports = {
- testDir: path.join(__dirname, 'e2e'),
- testMatch: /api[\\/].*\.spec\.js$/,
- // 远程接口冷启动较慢(/api/family/member/add 首调实测约 16s),单用例含多次调用,放宽用例级超时
- timeout: 180000,
- retries: 0,
- workers: 1,
- outputDir: path.join(__dirname, '.api-artifacts'),
- reporter: [['list']],
- use: {
- // 默认远端;本地复验时用 CFC_API_BASE 指向已启动的 cfc-backend(如 http://127.0.0.1:9082)
- baseURL: process.env.CFC_API_BASE || 'http://cfc.iwintrue.com',
- headless: true,
- ignoreHTTPSErrors: true,
- actionTimeout: 15000,
- navigationTimeout: 60000,
- screenshot: 'off',
- trace: 'off',
- video: 'off',
- },
- projects: [
- {
- name: 'desktop',
- use: {
- browserName: 'chromium',
- viewport: { width: 1440, height: 900 },
- },
- },
- ],
- };
|