Test AWS Cognito

End to end testing Amazon Cognito

It’s common in modern web development to use a 3rd party OAuth2 system to authenticate users, such as Amazon AWS Cognito or Firebase. These systems simplify user sign-up but present new problems for end-to-end (e2e) testing. How do we test a sign-up process if new users need to receive an email verification code?

Luckily, a SAAS tool called EmailE2E was created for this purpose. It is a simple, free API that let’s you send and receive emails from randomly generated email addresses. This means you can create a new email address during a test and read the emails sent to it—including verification codes! Here is a basic example using the Cypress test framework, node, and the official EmailE2E javascript client.