If you are looking to test out emails with cypress:
- for free without having to use strange Email Providers
- with as little code as possible You just found the solution to this problem!
We will use a simple NPM package called "gmail-tester", it uses Gmail API under the hood.
The main issues with this package are:
- you have to create the "credentials.json" and "token.json" files using the "gmail-tester" official guide.
- you have to renew the "token.json" file at least every 30 days.
- create a cypress task "plugin" to call "gmail-tester" from a cypress test.
- Install the package "gmail-tester" with
yarn add gmail-tester
-
Configure the required files for "gmail-tester" following this guide: https://github.com/levz0r/gmail-tester#how-to-get-credentialsjson
-
Create these Cypress Plugin files with these codes:
- Write a simple test to check if the plugin is working: slack-new-account.ts ✨