Dealing with Emails

Dealing with Emails

testRigor supports sending, receiving, and validating emails. You can send emails to any domain, but built-in email validations require the recipient to use @testrigor-mail.com.

Email Workflow

Specifying a sender (from) address is optional. If no sender is specified, testRigor automatically uses [email protected].
Send or trigger an email → Validate that the email was received
send email to "[email protected]" with subject "Test" and body "Hi, this is a test"
check that email from "[email protected]" is delivered
To specify a sender:
send email from "[email protected]" to "[email protected]" with subject "Test" and body "Hi, this is a test"

Unique Email Generation

When receiving emails in a test, it is best practice to generate a unique email address. This prevents emails from different test cases or executions from overlapping.
This generates a unique address ending in @testrigor-mail.com and stores it as newEmail.
generate unique email and save it as "newEmail"
You can also customize the generated address using a template:
generate from template "*********@testrigor-mail.com" and save it as "newEmail"
Or combine a static name with a dynamic value, such as a timestamp:
save string with parameters "username${nowUnixTime}@testrigor-mail.com" as "newEmail"

Email Validation

Emails can be validated using information such as the recipient, sender, subject, or expected number of emails.
Checking email will also automatically open the email in a new tab and render it as an HTML page.
check that email to saved value "newEmail" was received
check that email to saved value "newEmail" from "[email protected]" and "Confirm" in subject was received
check that email to saved value "newEmail" and "<regular expression>" in subject was received
If more than one email is sent to the same address, validations need to mention either the exact number or that more than one email was sent. Otherwise, the validation will fail.
check that one or more emails to "[email protected]" and "Confirm" in subject were delivered
check that two emails to "[email protected]" and "Confirm" in subject were delivered

If multiple emails match a validation that expects only one, testRigor will report an error, but each email will still open in a separate tab. You can switch between them using switch to tab "1", switch to tab "2", etc. The original webpage will remain in its existing tab, usually tab “1”, unless additional tabs were opened beforehand.

You can also validate that an email was not sent.
check that email from "[email protected]" was not delivered
Once an email has been successfully validated, it is deleted from the mailbox. To validate it again, the email must be resent.

Email attachments and saved values

testRigor also supports attachments, both from a URL as well as from a saved value (from Test Data section in the main menu). Both “from” and “to” addresses can be filled in from a saved value as well.
send email from "senderEmail" to "recepientEmail" with  subject "Test", and  body "Hi, this is a test", and attachment from saved value "Sample File"
send email from "[email protected]" to "[email protected]" with  subject "Test", and  body "Hi, this is a test", and attachment "http://online.com/file/name.pdf"

Rendering and Interacting with Emails

Since emails are rendered as HTML pages, you can interact with and validate their contents using regular testRigor commands.

check "message-subject" contains "Test"

Useful email element IDs include:
“message-froms” – a list of “From” addresses (usually one address)
“message-subject” – subject line
“message-date” – message sent date and time in Pacific Time zone.
“message-tos” – a list of “To” addresses
“message-ccs” – a list of “CC” addresses
“message-bccs” – a list of “BCC” addresses
“message-reply-to” – “Reply To” address
“message-text” – the message text
“message-attachments” – a list of attachments (file names only)

If multiple emails are rendered, each opens in a separate tab. You can switch between them using:

switch to tab "1"
switch to tab "2"

Rendering emails on mobile devices

When running a test case on a mobile device, emails are still rendered in HTML in a desktop web browser by default. If you are executing a test case on a mobile device and need to render the message on that device (e.g., when validating a sign up test case, or just need to validate how the email will look like on a mobile device), you can specify rendering on the mobile device:
check that email to "[email protected]" and "Confirm" in subject was received and show in mobile

Notes:

  1. The wait time in which the email is expected to arrive can be adjusted in Settings->Speed optimizations->Timeouts and delays->Email maximum wait time, seconds:.
  2. An email can be sent to multiple recipients by adding “and”:
    send email to saved value "newEmail" and saved value "newEmail_2" with subject "Test" and body "Hi"
  3. All messages sent to @testrigor-mail.com will be deleted after 24 hours, whether checked or not.

Test your knowledge

The email will not be sent.
The address will default to “[email protected]”
The system will throw an error.
The “to” address will be used as the “from” address.
check that email to “[email protected]” and “Confirm” in subject was received on this device
mobile view: check that email to “[email protected]” and “Confirm” in subject was received
check that email to “[email protected]” and “Confirm” in subject was received and show in mobile
check that email to “[email protected]” and “Confirm” in subject was received
check that email to saved value “newEmail” is not successful from “[email protected]”
check that email from “[email protected]” did not send
verify mail is not sent to “[email protected]”
check that email from “[email protected]” was not delivered