e2e-mail 0.0.17 โ†’ 0.0.19

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.
Files changed (2) hide show
  1. package/README.md +120 -8
  2. 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="E2E Mail Logo" src="https://github.com/user-attachments/assets/7954e1d3-2be0-46f0-8c80-194b82bc0156" />
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,127 @@ 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
- ### Why E2E Mail?
25
+ # Usage
27
26
 
28
- ๐Ÿ†“ Free to use
27
+ ```bash
28
+ npm i e2e-mail
29
+ ```
29
30
 
30
- ๐Ÿงช Built for automated testing
31
+ ### Overview
32
+ E2E Mail exposes a few core E2E functions:
33
+ ```ts
34
+ initializeMailbox()
35
+ ```
36
+ Creates a new, free mailbox or logs into an existing mailbox. The email passed here requires a valid domain. **@web-library.net** is the current, known valid domain, but that may change. This command will validate the email domain you pass and suggest valid alternatives in logging if invalid.
31
37
 
32
- ๐Ÿ”„ Works with major E2E frameworks
33
38
 
34
- ๐Ÿ“ฌ Real inboxes for real email flows
39
+ ```ts
40
+ searchMailbox()
41
+ ```
42
+ Gets the most recent mailbox item. Filters can be combined to narrow your search even further. This command has been adapted in the E2E implementations to also render the email DOM directly into the running test, allowing you to selecte and assert in your chosen E2E framework like any other page.
35
43
 
36
- Email testing shouldn't require a subscription. It should just work.
44
+
45
+ ```ts
46
+ removeMailbox()
47
+ ```
48
+ Deletes the account. This is strongly suggested for signup flows where accounts are created programmatically and reuse is not intended (e.g. include a uniqe ID or timestamp). This helps maintain good citizenship of the free, backing email infrastructure.
49
+
50
+ ### Cypress
51
+
52
+ ```ts
53
+ import "e2e-mail/cypress"; // Or globally wherever you import commands
54
+
55
+ describe("Mail.tm Integration", () => {
56
+ it("fetches the most recent and relevant message", () => {
57
+ /* STEP 1 */
58
+ cy.initializeMailbox("someusername@<valid-domain>", "Pass1234");
59
+
60
+ /* Test script continues until app sends email */
61
+
62
+ /* STEP 2 */
63
+ cy.searchMailbox(
64
+ {
65
+ subject: "", // Optional - Subject Filter
66
+ recipient: "", // Optional - Recipient Filter
67
+ sender: "", // Optional - Sender Filter
68
+ createdAfter: "", // - Optional Min Date Filter
69
+ },
70
+ {
71
+ timeout: 15000 // Optional - How long to poll for a match
72
+ autoDelete: false // Optional - Delete after fetching (Defaults true)
73
+ },
74
+ );
75
+
76
+ /* STEP 3 (OPTIONAL) */
77
+ cy.removeMailbox()
78
+
79
+ /* Renders email DOM accepting assertions and interactions */
80
+ });
81
+ });
82
+ ```
83
+
84
+ ### Playwright
85
+
86
+ ```ts
87
+ import { test, expect } from "e2e-mail/playwright";
88
+
89
+ test.describe("Mail.tm Integration", () => {
90
+ test("fetches the most recent and relevant message", async ({
91
+ initializeMailbox,
92
+ searchMailbox,
93
+ removeMailbox
94
+ }) => {
95
+ /* STEP 1 */
96
+ await initializeMailbox("someusername@<valid-domain>", "Pass1234");
97
+
98
+ /* Test script continues until app sends email */
99
+
100
+ /* STEP 2 */
101
+ await searchMailbox(
102
+ {
103
+ subject: "", // Optional - Subject Filter
104
+ recipient: "", // Optional - Recipient Filter
105
+ sender: "", // Optional - Sender Filter
106
+ createdAfter: "", // - Optional Min Date Filter
107
+ },
108
+ {
109
+ timeout: 15000 // Optional - How long to poll for a match
110
+ autoDelete: false // Optional - Delete after fetching (Defaults true)
111
+ },
112
+ );
113
+
114
+ /* STEP 3 (OPTIONAL) */
115
+ await removeMailbox()
116
+
117
+ /* Renders email DOM accepting assertions and interactions */
118
+ });
119
+ });
120
+ ```
121
+
122
+ That's it... Seriously!
123
+
124
+ # Tips
125
+
126
+ ### I have multiple tests sharing an inbox and want to uniquely identify their emails.
127
+
128
+ Email subaddressing is supported here. Add your unique identifier to your email like `test+<any-string-identifier>@example.com` and then:
129
+
130
+ ```ts
131
+ searchMailbox({
132
+ recipient: "test+<any-string-identifier>@example.com",
133
+ // ...additional filters
134
+ });
135
+ ```
136
+
137
+ ### My testing framework isn't in here
138
+ Cypress and Playwright currently have first-class support. However, the core client is also provided if you'd prefer to build your own framework extensions or plugins:
139
+
140
+ ```ts
141
+ import { E2EMailClient } from "e2e-mail";
142
+
143
+ const client = new E2EMailClient('test@example.com', "Pass1234");
144
+
145
+ client.initialize()
146
+ client.pollMessages()
147
+ client.dispose()
148
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "e2e-mail",
3
- "version": "0.0.17",
3
+ "version": "0.0.19",
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.17",
64
+ "e2e-mail": "^0.0.19",
65
65
  "openapi-typescript": "^7.13.0",
66
66
  "tsx": "^4.22.4",
67
67
  "typescript": "^5.9.0",