| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- /**
- * Playwright 线上 UI 级 E2E 配置(针对已部署站点 cfc.iwintrue.com)
- * ================================================================
- * 与 playwright.config.js 的关键区别:
- * - **无 globalSetup**:默认配置的 globalSetup 会执行 reset-db.sh 重置共享测试库,
- * 对本配置(打生产/测试已部署站点)绝对禁止。
- * - 只做只读浏览器自动化:不写业务数据(唯一例外是登录,属只读会话建立)。
- * - workers=1、fullyParallel=false:单节点串行,符合「每个节点只能跑一个浏览器自动化任务」。
- * - 两个 project 按 spec 分流:admin 走桌面视口,frontend(小程序 H5)走移动视口。
- *
- * 运行(单节点、串行):
- * npx playwright test -c playwright.config.live.js --project=admin-desktop
- * npx playwright test -c playwright.config.live.js --project=frontend-mobile
- */
- var path = require('path');
- var LIVE_BASE = process.env.LIVE_BASE_URL || 'http://cfc.iwintrue.com';
- module.exports = {
- testDir: path.join(__dirname, 'e2e-live'),
- timeout: 150000,
- expect: { timeout: 15000 },
- retries: 0,
- workers: 1,
- fullyParallel: false,
- outputDir: path.join(__dirname, '.live-artifacts'),
- reporter: [['list']],
- use: {
- baseURL: LIVE_BASE,
- headless: true,
- ignoreHTTPSErrors: true,
- actionTimeout: 20000,
- navigationTimeout: 60000,
- screenshot: 'only-on-failure',
- trace: 'off',
- video: 'off',
- },
- projects: [
- {
- name: 'admin-desktop',
- testMatch: /admin-live\.spec\.js$/,
- use: { browserName: 'chromium', viewport: { width: 1440, height: 900 } },
- },
- {
- name: 'frontend-mobile',
- testMatch: /frontend-live\.spec\.js$/,
- use: { browserName: 'chromium', viewport: { width: 375, height: 812 }, isMobile: true, hasTouch: true },
- },
- {
- // 接口级契约(商城价格排序需求变更 S1):无需浏览器,走 request fixture 直连 /api
- name: 'shop-api',
- testMatch: /shop-sort-api\.spec\.js$/,
- use: { browserName: 'chromium' },
- },
- {
- // R138:D/X 桥接鉴权契约(TC-DX-U01/U02)。此前该 spec 存在于 e2e-live 却未挂入任何
- // project → 设计的用例从未被执行(覆盖缺口)。端点未部署时用例按 404 记 skip,
- // 不产生假绿;端点上线后自动转为 401/403 断言。
- name: 'dx-bridge',
- testMatch: /dx-health-bridge-auth\.spec\.js$/,
- use: { browserName: 'chromium' },
- },
- {
- // R260:法务页可达性契约(web/privacy.html · web/agreement.html,小米 HealthKit 上架所需)。
- // 窗口新增内容(5a0223b9a)尚无任何用例覆盖 → 补 TC-L-U01~U06,验证线上可达 + 结构完整。
- name: 'legal-pages',
- testMatch: /legal-pages-live\.spec\.js$/,
- use: { browserName: 'chromium', viewport: { width: 1440, height: 900 } },
- },
- {
- // R275:匿名访问鉴权门禁契约(TC-AU-U01~U10)。此前 B-227-1 连续 50 轮靠人工
- // curl 探针取证,不进入套件 → 修复后无人自动确认、也无法随 CI 回归。
- // 3 个私有点子为缺陷守卫(当前 200 保持红),5 个对照 + 2 个管理端为正向基线。
- name: 'auth-guard',
- testMatch: /auth-anonymous-guard\.spec\.js$/,
- use: { browserName: 'chromium' },
- },
- ],
- };
|