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

Playwright Mail Tests Need a Consumption Ledger

Описание и применение

Внедрение реестра потребления писем в Playwright устраняет ложные положительные результаты, обеспечивая, что каждый тест проверяет правильное письмо и предоставляет более точные сообщения об ошибках.

Задача

Email verification tests can pass for the wrong reason when a shared inbox contains stale messages, retries consume the same message, or parallel workers read the same link, leading to false positives.

Результат

The ledger approach reduces stale inbox failures, clarifies failure reasons, and prevents race conditions in parallel test execution.

Рабочий процесс

  • 1. Generate a unique correlation ID for the test run.
  • 2. Record the mailbox cursor before polling.
  • 3. Poll for new messages using a cursor and a set of seen IDs.
  • 4. When a matching message is found, claim it in the ledger.
  • 5. Extract the verification URL and navigate to it.
  • 6. Mark the message as opened in the ledger.
  • 7. Handle retries and parallel workers by including worker and retry identifiers in the correlation ID.
  • 8. Clean up the ledger even if the test fails.

Доказательства

An email verification test can pass for the wrong reason. A shared inbox may already contain a valid message, a retry may consume the message from the first attempt, or two parallel workers may both read the same link.

Источник

The ledger does not need to be a database. For most end-to-end suites, a run-scoped object or JSON attachment is enough.

Источник

After the message is found, claim it before opening the link:

Источник

  • Дата записи: 2026-10-09T00:56:09.129Z