{"id":18690057,"url":"https://github.com/yakovlev-alexey/playwright-mailhog","last_synced_at":"2026-02-26T10:37:25.100Z","repository":{"id":127184887,"uuid":"555331046","full_name":"yakovlev-alexey/playwright-mailhog","owner":"yakovlev-alexey","description":"Playwright fixtures to easily integrate with MailHog","archived":false,"fork":false,"pushed_at":"2022-10-21T15:27:07.000Z","size":17,"stargazers_count":3,"open_issues_count":2,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-18T21:35:43.825Z","etag":null,"topics":["2fa","e2e","email","fixtures","mailhog","playwright","testing","transactional-email"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/playwright-mailhog","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yakovlev-alexey.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-10-21T11:21:19.000Z","updated_at":"2025-01-22T21:44:27.000Z","dependencies_parsed_at":null,"dependency_job_id":"c12923e6-4842-4837-8753-8cd946fb648e","html_url":"https://github.com/yakovlev-alexey/playwright-mailhog","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/yakovlev-alexey/playwright-mailhog","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yakovlev-alexey%2Fplaywright-mailhog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yakovlev-alexey%2Fplaywright-mailhog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yakovlev-alexey%2Fplaywright-mailhog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yakovlev-alexey%2Fplaywright-mailhog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yakovlev-alexey","download_url":"https://codeload.github.com/yakovlev-alexey/playwright-mailhog/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yakovlev-alexey%2Fplaywright-mailhog/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29856743,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-26T08:51:08.701Z","status":"ssl_error","status_checked_at":"2026-02-26T08:50:19.607Z","response_time":89,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["2fa","e2e","email","fixtures","mailhog","playwright","testing","transactional-email"],"created_at":"2024-11-07T10:46:14.305Z","updated_at":"2026-02-26T10:37:25.047Z","avatar_url":"https://github.com/yakovlev-alexey.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Playwright MailHog Integration\n\nThis package provides utility fixtures for [Playwright](https://playwright.dev) that provide an interface to easily make requests to a [MailHog](https://github.com/mailhog/MailHog) instance. This allows you to easily test transactional email in your applications as well as 2-factor authentication via email in authentication systems.\n\n## Installation\n\nUse your favourite package manager to add this package to your project.\n\n```bash\nyarn add playwright-mailhog\n# or\nnpm install --save playwright-mailhog\n```\n\nUpon installation extend your `test` object. Read more about it in [Playwright docs](https://playwright.dev/docs/test-fixtures#creating-a-fixture).\n\n```ts\n// ./my-test.ts\nimport { test as base, PlaywrightTestArgs } from \"@playwright/test\";\nimport { MailHogFixtures, makeMailHogFixtures } from \"playwright-mailhog\";\n\n// make sure to include the `MailHogFixtures` type\nexport const test = base.extend\u003cMailHogFixtures\u003e({\n  // here you would also specify your own fixtures\n  ...makeMailHogFixtures({\n    mailhogUrl: process.env.MAILHOG_API_URL,\n    basicAuthCredentials: process.env.MAILHOG_BASIC_AUTH_CREDENTIALS,\n  }),\n});\n```\n\n## Usage\n\nTo use the fixtures make sure to be using the extended `test` object.\n\n```ts\n// ./mail.spec.ts\nimport { test } from \"./my-test\";\n\ntest(\"send mail\", async ({ page, mhGetEmailsByRecipient }) =\u003e {\n  await page.locator(\".email-body\").fill(\"TEST MESSAGE\");\n  await page.locator(\".email-recipient\").fill(\"user@example.com\");\n  await page.locator(\".send-email\").click();\n\n  const messages = await mhGetEmailsByRecipient(\"user@example.com\");\n\n  await test.expect(messages.items[0].Raw.Data).toBe(\"TEST MESSAGE\");\n});\n```\n\nAll MailHog fixtures are prefixed with `mh`. The library is typed and provides proper types for provided responses. See `MailHogFixtures` type for a complete list of fixtures.\n\nAt the moment only `/v2/emails` and `/v2/search` have their shortcuts implemented as fixtures. In order to make requests to other endpoints use `mhApiRequest`.\n\n```ts\n// ./mail.spec.ts\nimport { test } from \"./my-test\";\n\ntest(\"retries if fails\", async ({\n  page,\n  mhGetEmailsByRecipient,\n  mhApiRequest,\n}) =\u003e {\n  // enable Jim by calling `mhApiRequest`\n  await mhApiRequest(\"post\", \"/v2/jim\", { headers: \"X-Some-header\": \"some value\" });\n\n  await page.locator(\".email-body\").fill(\"TEST MESSAGE\");\n  await page.locator(\".email-recipient\").fill(\"user@example.com\");\n  await page.locator(\".send-email\").click();\n\n  const messages = await mhGetEmailsByRecipient(\"user@example.com\");\n\n  await test.expect(messages.items[0].Raw.Data).toBe(\"TEST MESSAGE\");\n});\n```\n\n\u003e If you want to make this package better by including more fixtures feel free to open a Pull Request with new shortcuts implemented.\n\n## Contribution\n\nFeel free to send any suggestions in [GitHub issues](https://github.com/yakovlev-alexey/playwright-mailhog/issues): comment or vote on an existing issue, open a new one or create a Pull Request with your feature.\n\n## License\n\n[MIT](./LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyakovlev-alexey%2Fplaywright-mailhog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyakovlev-alexey%2Fplaywright-mailhog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyakovlev-alexey%2Fplaywright-mailhog/lists"}