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

Playwright Email Tests Need a Clock Skew Matrix

说明与用途

Playwright 邮件测试经常因应用、邮箱和测试运行器之间的时间差异而失败。通过使用时钟偏移矩阵,记录每个边界的时间戳并验证邮件所有权,可使测试可靠并简化故障诊断。

问题

Email tests often fail because the test assumes the newest email is the one just sent, but timing differences between the app, mailbox, and test runner cause flakiness.

结果

Tests become repeatable and failures are easier to diagnose by recording and comparing timestamps across request, queue, mailbox, and assertion boundaries.

工作流

  • Create a test user
  • Submit the signup form
  • Record request timestamp and ID
  • Reserve or create an isolated mailbox
  • Poll mailbox with waitForMessage specifying after=requestedAt, marker=runId, timeoutMs, intervalMs
  • Verify message receivedAt and runId
  • Navigate to verificationUrl
  • Assert link consumption
  • Clean up mailbox lease

证据

Email tests often fail in a confusing way: the application says a verification message was sent, but Playwright cannot find it yet.

来源

A clock skew matrix makes those boundaries visible and gives QA a repeatable way to test them.

来源

Keep the polling helper explicit about its deadline and ownership rules. Do not hide a five-minute retry loop inside a generic waitForEmail function.

来源

When the test fails, classify the first missing boundary rather than immediately increasing the timeout:

来源

  • 记录日期: 2026-10-24T12:11:23.580Z