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

Playwright Email Tests Need a Failure Receipt

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

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

Задача

Email verification tests often fail with vague timeouts, making diagnosis hard and costly.

Результат

Adding structured failure receipts transforms vague timeout failures into actionable diagnostics, reducing debugging time and improving test reliability.

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

  • 1. Create a unique mailbox or correlation ID for each test.
  • 2. Initialize an EmailFailureReceipt object before test actions.
  • 3. After each major boundary (signup, delivery, matching, verification), update receipt.failureStage and record relevant data (status codes, poll counts, message metadata).
  • 4. In test.afterEach hook, if test failed, attach the receipt JSON to Playwright’s testInfo using testInfo.attach().
  • 5. In CI, configure to capture receipts and screenshots only on failure, mask sensitive data, and keep separate timeouts for delivery and browser assertions.
  • 6. Use helper functions for each boundary that throw errors with stage info and update the receipt accordingly.

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

Write the receipt in an afterEach hook only when the test fails. Attach it with Playwright’s test information object, so the report and CI artifact remain connected to the original test.

Источник

Create a fresh inbox identity per test or per isolated worker.

Источник

  • Дата записи: 2026-09-19T20:15:27.421Z