ci-smoke.spec.js 798 B

123456789101112131415
  1. /**
  2. * CI 冒烟测试(不依赖任何外部服务/DB)
  3. * ================================================================
  4. * 用途:在 CI 中验证 Playwright + Chromium headless 能真实拉起浏览器,
  5. * 作为 e2e 套件的可执行入口(真实 UI e2e 依赖部署环境 + DB,
  6. * CI 无内网访问,仅做拉起验证 + spec 收集校验)。
  7. * 注意:本 spec 必须保持零外部依赖(不用 baseURL、不调接口),
  8. * 否则 CI 中会因无后端而失败。
  9. */
  10. const { test, expect } = require('@playwright/test');
  11. test('[CI-smoke] Chromium headless 拉起并渲染本地 HTML', async ({ page }) => {
  12. await page.goto('data:text/html,<html><body><h1 id="t">ok</h1></body></html>');
  13. await expect(page.locator('#t')).toHaveText('ok');
  14. });