COMM::EMAIL
Automate email reception and extract its content.
Properties
Property | Description | Type | Required |
---|---|---|---|
contact | Email address to receive emails (e.g., user@example.com) | string | true |
within | Time limit in milliseconds to receive the email from the test start time. Defaults to 5000ms. | long | false |
Output
📝 Note: Accessible using
context["last_output"]
Key | Description | Type |
---|---|---|
subject | The subject line of the received email | string |
body | The body content of the email | string |
timeTaken | Time taken to receive the email, in milliseconds | long |
error | Error message if the email is not received within the specified time | string |
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
}