Skip to main content

COMM::EMAIL

Automate email reception and extract its content.

Properties

PropertyDescriptionTypeRequired
contactEmail address to receive emails (e.g., user@example.com)stringtrue
withinTime limit in milliseconds to receive the email from the test start time. Defaults to 5000ms.longfalse

Output

📝 Note: Accessible using context["last_output"]

KeyDescriptionType
subjectThe subject line of the received emailstring
bodyThe body content of the emailstring
timeTakenTime taken to receive the email, in millisecondslong
errorError message if the email is not received within the specified timestring

Example

emailTests.yml
tests:
receiveEmailTest:
tasks:
- expect: expects.receiveEmail
validate: scripts.validateEmail

expects:
receiveEmail:
type: COMM::EMAIL
props:
contact: <email_address>
within: <time_in_ms>

scripts:
validateEmail: |
assert context["last_output"]["subject"] == "<expected_subject>"
assert context["last_output"]["body"].contains("<expected_content>")

Example Output

{
"subject": "Welcome to Our Service",
"body": "Hello, thank you for registering with us.",
"timeTaken": 2000,
"error": null
}