Testim Documentation

Welcome to the Testim documentation. You'll find comprehensive guides to help you get started quickly, example code snippets, and tips for being more productive. You will also find details about advanced features that allow you to customize Testim to fit your environment or special testing conditions. Don't worry, we'll support you if you get stuck. Let's jump right in!

Guides    Changelog

Validate email

Validate sign-up and login flows

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 ‘M’ ⇒ ‘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 can be available in the following scopes:
    • Local - Allow you to pass the emailAddress parameter between steps in the same scope (i.e. export parameter in a group allows you to pass parameters between steps in the same group)
    • Test - Allow you to pass the emailAddress parameter between steps and groups in the same test
    • Suite - Allow you to pass the emailAddress parameter between tests in the same suite

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 ‘M’ ⇒ ‘Actions’ ⇒ ‘Validate email
  1. 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 that receives the inbox content as a parameter. The inbox parameter will contain an array of all the messages in the inbox, each with the following fields:

Field name

Return type

attachments

AttachmentCollection

from

EmailAddress

to

EmailAddressCollection

subject

string

date (time sent)

Date

received_date

Date

message_id

string

headers

InternetMessageHeaderCollection

html

text

string

mail_from

EmailAddress

rcpt_to

EmailAddressCollection

size

number

projectId

string

email

string

expire_at

string

created_at

string

updated_at

string

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

Copy this code from here:

if (messages && messages[0] ){
  return messages[0].subject === "Thank you for signing up";
}
return false;

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);
}

function getLinks(html) {
   var parser = new DOMParser();
   var doc = parser.parseFromString(html, "text/html");
   var linksElements =  Array.from(doc.querySelectorAll("a"));
  return linksElements.map(linkElement => ({text:linkElement.innerText,link:linkElement.getAttribute("href")}));
}

var emailLinks = getLinks(messages[0].html);

Updated 11 days ago

Validate email


Validate sign-up and login flows

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.