Access Emails During A Test Flow

How to use Moropo to dynamically access emails sent as part of an app testing flow

Note: this functionality currently only supports email addresses that Moropo dynamically generates during the flow. If you require support for access to pre-existing email addresses then please add your use case as a comment on the Canny post

This guide will show you how to access emails on the simulator as part of a Moropo test run.

Step-by-step Guide

Step 1: Use the ${MOROPO_TEST_EMAIL} variable as the email address in your flow

Moropo will automatically generate and populate this variable with a valid email address. It will be in the format of queue-123@parse.moropo.com

In script mode:

- inputText: ${MOROPO_TEST_EMAIL}

In step mode:

Step 2: Perform an action that sends an email to the inputted address

For example, press a button to trigger email validation or issue a password reset link

Moropo will automatically generate and populate this variable with a valid URL pointing to a secure webpage on Moropo's server.

In script mode:

- openLink: 
    link: ${MOROPO_EMAIL_URL}

In step mode:

Step 4: Wait for the email to arrive

Moropo will check that the email has arrived every 10 seconds. If the email has not arrived then a no email yet message will be displayed. In your test, you should wait to assert that this is not visible before attempting to read the email contents using the step below. Note: Moropo will automatically refresh, there is no need to manually refresh the browser.

In script mode:

- extendedWaitUntil:
    notVisible: "no email yet.*"
    timeout: 60000

In step mode:

Step 5: Copy or assert data in the email

Once the email has been rendered, you can use any command to copy, assert or do anything else with the data in the email.

In the example above, we used the copyTextFrom command with regex to copy the 6-digit verification code using the following command:

- copyTextFrom:
    text: "\\d{6}"

You can paste this into an text input using:

- pasteText

Step 6: Go back to your app

If you need to back to your app, then you can use the following commands.

iOS:

- tapOn:
    id: "breadcrumb"

Android:

- back

Is this secure?

Yes. Although we do encourage you to only use test accounts and non-sensitive data when using the Moropo platform.

We render the email using a secure endpoint that is authenticated using a unique authentication token that is valid only for the duration of the test run.

Can I send multiple emails?

There is no limit on the number of emails you can send to the address during a test run. However, Moropo will only render the most recent email.

If you are sending multiple emails during a test run, you may see your previous email whilst Moropo waits for the new email to arrive. In this case, you should modify your extendedWaitUntil logic to ensure you are reading the correct email.

Does this work with SMS or text messages?

No. This functionality is email only. If you require SMS then please raise a feature request.

Last updated