Testing your app sign-up or login flows can easily be achieved in Testim using our built-in email service. The service provides both permanent email addresses and randomly generated temporary email addresses.

Email address types

Permanent email addresses

Permanent email address can be used for testing login and password reset flows by registering to the app using this address.

To create a permanent email address : 

  1. Navigate to "Project Setting" page
  2. Click on the "Email Service" tab 
  3. Click the plus button 
  4. Hover on the email address and click on "Copy

Notes :

  • Emails sent to this address will arrive to the Testim inbox which is accessible in the "email service" tab. 
  • Messages in your Testim inbox will be deleted after 2 hours.

Randomly generated temporary email addresses

When testing your sign-up flow, you will most likely need to generate a random email address on every run to make sure you sign up with a new user.

To create a permanent email address : 

  1. Hover over the arrow menu.
  2. Click ‘+’ ⇒ ‘Actions’ ⇒ ‘Generate email address’.

Notes : 

  • Open the Properties panel and change the name of your variable if needed. The default name will be "emailAddress".
  • The email address variable will be available in the test level.

Validating emails

Validation the content of an email for both permanent and randomly generated email addresses can be performed using the “Validate email” step.

To create a "Validate email" step : 

  1. Hover over the arrow menu where you want to verify an email.
  2. Click ‘+’ ⇒ ‘Actions’ ⇒ ‘Validate email

3.  Open the properties panel and put the email address you want the email validation step to check. 

Notes :

  • The "Email address" can be set with either the actual email address or the variable which contains the email address.

The “Validate email” step is a custom action step which receives the inbox content as a parameter. The inbox parameter will contain an array of all the messages in the inbox, each with a from, to, subject, text, and html fields. 

For example, validating that the subject line of a signup confirmation email can easily be done like so:

Advanced email validation example

Here is an example code for validating the subject and text of an invitation email.

if(messages.length !== 1) {
  throw new Error("Failed to find message in inbox " + emailAddress);

var emailSubject = messages[0].subject;

if(emailSubject !== "You've been added to a project on Testim") {
  throw new Error("Email subject not match " + emailSubject);

var emailText = messages[0].text.replace(/  |\r\n|\n|\r/gm, "");

if(!emailText.includes("Your teammate John has added you to the project 'My Product'")) {
  throw new Error("Email text not include expected text " + emailText);

Did this answer your question?