Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

A Tiny Email Fixture Factory for CI

说明与用途

CI 中的邮件固定件提供唯一、可追踪的地址、受限的邮件等待、保证的清理和已掩码的工件,使测试可预测并简化调试。

问题

Tests that rely on email verification become hard to reproduce and interfere with each other when each test creates its own disposable email address, leading to flaky CI runs.

结果

Tests become deterministic, failures are categorized (message missing, link invalid, address rejected), and debugging focuses on contract steps rather than generic email receipt.

工作流

  • Create a unique fixture key using runId and testId
  • Call createMailFixture to obtain address, key, waitFor, and dispose functions
  • Use waitFor(subject, timeoutMs) to poll for the expected email within a deadline
  • Extract the verification link from the returned message object
  • Perform the test action (e.g., click link, verify account state)
  • Wrap test logic in try/finally to ensure dispose() is called
  • Record timeout evidence as a test artifact, redacting sensitive data
  • If cleanup fails, report separately from the test assertion

证据

Every test gets a unique address or inbox key.

来源

The factory can expose only three operations: create, wait, and dispose.

来源

Wrap the fixture in a try/finally block, and make disposal idempotent.

来源

  • 记录日期: 2026-09-21T10:00:41.192Z