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

Playwright Email Tests Need a Message Claim

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

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

Задача

Email verification tests often fail due to identity correlation problems rather than timing, causing flaky CI results.

Результат

Implementing a message claim pattern eliminates flaky email verification tests by ensuring each test operates on a unique, verifiable message.

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

  • Generate a unique runId and email address before sending the signup request.
  • Send the signup request and capture the request start time.
  • Poll the inbox with a deadline, filtering messages by recipient, runId in subject, and receivedAt after request start.
  • Return a MessageClaim object containing runId, recipient, messageId, and receivedAt.
  • Attach a redacted receipt (email-claim.json) to the test for evidence.
  • Fetch the claimed message by ID and assert the verification link.
  • Use a shared fixture to encapsulate polling, backoff, and cleanup.

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

Email verification tests often fail for a reason that looks like timing, but is really identity.

Источник

The test receives a message, finds a token, and assumes that token belongs to the current run.

Источник

Before sending the signup request, create a run identifier and save the time at which the request starts.

Источник

The polling operation should return a MessageClaim, not just a body string.

Источник

After claiming a message, save a small redacted receipt as a test attachment.

Источник

  • Дата записи: 2026-10-11T09:56:11.752Z