@@ -14,18 +14,57 @@ Module for testing receiving emails using [MailCare](https://mailcare.io).
1414
1515### Configuration
1616
17- * url * required* - API url of your mailcare server
17+ * url * optional* - API url of your mailcare server (default: https://mailix.xyz/api )
18+ * login * optional* - login of your mailcare server
19+ * password * optional* - password of your mailcare server
20+ * timeoutInSeconds * optional* - Waits up to n seconds for an email to be received (default: 30 seconds)
1821
1922#### Example
2023```
2124modules:
2225 enabled
2326 - MailCare:
2427 url: 'https://mailix.xyz/api'
28+ login: 'https://mailix.xyz/api'
29+ password: 'https://mailix.xyz/api'
2530```
2631
32+ ### Criterias
33+
34+ * ` inbox ` Filter by inbox (test@example.com ).
35+ * ` sender ` Filter by sender (test@example.com ).
36+ * ` subject ` Filter by subject (Welcome).
37+ * ` since ` Filter by createdAt (2018-01-19T12:23:27+00:00 or ISO 8601 durations).
38+ * ` search ` Search by inbox or sender or subject (matching).
39+ * ` unread ` Filter only by unread (true).
40+ * ` favorite ` Filter only by favorite (true).
41+
42+ All criterias can be found in the [ API Documentation of MailCare] ( https://mailcare.docs.apiary.io ) except for page and limit.
43+
44+ Examples of ` since ` with ISO 8601 durations:
45+ * P1D: one-day duration
46+ * PT1M: one-minute duration (note the time designator, T, that precedes the time value)
47+
2748### Actions
2849
50+ #### seeEmailCount
51+
52+ Checks that the email count equals expected value.
53+ Waits up to $timeout seconds for the given email to be received.
54+
55+ ``` php
56+ $I->seeEmailCount(2, [
57+ 'inbox' => 'john@example.org',
58+ 'sender' => 'no-reply@company.com',
59+ 'subject' => 'Welcome John!',
60+ 'since' => 'PT2M',
61+ ], 30);
62+ ```
63+
64+ * ` param int ` $expectedCount
65+ * ` param array ` $criterias
66+ * ` param int ` $timeoutInSeconds (optional)
67+
2968#### seeEmail
3069
3170Checks that the given email exists.
@@ -36,10 +75,58 @@ $I->seeEmail([
3675 'inbox' => 'john@example.org',
3776 'sender' => 'no-reply@company.com',
3877 'subject' => 'Welcome John!',
39- 'since' => 'P2M ',
78+ 'since' => 'PT2M ',
4079], 30);
4180```
4281
4382 * ` param array ` $criterias
44- * ' param int` $timeout (seconds )
83+ * ` param int ` $timeoutInSeconds (optional )
4584
85+ #### dontSeeEmail
86+
87+ Opposite to seeEmail.
88+
89+ ``` php
90+ $I->dontSeeEmail([
91+ 'inbox' => 'john@example.org',
92+ 'since' => 'PT2M',
93+ ], 30);
94+ ```
95+
96+ * ` param array ` $criterias
97+ * ` param int ` $timeoutInSeconds (optional)
98+
99+ #### grabLinksInLastEmail
100+
101+ In the last email, grabs all the links
102+ Waits up to $timeout seconds for the given email to be received.
103+
104+ ``` php
105+ $I->grabLinksInLastEmail([
106+ 'inbox' => 'john@example.org',
107+ 'since' => 'PT2M',
108+ ], 30);
109+ ```
110+
111+ * ` param array ` $criterias
112+ * ` param int ` $timeoutInSeconds (optional)
113+ * ` return array ` [ 'https://google.fr ', 'https://mailcare.io ']
114+
115+
116+ #### grabTextInLastEmail
117+
118+ In the last email, grabs all the text corresponding to a regex.
119+ Waits up to $timeout seconds for the given email to be received.
120+
121+ ``` php
122+ $I->grabTextInLastEmail('#Password: (?<password >\S+)#', [
123+ 'inbox' => 'john@example.org',
124+ 'subject' => 'Your credentials',
125+ 'since' => 'PT2M',
126+ ], 30);
127+ ```
128+
129+ * ` param string ` $regex
130+ * ` param array ` $criterias
131+ * ` param int ` $timeoutInSeconds (optional)
132+ * ` return array ` matches from preg_match_all
0 commit comments