MailCare module for Codeception
composer require "mailcare/codeception-module-mailcare"
Module for testing receiving emails using MailCare.
- url optional - API url of your mailcare server (default: https://mailix.xyz/api)
- login optional - login of your mailcare server
- password optional - password of your mailcare server
- timeoutInSeconds optional - Waits up to n seconds for an email to be received (default: 30 seconds)
modules:
enabled
- MailCare:
url: 'https://mailix.xyz/api'
login: 'https://mailix.xyz/api'
password: 'https://mailix.xyz/api'
inbox
Filter by inbox ([email protected]).sender
Filter by sender ([email protected]).subject
Filter by subject (Welcome).since
Filter by createdAt (2018-01-19T12:23:27+00:00 or ISO 8601 durations).search
Search by inbox or sender or subject (matching).unread
Filter only by unread (true).favorite
Filter only by favorite (true).
All criterias can be found in the API Documentation of MailCare except for page and limit.
Examples of since
with ISO 8601 durations:
- P1D: one-day duration
- PT1M: one-minute duration (note the time designator, T, that precedes the time value)
Checks that the email count equals expected value. Waits up to $timeout seconds for the given email to be received.
$I->seeEmailCount(2, [
'inbox' => '[email protected]',
'sender' => '[email protected]',
'subject' => 'Welcome John!',
'since' => 'PT2M',
], 30);
param int
$expectedCountparam array
$criteriasparam int
$timeoutInSeconds (optional)
Checks that the given email exists. Waits up to $timeout seconds for the given email to be received.
$I->seeEmail([
'inbox' => '[email protected]',
'sender' => '[email protected]',
'subject' => 'Welcome John!',
'since' => 'PT2M',
], 30);
param array
$criteriasparam int
$timeoutInSeconds (optional)
Opposite to seeEmail.
$I->dontSeeEmail([
'inbox' => '[email protected]',
'since' => 'PT2M',
], 30);
param array
$criteriasparam int
$timeoutInSeconds (optional)
In the last email, grabs all the links Waits up to $timeout seconds for the given email to be received.
$I->grabLinksInLastEmail([
'inbox' => '[email protected]',
'since' => 'PT2M',
], 30);
param array
$criteriasparam int
$timeoutInSeconds (optional)return array
['https://google.fr', 'https://mailcare.io']
In the last email, grabs all the text corresponding to a regex. Waits up to $timeout seconds for the given email to be received.
$I->grabTextInLastEmail('#Password: (?<password>\S+)#', [
'inbox' => '[email protected]',
'subject' => 'Your credentials',
'since' => 'PT2M',
], 30);
param string
$regexparam array
$criteriasparam int
$timeoutInSeconds (optional)return array
matches from preg_match_all