{"id":15552197,"url":"https://github.com/bahmutov/cypress-email-example","last_synced_at":"2025-09-28T22:30:43.947Z","repository":{"id":37651088,"uuid":"358107333","full_name":"bahmutov/cypress-email-example","owner":"bahmutov","description":"Testing HTML emails using Cypress","archived":false,"fork":false,"pushed_at":"2024-10-23T07:45:15.000Z","size":1226,"stargazers_count":23,"open_issues_count":4,"forks_count":8,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-10-24T21:33:29.738Z","etag":null,"topics":["cypress-email-testing-example","cypress-example"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bahmutov.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2021-04-15T02:50:39.000Z","updated_at":"2024-09-04T06:06:04.000Z","dependencies_parsed_at":"2023-12-31T01:45:16.879Z","dependency_job_id":"841aed9e-472d-408f-b162-97454a56bb79","html_url":"https://github.com/bahmutov/cypress-email-example","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bahmutov%2Fcypress-email-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bahmutov%2Fcypress-email-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bahmutov%2Fcypress-email-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bahmutov%2Fcypress-email-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bahmutov","download_url":"https://codeload.github.com/bahmutov/cypress-email-example/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234566216,"owners_count":18853428,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["cypress-email-testing-example","cypress-example"],"created_at":"2024-10-02T14:11:51.204Z","updated_at":"2025-09-28T22:30:38.631Z","avatar_url":"https://github.com/bahmutov.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cypress-email-example\n[![ci status][ci image]][ci url] [![badges status][badges image]][badges url] [![renovate-app badge][renovate-badge]][renovate-app] ![cypress version](https://img.shields.io/badge/cypress-9.7.0-brightgreen) [![cypress-email-example](https://img.shields.io/endpoint?url=https://dashboard.cypress.io/badge/simple/9gzopg/main\u0026style=flat\u0026logo=cypress)](https://dashboard.cypress.io/projects/9gzopg/runs)\n\nSending emails using [nodemailer](https://nodemailer.com/about/), receive the using [smtp-tester](https://github.com/deitch/smtp-tester) and testing the received email using [Cypress](https://github.com/cypress-io/cypress).\n\n![The HTML email test](./images/html-email.gif)\n\nSee [cypress/integration/spec.js](./cypress/integration/spec.js)\n\nRead the blog post [Testing HTML Emails using Cypress](https://www.cypress.io/blog/2021/05/11/testing-html-emails-using-cypress/) and watch [this video](https://youtu.be/16WTH7XeIVw) where I explain the entire testing process.\n\n## Install and run\n\n```shell\n$ npm install\n$ npm start\n# from another terminal\n$ npx cypress open\n# click the spec.js\n```\n\n## The application\n\nThe application shows the registration page [pages/index.js](./pages/index.js) where the user can fill the email and click the submit button. The page makes an Ajax request to the [pages/api/register.js](./pages/api/register.js) handler which sends an email. The email has the confirmation code the user is expected to enter on the confirmation page [pages/confirm.js](./pages/confirm.js).\n\n## Email server\n\nThe emails are sent using [nodemailer](https://nodemailer.com/about/), see [emailer.js](./emailer.js). During tests the SMTP server is running inside [cypress/plugins/index.js](./cypress/plugins/index.js) process.\n\n## Cypress tests\n\n- [cypress/integration/spec.js](./cypress/integration/spec.js) shows the full plain and HTML email test\n- [cypress/integration/confirm-spec.js](./cypress/integration/confirm-spec.js) runs E2E tests for the confirmation page in isolation\n- [cypress/integration/check-email-spec.js](./cypress/integration/check-email-spec.js) is an API test that calls the [pages/api/register.js](./pages/api/register.js) handler and confirms the handler sends an email\n\nThe tests run on GitHub Actions, see the [.github/workflows/ci.yml](./.github/workflows/ci.yml) workflow. The results are recorded on [Cypress Dashboard](https://dashboard.cypress.io/projects/9gzopg/runs).\n\n[ci image]: https://github.com/bahmutov/cypress-email-example/workflows/ci/badge.svg?branch=main\n[ci url]: https://github.com/bahmutov/cypress-email-example/actions\n[badges image]: https://github.com/bahmutov/cypress-email-example/workflows/badges/badge.svg?branch=main\n[badges url]: https://github.com/bahmutov/cypress-email-example/actions\n[renovate-badge]: https://img.shields.io/badge/renovate-app-blue.svg\n[renovate-app]: https://renovateapp.com/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbahmutov%2Fcypress-email-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbahmutov%2Fcypress-email-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbahmutov%2Fcypress-email-example/lists"}