@gate-forge/pack-playwright

中文文档
0.19.2发布于 2026/11/10Apache-2.0TypeScriptESM + CJS构建来源已验证近 30 天下载 2905

Gateforge Playwright evidence pack: loopback witness service, engine-side adapter execution, trusted evidence fixture, verdict reporter.

原始使用文档
文档目录5 节
  1. Start from a complete example
  2. Keep each journey isolated
  3. Observe mutation results without hanging
  4. Prefer real behavior over mocks
  5. Install the browsers before the first witnessed run

Writing witnessed journeys

A witnessed journey must exercise the real application behavior and verify the result that users depend on. A passing test declaration is not proof: only a valid receipt proves a run, and an adopted baseline forgives previously accepted debt.

Start from a complete example

examples/overlay-proof.spec.js (in this package, so node_modules/@gate-forge/pack-playwright/examples/overlay-proof.spec.js in your repo) is a complete overlay proof test: a surface descriptor for a small list/create/edit/archive app, the gateforge annotation, and the witnessed evidence.ui.* / visible.confirm / http.observe / persistence.verify / finalize sequence. Copy it, change the selectors, and the fixture calls stay the same.

Keep each journey isolated

  • Create distinct records and tenant context for every test. Do not reuse a per-tenant singleton across tests; shared state can hide cross-tenant leaks and make outcomes depend on test order.
  • Give test data unique identifiers, and clean it up through the same supported application path the test is checking.
  • Keep setup independent of Gateforge environment variables so discovery can register the same tests in local and CI runs.

Observe mutation results without hanging

  • Read a mutation response body only when the application returns one. Calling .json() on an intentionally empty response waits forever; assert the status and then query the resulting state through the application’s normal read path.
  • Check both the submitted value and the persisted value on the same record. A successful HTTP status or click alone does not prove the update happened.
  • Prefer a specific response or visible application condition over fixed sleeps and transient loading text.

Prefer real behavior over mocks

  • Use the real server and persistence path when the journey claims a user-facing behavior. A page.route() stub can prove client handling, but it cannot show that the server stored the right value or enforced tenant boundaries.
  • Keep mock-only tests, but do not treat them as evidence for the real application surface.
  • When multiple journeys cover the same obligation, state why each one is needed; avoid copy-pasted tests that compete for shared data.

Run the configured suite with gateforge test-gates --changed. For a selected non-authoritative slice, use gateforge test-gates --changed --scope changed --result-only; this reports selected results without creating or changing a receipt.

Install the browsers before the first witnessed run

npx playwright install chromium, from the directory that holds your Playwright config. On a Linux machine without the browser's system libraries — a container, a CI image, WSL — install those too in the same command: npx playwright install --with-deps chromium (it needs root or sudo). gateforge enforcement doctor names the case: a missing build names the install, and a build that is installed but cannot start names the loader's own line and the npx playwright install-deps chromium that fixes it.

版本与发布记录

@gate-forge/pack-playwright 共发布 46 个版本,首次发布于 2026/09/17;过去 12 个月发布了 46 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.19.2latest2026/11/105 天前
0.19.12026/11/106 天前
0.19.02026/10/2917 天前
0.18.32026/10/2522 天前
0.18.22026/10/2125 天前
0.18.12026/10/2125 天前

关于 @gate-forge/pack-playwright 的常见问题

@gate-forge/pack-playwright 是什么?

Gateforge Playwright evidence pack: loopback witness service, engine-side adapter execution, trusted evidence fixture, verdict reporter.

如何安装 @gate-forge/pack-playwright?

在项目目录运行 npm install @gate-forge/pack-playwright,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 gateforge-witness,可以用 npx gateforge-witness 直接运行。

@gate-forge/pack-playwright 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@gate-forge/pack-playwright 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@gate-forge/pack-playwright 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=20。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@gate-forge/pack-playwright 可以商用吗?

@gate-forge/pack-playwright 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@gate-forge/pack-playwright 的下载量有多少?

根据 npm 官方下载统计,@gate-forge/pack-playwright 在 2026/10/16 – 2026/11/14 这 30 天内被下载 2,905 次,日均约 97 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@gate-forge/pack-playwright 还在维护吗?

最新版本 0.19.2 发布于 2026/11/10(5 天前);至今共发布 46 个版本,其中过去 12 个月发布了 46 个;首次发布于 2026/09/17。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。