Endtest

Endtest

›Web Tests

Web Tests

  • How to create Web Tests
  • Finding elements in Web Applications
  • How to execute Web Tests
  • Assertions for Web Tests
  • IF Statements for Web Tests
  • Web Applications with restricted access
  • How to test in iframes
  • How to test in multiple tabs
  • How to test File Uploads
  • How to test File Downloads
  • How to test Emails
  • How to test PDF files
  • How to test Chrome Extensions
  • Dealing with reCAPTCHA
  • Dealing with Dynamic Locators
  • Dealing with Canvas Elements
  • Performing a Drag and Drop
  • Execute JavaScript
  • Testing WebRTC Applications
  • How to scroll in Web Tests
  • How to test Checkboxes
  • How to test Dropdowns
  • Dealing with Sessions
  • Web Crawler
  • Export Web Tests
  • Migrating from Selenium

Mobile Tests

  • How to create Mobile Tests
  • Finding elements in Mobile Applications
  • How to execute Mobile Tests
  • Assertions for Mobile Tests
  • IF Statements for Mobile Tests
  • How to scroll in Mobile Tests
  • Performing Complex Gestures

Advanced

  • Variables
  • Waits
  • Endtest API
  • Scheduler
  • Drive
  • Adding Collaborators
  • Computer Vision
  • Importing Test Cases
  • Using Loops
  • Data-driven Testing
  • Send API Requests
  • Read SMS
  • Execute SQL queries
  • Self-Healing Tests
  • Email Notifications
  • Slack Notifications
  • PagerDuty Notifications
  • Webhook Notifications
  • Automatic Backup
  • Advanced Settings
  • Multiple environments
  • How to stop a test
  • Utilities
  • Utilities API
  • Team
  • On-Premises

Integrations

  • Atlassian Jira
  • Slack
  • PagerDuty
  • Microsoft Teams
  • Mattermost
  • Jenkins
  • GitHub
  • Azure DevOps
  • GitLab
  • TeamCity
  • CircleCI
  • TravisCI
  • Bitbucket
  • Heroku
  • Bamboo Server
  • Test Case Management
  • SSO
  • BrowserStack
  • Sauce Labs

How to test Emails

Introduction

The majority of Web Applications send emails when certain actions are triggered.

In some cases, you may want access to those emails during your tests to confirm their delivery, check their contents, or extract information to use within your test.

For example, you can test registering a user account, receiving a verification email, clicking a link to verify the email address, and asserting that the email has been verified.

You can use our Endtest Mailbox to access emails.

The way it works is similar to a disposable email service.

It can be accessed manually or in an automated test, through the UI or with a script.

1. Access the Endtest Mailbox through the UI

Steps

  1. Choose an email address that has the endtest-mail.io domain.
  2. Make sure your email gets sent to that email address.
  3. Add a Pause of 30 seconds or a Wait Until step.
  4. Access the Endtest Mailbox for that email address with a Go to URL step.

Example:

Let's suppose you picked the following email address: bruce.wayne8@endtest-mail.io

You can access the Inbox for that email address by going to the following URL:

https://app.endtest.io/mailbox?email=bruce.wayne@endtest-mail.io


The email address doesn't need to be pre-registered on our side.

You can even generate a random string and prepend it to the @endtest-mail.io string.

Or you can generate a random email address with the Random Email option from Set Variable action.

You can also open the Endtest Mailbox in a new browser tab, by using the Open new tab option from the Miscellaneous action.

In order to switch back to your initial browser tab, you can use the Switch to previous tab option from the Miscellaneous action.

If you're not sure how long it takes for your application to deliver the email, you can add a Wait Until step that will also automatically refresh the page at certain intervals.

The Wait Until option can be found in the Miscellaneous action.

2. Access the Endtest Mailbox from a script

Steps

  1. Choose an email address that has the endtest-mail.io domain.
  2. Make sure your email gets sent to that email address.
  3. Add a pause of 30 seconds in your script.
  4. Access the Endtest Mailbox in your script by sending a GET request to the https://app.endtest.io/mailbox endpoint with the following paramters: email and format.

Currently, the only option is to fetch the emails in JSON format by using format=json.

Let's suppose you picked the following email address: bruce.wayne8@endtest-mail.io

You can access the emails for that address with the following GET request:

https://app.endtest.io/mailbox?email=bruce.wayne@endtest-mail.io&format=json

The JSON response will have the following format:

[
  {
    fromName: '',
    fromAddress: '',
    toAddress: '',
    subject: '',
    html: '',
    timestamp: ''
  },
  {
    fromName: '',
    fromAddress: '',
    toAddress: '',
    subject: '',
    html: '',
    timestamp: ''
  }
]

The email address doesn't need to be pre-registered on our side.

You can even generate a random string and prepend it to the @endtest-mail.io string.

3. Delete all the emails sent to an email address

Steps

Access the Endtest Mailbox in your test or script by sending a GET request to the https://app.endtest.io/mailbox endpoint with the following parameters: email and action=delete.

Let's suppose you picked the following email address: bruce.wayne8@endtest-mail.io

You can delete the emails for that address with the following GET request:

https://app.endtest.io/mailbox?email=bruce.wayne@endtest-mail.io&action=delete

4. Using email subaddress

Steps

An email subaddress refers to the practice of adding a plus sign (+) and additional characters to the local part of an email address to create variations that still deliver to the same inbox.

For example, in the email batman+label@endtest-mail.io, +label is a form of subaddressing.

If you send separate emails to batman+1@endtest-mail.io and batman+2@endtest-mail.io, they will still be accessible in the Endtest Mailbox. Each email will be delivered to its own subaddressed variation without needing any special parameters.

However, if you include the subaddress=true parameter, you can view all emails addressed to the base email, like batman@endtest-mail.io, in one mailbox, regardless of the subaddress:

https://app.endtest.io/mailbox?email=bruce.wayne@endtest-mail.io&subaddress=true&from=alerts@gotham.com

For Security reasons, it's mandatory to also add the from parameter when using subaddress=true.

The value provided in the from parameter needs to match the email address from which those emails were sent.

And the subaddress=true parameter can also be used to get the emails in JSON format or to delete the emails.

When accessing emails in the Endtest Mailbox, you should add a Wait Until step or a 30 second Pause step before the Go to URL step, to allow your web application to have enough time to send the email.

Emails sent to this service are technically public and can be accessed by anyone with knowledge of the username being used.

While using a dynamic username provides some level of privacy, you should avoid inclusion of sensitive data in your emails when using this service.

Please note that the emails will be automatically deleted after 7 days.

Starting from June 4 2020, Endtest Mailbox will only work with endtest-mail.io emails.

You can also send emails with the Endtest Utilities.

← How to test File DownloadsHow to test PDF files →
  • Introduction
  • 1. Access the Endtest Mailbox through the UI
    • Steps
  • 2. Access the Endtest Mailbox from a script
    • Steps
  • 3. Delete all the emails sent to an email address
    • Steps
  • 4. Using email subaddress
    • Steps
© Endtest Inc.