Skip to content

next-auth email authentication with cypress testing

Notifications You must be signed in to change notification settings

pcreem/cypressAuth

Repository files navigation

Cypress Email Authentication

Blog post: https://dev.to/pcreem/cypress-next-auth-mail-authentication-57f0

Code sample demonstrating how to test an email authentication workflow with Cypress. Mails are sent to Mailtrap and exposed through its API.

Setting up

  • npx yarn

  • signup an Mailtrap account and get SMTP server in demo inbox

  • code .env.local

EMAIL_SERVER_USER=
EMAIL_SERVER_PASSWORD=
EMAIL_SERVER_HOST=
EMAIL_SERVER_PORT=
EMAIL_FROM=
NEXTAUTH_URL=
  • code cypress.env.json
{
    "inboxUrl":"Your Mailtrap Inbox url with inboxId",
    "Api-Token":"Your Mailtrap API token"
}

Running the tests

  • npx cypress open
  • run sample_spec.js test

the result should like this cypress open

About

next-auth email authentication with cypress testing

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published