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