replica-test

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

replica-test

replica-test

Reads the flows in
replica/recon.md
. Writes
replica/test-plan.md
,
replica/bugs.md
, and end-to-end tests in the project (
e2e/
). Templates in this folder:
test-plan.md
,
bug-report.md
,
e2e.example.spec.ts
.
读取
replica/recon.md
中的流程。写入
replica/test-plan.md
、
replica/bugs.md
,以及项目中的 end-to-end 测试(
e2e/
)。本文件夹中的模板:
test-plan.md
、
bug-report.md
、
e2e.example.spec.ts
。

The rule

规则

Test your clone, not the original. Never load test, fuzz, script or hammer the original app's servers. Using the original by hand, as a normal user, to see how it behaves is fine.
测试你的克隆版本,而不是原版。 绝不对原应用的服务器执行 load test、 fuzz、脚本测试或高频请求。以普通用户的身份手动使用原版来观察其行为则无妨。

Step 1: the plan

第 1 步:制定计划

For every flow F01, F02... in the recon map, write:
  • Happy path: the steps, and what the user should see at the end.
  • Edge cases that apply. Go down this list for every flow: empty input, very long input, emoji and accents, two tabs at once, double click on submit, back button mid-flow, refresh mid-flow, slow network, offline, expired session, second user's data (must be invisible), time zones and daylight saving, mobile width, keyboard only, screen reader labels.
  • Negative cases: wrong password, card declined (Stripe test card
    4000 0000 0000 0002
    ), permission denied, deleted record.
Number every case: F01-H1, F01-E3, F01-N2.
对于 recon 映射图中的每个流程 F01、F02...,编写:
  • Happy path(正向路径):操作步骤,以及用户最终应看到的内容。
  • Edge cases(边界情况):适用于该流程的情况。对每个流程逐一检查以下列表: 空输入、超长输入、emoji 和重音字符、同时打开两个标签页、 双击提交、流程进行到一半时点击返回按钮、流程进行到一半时刷新、慢速 网络、离线、会话过期、另一位用户的数据(必须不可见)、 时区和夏令时、移动端宽度、仅使用键盘、屏幕阅读器 标签。
  • Negative cases(负向用例):密码错误、银行卡支付被拒(Stripe 测试卡
    4000 0000 0000 0002
    )、权限被拒、记录已删除。
为每个用例编号:F01-H1、F01-E3、F01-N2。

Step 2: automate what you can

第 2 步:尽可能自动化

Playwright, one spec per flow, against the local dev server with seed data. Use roles and labels for selectors (
getByRole('button', { name: 'Book' })
), never CSS classes. See
e2e.example.spec.ts
.
bash
npm i -D @playwright/test && npx playwright install chromium
npx playwright test
Add to every spec: fail on console errors, fail on any 5xx response, and an axe accessibility scan (
@axe-core/playwright
) on each screen.
针对本地开发服务器并使用 seed 数据,每个流程编写一个 Playwright spec。 选择器使用 role 和 label(
getByRole('button', { name: 'Book' })
), 绝不使用 CSS class。参见
e2e.example.spec.ts
。
bash
npm i -D @playwright/test && npx playwright install chromium
npx playwright test
在每个 spec 中加入:遇到 console 错误时失败、任何 5xx 响应时失败,以及对每个 页面执行 axe 可访问性扫描(
@axe-core/playwright
)。

Step 3: click through the rest

第 3 步:手动检查其余内容

What cannot be automated (emails arriving, OAuth with real providers, payments end to end, visual glitches) gets a manual pass. If a browser tool is available, drive the local clone with it and screenshot each step. Otherwise give the user the checklist and wait for answers.
无法自动化的内容(邮件到达、使用真实提供商进行 OAuth、 end-to-end 支付、视觉异常)需进行人工检查。如果有浏览器工具, 就用它操作本地克隆版本,并为每一步截图。否则 向用户提供检查清单并等待答复。

Step 4: report bugs

第 4 步:报告缺陷

Every bug goes in
replica/bugs.md
in the
bug-report.md
format: an ID, a severity, exact steps, expected, actual, evidence. Severity:
means
S1data loss, security hole, payments wrong, core flow blocked
S2a feature broken, no workaround
S3broken with a workaround, or visibly wrong
S4cosmetic
Only report what you reproduced. "Might be an issue" goes in a separate "to check" list.
每个缺陷都应写入
replica/bugs.md
,并采用
bug-report.md
格式:ID、 严重程度、准确复现步骤、预期结果、实际结果、证据。严重程度:
含义
S1数据丢失、安全漏洞、支付异常、核心流程受阻
S2某项功能损坏且无变通方案
S3功能损坏但有变通方案,或显示明显异常
S4外观问题
仅报告已复现的问题。“可能存在问题”的内容放入单独的 “待检查”列表。

Step 5: fix loop

第 5 步:修复循环

Fix S1 and S2 first. For every fix: write the failing test first, fix, watch it pass, keep the test. Re-run the whole suite after each batch. Update
bugs.md
with the commit that fixed each one.
优先修复 S1 和 S2。每次修复都要先编写失败测试,然后修复,确认 测试通过,并保留该测试。每批修复后重新运行整个测试套件。更新
bugs.md
,记录修复每个缺陷所对应的 commit。

Output

输出

test-plan.md
, the specs,
bugs.md
, and a summary: cases run, passed, failed, bugs by severity, fixed so far. Ship nothing with an open S1. Next:
/replica-diff
.
test-plan.md
、各个 spec、
bugs.md
,以及一份摘要:已运行用例数、通过数、 失败数、按严重程度分类的缺陷数、迄今已修复数量。存在未解决的 S1 缺陷时不得发布。下一步:
/replica-diff
。