This plugin allows you to check the status of folders on a mail server, check the number of unread messages and intercept new incoming messages. It also allows you to validate fields of the last message such as subject, sender, body and attachments.
This plugin is designed to be used in conjunction with other plugins to create complete scenarios. For example, to validate that an application is sending mail as a result of another operation such as a REST request.
- Install
-
- Define the mail store server to use
- Define the mail user credentials
- Define the mail store folder to use
- Verify the number of unread emails
- Verify that a new mail is received in a given interval
- Verify the subject of the last email
- Verify the sender of the last email
- Verify the body contents of the last email
- Verify partially the body contents of the last email
- Verify the body contents of the last email against an external file
- Verify the body contents of the last email contains the content of an external file
- Verify the number of attachments of the last email
- Verify that the email contains an attached file with certain name
- Verify the binary content of an attached file
- Verify the text content of an attached file
- Verify the text content of an attach file against the following text
- Delete all emails from a given sender (clean-up operation)
- Delete all emails with a given subject (clean-up operation)
Install
Include the module in the corresponding section.
es.iti.wakamiti:email-wakamiti-plugin:1.2.0
es.iti.wakamiti:email-wakamiti-plugin:1.2.0
<dependency> <groupId>es.iti.wakamiti</groupId> <artifactId>email-wakamiti-plugin</artifactId> <version>1.2.0</version> </dependency>
<dependency> <groupId>es.iti.wakamiti</groupId> <artifactId>email-wakamiti-plugin</artifactId> <version>1.2.0</version> </dependency>
Options
email.address
- Type:
string
required
User's email address, to be used as login credentials.
Example:
email: address: test@localhost
email.password
- Type:
string
required
User password, to be used as login credentials.
Example:
email: password: xjlk4324
email.store.host
- Type:
string
required
Host name or IP address where the mail server store is located.
Example:
email: store: host: imap.gmail.com
email.store.port
- Type:
integer
required
Port for accessing the mail server store (usually varies depending on the protocol).
Example:
email: store: port: 993
email.store.protocol
- Type:
string
required
Protocol used by the mail store.
Example:
email: store: protocol: imap
email.store.folder
- Type:
string
required
Name of the folder to be scanned in the mail store.
Example:
email: store: folder: INBOX
Steps
Define the mail store server to use
the email server at {host}:{port} using the protocol {protocol}
the email server at {host}:{port} using the protocol {protocol}
Parameters:
name | wakamiti type | description |
---|---|---|
host |
text required |
IP or name of the mail store |
port |
integer required |
Port of the mail store (according protocol) |
protocol |
word required |
Protocol of the mail store |
Examples:
Given the email server at 'imap.gmail.com':993 using the protocol imap
Define the mail user credentials
the email user with address {address} and password {password}
the email user with address {address} and password {password}
Parameters:
name | wakamiti type | description |
---|---|---|
address |
text required |
The email address |
password |
text required |
The user password |
Examples:
Given the email user with address 'john@mymail.com' and password 'daDjkl3434S'
Define the mail store folder to use
the email folder {text}
the email folder {text}
Parameters:
name | wakamiti type | description |
---|---|---|
text |
text required |
The name of the mail folder |
Examples:
Given the email folder 'INBOX'
Verify the number of unread emails
(that) the number of unread emails {matcher}
(that) the number of unread emails {matcher}
Parameters:
name | wakamiti type | description |
---|---|---|
matcher |
integer-assertion required |
The validation to apply to the number of unread messages |
Examples:
Given that the number of unread emails is greater than 0
Verify that a new mail is received in a given interval
(that) a new email is received within {sec} seconds
(that) a new email is received within {sec} seconds
Parameters:
name | wakamiti type | description |
---|---|---|
sec |
integer required |
Number of seconds to wait for an incoming message |
Examples:
Then a new email is received within 5 seconds
Verify the subject of the last email
(that) the subject of the email {matcher}
(that) the subject of the email {matcher}
Parameters:
name | wakamiti type | description |
---|---|---|
matcher |
text-assertion required |
The validation to apply to the subject of the email |
Examples:
Then the subject of the email starts with 'Issue opened'
Verify the sender of the last email
(that) the sender of the email {matcher}
(that) the sender of the email {matcher}
Parameters:
name | wakamiti type | description |
---|---|---|
matcher |
text-assertion required |
The validation to apply to the sender of the email |
Examples:
Then the sender of the email is 'support@company.com'
Verify the body contents of the last email
(that) the body of the email is: {data}
(that) the body of the email is: {data}
Parameters:
name | wakamiti type | description |
---|---|---|
data |
document required |
The content to compare |
Examples:
Then the body of the email is:
"""
Hello,
Your issue has been received.
Regards
"""
Verify partially the body contents of the last email
(that) the body of the email contains: {data}
(that) the body of the email contains: {data}
Parameters:
name | wakamiti type | description |
---|---|---|
data |
document required |
The content to compare |
Examples:
Then the body of the email contains:
"""
Your issue has been received.
"""
Verify the body contents of the last email against an external file
(that) the body of the email is the content of the file {file}
(that) the body of the email is the content of the file {file}
Parameters:
name | wakamiti type | description |
---|---|---|
file |
file required |
Path of the file to compare |
Examples:
Then the body of the email is the content of the file 'email.txt'
Verify the body contents of the last email contains the content of an external file
(that) the body of the email contains the content of the file {file}
(that) the body of the email contains the content of the file {file}
Parameters:
name | wakamiti type | description |
---|---|---|
file |
file required |
Path of the file to compare |
Examples:
Then the body of the email contains the content of the file 'email.txt'
Verify the number of attachments of the last email
(that) the number of attachments in the email {matcher}
(that) the number of attachments in the email {matcher}
Parameters:
name | wakamiti type | description |
---|---|---|
matcher |
integer-assertion required |
The validation to apply to the number of attachments |
Examples:
Then the number of attachments in the email is less than 2
Verify that the email contains an attached file with certain name
(that) the email has an attached file whose name {matcher}
(that) the email has an attached file whose name {matcher}
Parameters:
name | wakamiti type | description |
---|---|---|
matcher |
text-assertion required |
The validation to apply to the name of the attached files |
Examples:
Then the email has an attached file whose name is 'attach.txt'
Verify the binary content of an attached file
(that) the email has an attached file with the content of the binary file {file}
(that) the email has an attached file with the content of the binary file {file}
Parameters:
name | wakamiti type | description |
---|---|---|
file |
file required |
Path of the file to compare |
Examples:
Then the email has an attached file with the content of the binary file 'attach.dat'
Verify the text content of an attached file
(that) the email has an attached file with the content of the text file {file}
(that) the email has an attached file with the content of the text file {file}
Parameters:
name | wakamiti type | description |
---|---|---|
file |
file required |
Path of the file to compare |
Examples:
Then the email has an attached file with the content of the text file 'attach.txt'
Verify the text content of an attach file against the following text
(that) the email has an attached file with the following content: {data}
(that) the email has an attached file with the following content: {data}
Parameters:
name | wakamiti type | description |
---|---|---|
data |
document required |
The content to compare |
Examples:
Then the email has an attached file with the following content:
"""
This is an attached content
"""
Delete all emails from a given sender (clean-up operation)
At finish, delete all emails whose sender {matcher}
At finish, delete all emails whose sender {matcher}
Parameters:
name | wakamiti type | description |
---|---|---|
matcher |
text-assertion required |
The validation to apply to the email sender |
Examples:
* At finish, delete all emails whose sender is 'test@localhost'
Delete all emails with a given subject (clean-up operation)
At finish, delete all emails whose subject {matcher}
At finish, delete all emails whose subject {matcher}
Parameters:
name | wakamiti type | description |
---|---|---|
matcher |
text-assertion required |
The validation to apply to the email subject |
Examples:
* At finish, delete all emails whose subject starts with 'Testing'