e2e-mail 0.0.17 โ 0.0.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +88 -8
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
# e2e-mail
|
|
2
1
|
<p align="center">
|
|
3
|
-
<img width="256" height="256" alt="
|
|
2
|
+
<img width="256" height="256" alt="Screenshot 2026-06-19 at 1 16 02โฏAM" src="https://github.com/user-attachments/assets/171830fc-c2b9-4d94-ab6e-bda89c033364" />
|
|
4
3
|
</p>
|
|
5
4
|
|
|
6
5
|
<h2 align="center">
|
|
@@ -23,14 +22,95 @@ By leveraging free temporary email infrastructure behind a developer-friendly AP
|
|
|
23
22
|
|
|
24
23
|
Whether you're testing account verification flows, password resets, magic links, invitations, or transactional emails, E2E Mail helps you validate real email delivery inside your end-to-end tests with just a few lines of code.
|
|
25
24
|
|
|
26
|
-
|
|
25
|
+
# Usage
|
|
27
26
|
|
|
28
|
-
|
|
27
|
+
```bash
|
|
28
|
+
npm i e2e-mail
|
|
29
|
+
```
|
|
29
30
|
|
|
30
|
-
|
|
31
|
+
### Cypress
|
|
31
32
|
|
|
32
|
-
|
|
33
|
+
```ts
|
|
34
|
+
import "e2e-mail/cypress"; // Or globally wherever you import commands
|
|
33
35
|
|
|
34
|
-
|
|
36
|
+
describe("Mail.tm Integration", () => {
|
|
37
|
+
it("fetches the most recent and relevant message", () => {
|
|
38
|
+
/* STEP 1 */
|
|
39
|
+
cy.initializeMailbox("someusername@<valid-domain>", "Pass1234");
|
|
35
40
|
|
|
36
|
-
|
|
41
|
+
/* Test script continues until app sends email */
|
|
42
|
+
|
|
43
|
+
/* STEP 2 */
|
|
44
|
+
cy.searchMailbox(
|
|
45
|
+
{
|
|
46
|
+
subject: "", // Optional - Subject Filter
|
|
47
|
+
recipient: "", // Optional - Recipient Filter
|
|
48
|
+
sender: "", // Optional - Sender Filter
|
|
49
|
+
createdAfter: "", // - Optional Min Date Filter
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
timeout: 15000 // Optional - How long to poll for a match
|
|
53
|
+
autoDelete: false // Optional - Delete after fetching (Defaults true)
|
|
54
|
+
},
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
/* STEP 3 (OPTIONAL) */
|
|
58
|
+
cy.removeMailbox()
|
|
59
|
+
|
|
60
|
+
/* Renders email DOM accepting assertions and interactions */
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Playwright
|
|
66
|
+
|
|
67
|
+
```ts
|
|
68
|
+
import { test, expect } from "e2e-mail/playwright";
|
|
69
|
+
|
|
70
|
+
test.describe("Mail.tm Integration", () => {
|
|
71
|
+
test("fetches the most recent and relevant message", async ({
|
|
72
|
+
initializeMailbox,
|
|
73
|
+
searchMailbox,
|
|
74
|
+
removeMailbox
|
|
75
|
+
}) => {
|
|
76
|
+
/* STEP 1 */
|
|
77
|
+
await initializeMailbox("someusername@<valid-domain>", "Pass1234");
|
|
78
|
+
|
|
79
|
+
/* Test script continues until app sends email */
|
|
80
|
+
|
|
81
|
+
/* STEP 2 */
|
|
82
|
+
await searchMailbox(
|
|
83
|
+
{
|
|
84
|
+
subject: "", // Optional - Subject Filter
|
|
85
|
+
recipient: "", // Optional - Recipient Filter
|
|
86
|
+
sender: "", // Optional - Sender Filter
|
|
87
|
+
createdAfter: "", // - Optional Min Date Filter
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
timeout: 15000 // Optional - How long to poll for a match
|
|
91
|
+
autoDelete: false // Optional - Delete after fetching (Defaults true)
|
|
92
|
+
},
|
|
93
|
+
);
|
|
94
|
+
|
|
95
|
+
/* STEP 3 (OPTIONAL) */
|
|
96
|
+
await removeMailbox()
|
|
97
|
+
|
|
98
|
+
/* Renders email DOM accepting assertions and interactions */
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
That's it... Seriously!
|
|
104
|
+
|
|
105
|
+
# Tips
|
|
106
|
+
|
|
107
|
+
### I have multiple tests sharing an inbox and want to uniquely identify their emails.
|
|
108
|
+
|
|
109
|
+
Email subaddressing is supported here. Add your unique identifier to your email like `test+<any-string-identifier>@example.com` and then
|
|
110
|
+
|
|
111
|
+
```ts
|
|
112
|
+
searchMailbox({
|
|
113
|
+
recipient: "test+<any-string-identifier>@example.com",
|
|
114
|
+
// ...additional filters
|
|
115
|
+
});
|
|
116
|
+
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "e2e-mail",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.18",
|
|
4
4
|
"description": "A zero-config solution for testing email in major testing frameworks.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"@playwright/test": "^1.49.0",
|
|
62
62
|
"@types/node": "^25.9.3",
|
|
63
63
|
"cypress": "^15.17.0",
|
|
64
|
-
"e2e-mail": "^0.0.
|
|
64
|
+
"e2e-mail": "^0.0.18",
|
|
65
65
|
"openapi-typescript": "^7.13.0",
|
|
66
66
|
"tsx": "^4.22.4",
|
|
67
67
|
"typescript": "^5.9.0",
|