e2e-mail 0.0.19 → 0.0.20
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/dist/cypress/cypress.d.ts.map +1 -1
- package/dist/cypress.js +26 -22
- package/dist/cypress.js.map +1 -1
- package/dist/playwright/playwright.d.ts +4 -0
- package/dist/playwright/playwright.d.ts.map +1 -1
- package/dist/playwright.js +27 -25
- package/dist/playwright.js.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cypress.d.ts","sourceRoot":"","sources":["../../src/cypress/cypress.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"cypress.d.ts","sourceRoot":"","sources":["../../src/cypress/cypress.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE1E,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,OAAO,CAAC;QAChB,UAAU,SAAS;YACjB;;;;eAIG;YACH,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;YAEtE;;;;eAIG;YACH,aAAa,CACX,OAAO,CAAC,EAAE,aAAa,EACvB,OAAO,CAAC,EAAE,cAAc,GACvB,SAAS,CAAC,IAAI,CAAC,CAAC;YAEnB;;eAEG;YACH,aAAa,IAAI,SAAS,CAAC,IAAI,CAAC,CAAC;SAClC;KACF;CACF"}
|
package/dist/cypress.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import { E2EMailClient as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { E2EMailClient as r } from "./core/mailtm/index.js";
|
|
2
|
+
Cypress.Commands.add("initializeMailbox", (i, e) => {
|
|
3
|
+
cy.log(`Initializing mailbox ${i}`), cy.then(async () => {
|
|
4
|
+
const t = new r(i, e);
|
|
5
|
+
await t.initialize(), cy.wrap(t, { log: !1 }).as("mailClient");
|
|
6
|
+
});
|
|
5
7
|
});
|
|
6
8
|
Cypress.Commands.add("removeMailbox", () => {
|
|
7
|
-
cy.then(() => {
|
|
9
|
+
cy.get("@mailClient").then(async (i) => {
|
|
8
10
|
if (!i)
|
|
9
11
|
throw new Error(
|
|
10
12
|
"Mailbox client not initialized. Call cy.initializeMailbox() first."
|
|
@@ -12,23 +14,25 @@ Cypress.Commands.add("removeMailbox", () => {
|
|
|
12
14
|
return i.dispose();
|
|
13
15
|
});
|
|
14
16
|
});
|
|
15
|
-
Cypress.Commands.add("searchMailbox", (
|
|
17
|
+
Cypress.Commands.add("searchMailbox", (i, e = {}) => {
|
|
16
18
|
const {
|
|
17
|
-
timeout:
|
|
18
|
-
autoDelete:
|
|
19
|
-
} =
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
19
|
+
timeout: t = Cypress.config().defaultCommandTimeout ?? 4e3,
|
|
20
|
+
autoDelete: s
|
|
21
|
+
} = e;
|
|
22
|
+
cy.get("@mailClient", { timeout: t + 2e3 }).then(
|
|
23
|
+
(n) => cy.then({ timeout: t + 2e3 }, async () => {
|
|
24
|
+
if (!n)
|
|
25
|
+
throw new Error(
|
|
26
|
+
"Mailbox client not initialized. Call cy.initializeMailbox() first."
|
|
27
|
+
);
|
|
28
|
+
const a = await n.pollMessages(i, {
|
|
29
|
+
timeout: t,
|
|
30
|
+
autoDelete: s
|
|
31
|
+
}), o = Array.isArray(a.html) ? a.html[0] : a.html;
|
|
32
|
+
o && cy.document().then((l) => {
|
|
33
|
+
l.open(), l.write(String(o)), l.close();
|
|
34
|
+
});
|
|
35
|
+
})
|
|
36
|
+
);
|
|
33
37
|
});
|
|
34
38
|
//# sourceMappingURL=cypress.js.map
|
package/dist/cypress.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cypress.js","sources":["../src/cypress/cypress.ts"],"sourcesContent":["import { E2EMailClient } from \"../core/mailtm\";\nimport type { PollingOptions, SearchFilters } from \"../core/mailtm/types\";\n\
|
|
1
|
+
{"version":3,"file":"cypress.js","sources":["../src/cypress/cypress.ts"],"sourcesContent":["import { E2EMailClient } from \"../core/mailtm\";\nimport type { PollingOptions, SearchFilters } from \"../core/mailtm/types\";\n\ndeclare global {\n namespace Cypress {\n interface Chainable {\n /**\n * Initialize mailbox session\n * @param address Email address\n * @param password Account password\n */\n initializeMailbox(address: string, password: string): Chainable<void>;\n\n /**\n * Get most recent inbox match for an existing or new mail account\n * @param filters Optional search filters\n * @param options Configuration for message polling\n */\n searchMailbox(\n filters?: SearchFilters,\n options?: PollingOptions,\n ): Chainable<void>;\n\n /**\n * Delete the account mailbox and all its emails from the server\n */\n removeMailbox(): Chainable<void>;\n }\n }\n}\n\nCypress.Commands.add(\"initializeMailbox\", (address, password) => {\n cy.log(`Initializing mailbox ${address}`);\n\n cy.then(async () => {\n const client = new E2EMailClient(address, password);\n await client.initialize();\n\n cy.wrap(client, { log: false }).as(\"mailClient\");\n });\n});\n\nCypress.Commands.add(\"removeMailbox\", () => {\n cy.get<E2EMailClient>(\"@mailClient\").then(async (client) => {\n if (!client) {\n throw new Error(\n \"Mailbox client not initialized. Call cy.initializeMailbox() first.\",\n );\n }\n\n return client.dispose();\n });\n});\n\nCypress.Commands.add(\"searchMailbox\", (filters, options = {}) => {\n const {\n timeout = Cypress.config().defaultCommandTimeout ?? 4000,\n autoDelete,\n } = options;\n\n // Get most recent match\n cy.get<E2EMailClient>(\"@mailClient\", { timeout: timeout + 2000 }).then(\n (client) => {\n return cy.then({ timeout: timeout + 2000 }, async () => {\n if (!client) {\n throw new Error(\n \"Mailbox client not initialized. Call cy.initializeMailbox() first.\",\n );\n }\n\n const message = await client.pollMessages(filters, {\n timeout,\n autoDelete,\n });\n\n const html = Array.isArray(message.html)\n ? message.html[0]\n : message.html;\n\n // Write HTML to Cypress DOM\n if (html) {\n cy.document().then((doc) => {\n doc.open();\n doc.write(String(html));\n doc.close();\n });\n }\n });\n },\n );\n});\n"],"names":["address","password","client","E2EMailClient","filters","options","timeout","autoDelete","message","html","doc"],"mappings":";AA+BA,QAAQ,SAAS,IAAI,qBAAqB,CAACA,GAASC,MAAa;AAC/D,KAAG,IAAI,wBAAwBD,CAAO,EAAE,GAExC,GAAG,KAAK,YAAY;AAClB,UAAME,IAAS,IAAIC,EAAcH,GAASC,CAAQ;AAClD,UAAMC,EAAO,WAAA,GAEb,GAAG,KAAKA,GAAQ,EAAE,KAAK,IAAO,EAAE,GAAG,YAAY;AAAA,EACjD,CAAC;AACH,CAAC;AAED,QAAQ,SAAS,IAAI,iBAAiB,MAAM;AAC1C,KAAG,IAAmB,aAAa,EAAE,KAAK,OAAOA,MAAW;AAC1D,QAAI,CAACA;AACH,YAAM,IAAI;AAAA,QACR;AAAA,MAAA;AAIJ,WAAOA,EAAO,QAAA;AAAA,EAChB,CAAC;AACH,CAAC;AAED,QAAQ,SAAS,IAAI,iBAAiB,CAACE,GAASC,IAAU,OAAO;AAC/D,QAAM;AAAA,IACJ,SAAAC,IAAU,QAAQ,OAAA,EAAS,yBAAyB;AAAA,IACpD,YAAAC;AAAA,EAAA,IACEF;AAGJ,KAAG,IAAmB,eAAe,EAAE,SAASC,IAAU,IAAA,CAAM,EAAE;AAAA,IAChE,CAACJ,MACQ,GAAG,KAAK,EAAE,SAASI,IAAU,IAAA,GAAQ,YAAY;AACtD,UAAI,CAACJ;AACH,cAAM,IAAI;AAAA,UACR;AAAA,QAAA;AAIJ,YAAMM,IAAU,MAAMN,EAAO,aAAaE,GAAS;AAAA,QACjD,SAAAE;AAAA,QACA,YAAAC;AAAA,MAAA,CACD,GAEKE,IAAO,MAAM,QAAQD,EAAQ,IAAI,IACnCA,EAAQ,KAAK,CAAC,IACdA,EAAQ;AAGZ,MAAIC,KACF,GAAG,SAAA,EAAW,KAAK,CAACC,MAAQ;AAC1B,QAAAA,EAAI,KAAA,GACJA,EAAI,MAAM,OAAOD,CAAI,CAAC,GACtBC,EAAI,MAAA;AAAA,MACN,CAAC;AAAA,IAEL,CAAC;AAAA,EACH;AAEJ,CAAC;"}
|
|
@@ -3,10 +3,14 @@ import { PollingOptions, SearchFilters } from '../core/mailtm/types';
|
|
|
3
3
|
export type MailFixtures = {
|
|
4
4
|
/**
|
|
5
5
|
* Initialize mailbox session
|
|
6
|
+
* @param address Email address
|
|
7
|
+
* @param password Account password
|
|
6
8
|
*/
|
|
7
9
|
initializeMailbox: (address: string, password: string) => Promise<void>;
|
|
8
10
|
/**
|
|
9
11
|
* Get most recent inbox match for an existing or new mail account
|
|
12
|
+
* @param filters Optional search filters
|
|
13
|
+
* @param options Configuration for message polling
|
|
10
14
|
*/
|
|
11
15
|
searchMailbox: (filters?: SearchFilters, options?: PollingOptions) => Promise<void>;
|
|
12
16
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"playwright.d.ts","sourceRoot":"","sources":["../../src/playwright/playwright.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"playwright.d.ts","sourceRoot":"","sources":["../../src/playwright/playwright.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,MAAM,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAElE,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAM1E,MAAM,MAAM,YAAY,GAAG;IACzB;;;;OAIG;IACH,iBAAiB,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAExE;;;;OAIG;IACH,aAAa,EAAE,CACb,OAAO,CAAC,EAAE,aAAa,EACvB,OAAO,CAAC,EAAE,cAAc,KACrB,OAAO,CAAC,IAAI,CAAC,CAAC;IAEnB;;OAEG;IACH,aAAa,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CACpC,CAAC;AAMF,eAAO,MAAM,IAAI,EAAE,QAAQ,CAAC,YAAY,EAAE,EAAE,CA6D1C,CAAC;AAEH,OAAO,EAAE,MAAM,EAAE,CAAC"}
|
package/dist/playwright.js
CHANGED
|
@@ -1,43 +1,45 @@
|
|
|
1
|
-
import { test as
|
|
2
|
-
import { expect as
|
|
3
|
-
import { E2EMailClient as
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { test as w } from "@playwright/test";
|
|
2
|
+
import { expect as b } from "@playwright/test";
|
|
3
|
+
import { E2EMailClient as x } from "./core/mailtm/index.js";
|
|
4
|
+
const c = w.extend({
|
|
5
|
+
mailState: async ({}, t) => {
|
|
6
|
+
await t({});
|
|
7
|
+
},
|
|
8
|
+
initializeMailbox: async ({ mailState: t }, i) => {
|
|
9
|
+
await i(async (e, n) => {
|
|
10
|
+
const a = new x(e, n);
|
|
11
|
+
await a.initialize(), t.client = a;
|
|
9
12
|
});
|
|
10
13
|
},
|
|
11
|
-
removeMailbox: async ({},
|
|
12
|
-
await
|
|
13
|
-
if (!
|
|
14
|
+
removeMailbox: async ({ mailState: t }, i) => {
|
|
15
|
+
await i(async () => {
|
|
16
|
+
if (!t.client)
|
|
14
17
|
throw new Error(
|
|
15
18
|
"Mailbox client not initialized. Call initializeMailbox() first."
|
|
16
19
|
);
|
|
17
|
-
await
|
|
20
|
+
await t.client.dispose(), t.client = void 0;
|
|
18
21
|
});
|
|
19
22
|
},
|
|
20
|
-
searchMailbox: async ({ page: t },
|
|
21
|
-
await
|
|
22
|
-
var l;
|
|
23
|
+
searchMailbox: async ({ page: t, mailState: i }, e) => {
|
|
24
|
+
await e(async (n, a = {}) => {
|
|
23
25
|
const {
|
|
24
|
-
timeout: r =
|
|
25
|
-
autoDelete:
|
|
26
|
-
} =
|
|
27
|
-
if (!
|
|
26
|
+
timeout: r = c.info().project.use.actionTimeout ?? c.info().timeout,
|
|
27
|
+
autoDelete: m
|
|
28
|
+
} = a, l = i.client;
|
|
29
|
+
if (!l)
|
|
28
30
|
throw new Error(
|
|
29
31
|
"Mailbox client not initialized. Call initializeMailbox() first."
|
|
30
32
|
);
|
|
31
|
-
const o = await
|
|
33
|
+
const o = await l.pollMessages(n, {
|
|
32
34
|
timeout: r,
|
|
33
|
-
autoDelete:
|
|
34
|
-
}),
|
|
35
|
-
|
|
35
|
+
autoDelete: m
|
|
36
|
+
}), s = Array.isArray(o.html) ? o.html[0] : o.html ?? "";
|
|
37
|
+
s && await t.setContent(String(s));
|
|
36
38
|
});
|
|
37
39
|
}
|
|
38
40
|
});
|
|
39
41
|
export {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
+
b as expect,
|
|
43
|
+
c as test
|
|
42
44
|
};
|
|
43
45
|
//# sourceMappingURL=playwright.js.map
|
package/dist/playwright.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"playwright.js","sources":["../src/playwright/playwright.ts"],"sourcesContent":["import { test as base, expect,
|
|
1
|
+
{"version":3,"file":"playwright.js","sources":["../src/playwright/playwright.ts"],"sourcesContent":["import { test as base, expect, TestType } from \"@playwright/test\";\nimport { E2EMailClient } from \"../core/mailtm\";\nimport type { PollingOptions, SearchFilters } from \"../core/mailtm/types\";\n\ntype MailState = {\n client?: E2EMailClient;\n};\n\nexport type MailFixtures = {\n /**\n * Initialize mailbox session\n * @param address Email address\n * @param password Account password\n */\n initializeMailbox: (address: string, password: string) => Promise<void>;\n\n /**\n * Get most recent inbox match for an existing or new mail account\n * @param filters Optional search filters\n * @param options Configuration for message polling\n */\n searchMailbox: (\n filters?: SearchFilters,\n options?: PollingOptions,\n ) => Promise<void>;\n\n /**\n * Delete the account mailbox and all its emails from the server\n */\n removeMailbox: () => Promise<void>;\n};\n\ntype InternalFixtures = {\n mailState: MailState;\n};\n\nexport const test: TestType<MailFixtures, {}> = base.extend<\n MailFixtures & InternalFixtures\n>({\n mailState: async ({}, use) => {\n const state: MailState = {};\n\n await use(state);\n },\n\n initializeMailbox: async ({ mailState }, use) => {\n await use(async (address, password) => {\n const client = new E2EMailClient(address, password);\n\n await client.initialize();\n\n mailState.client = client;\n });\n },\n\n removeMailbox: async ({ mailState }, use) => {\n await use(async () => {\n if (!mailState.client) {\n throw new Error(\n \"Mailbox client not initialized. Call initializeMailbox() first.\",\n );\n }\n\n await mailState.client.dispose();\n mailState.client = undefined;\n });\n },\n\n searchMailbox: async ({ page, mailState }, use) => {\n await use(async (filters, options = {}) => {\n const {\n timeout = test.info().project.use.actionTimeout ?? test.info().timeout,\n autoDelete,\n } = options;\n\n const client = mailState.client;\n\n if (!client) {\n throw new Error(\n \"Mailbox client not initialized. Call initializeMailbox() first.\",\n );\n }\n\n const message = await client.pollMessages(filters, {\n timeout,\n autoDelete,\n });\n\n const html = Array.isArray(message.html)\n ? message.html[0]\n : (message.html ?? \"\");\n\n if (html) {\n await page.setContent(String(html));\n }\n });\n },\n});\n\nexport { expect };\n"],"names":["test","base","use","mailState","address","password","client","E2EMailClient","page","filters","options","timeout","autoDelete","message","html"],"mappings":";;;AAoCO,MAAMA,IAAmCC,EAAK,OAEnD;AAAA,EACA,WAAW,OAAO,CAAA,GAAIC,MAAQ;AAG5B,UAAMA,EAFmB,CAAA,CAEV;AAAA,EACjB;AAAA,EAEA,mBAAmB,OAAO,EAAE,WAAAC,EAAA,GAAaD,MAAQ;AAC/C,UAAMA,EAAI,OAAOE,GAASC,MAAa;AACrC,YAAMC,IAAS,IAAIC,EAAcH,GAASC,CAAQ;AAElD,YAAMC,EAAO,WAAA,GAEbH,EAAU,SAASG;AAAA,IACrB,CAAC;AAAA,EACH;AAAA,EAEA,eAAe,OAAO,EAAE,WAAAH,EAAA,GAAaD,MAAQ;AAC3C,UAAMA,EAAI,YAAY;AACpB,UAAI,CAACC,EAAU;AACb,cAAM,IAAI;AAAA,UACR;AAAA,QAAA;AAIJ,YAAMA,EAAU,OAAO,QAAA,GACvBA,EAAU,SAAS;AAAA,IACrB,CAAC;AAAA,EACH;AAAA,EAEA,eAAe,OAAO,EAAE,MAAAK,GAAM,WAAAL,EAAA,GAAaD,MAAQ;AACjD,UAAMA,EAAI,OAAOO,GAASC,IAAU,CAAA,MAAO;AACzC,YAAM;AAAA,QACJ,SAAAC,IAAUX,EAAK,KAAA,EAAO,QAAQ,IAAI,iBAAiBA,EAAK,KAAA,EAAO;AAAA,QAC/D,YAAAY;AAAA,MAAA,IACEF,GAEEJ,IAASH,EAAU;AAEzB,UAAI,CAACG;AACH,cAAM,IAAI;AAAA,UACR;AAAA,QAAA;AAIJ,YAAMO,IAAU,MAAMP,EAAO,aAAaG,GAAS;AAAA,QACjD,SAAAE;AAAA,QACA,YAAAC;AAAA,MAAA,CACD,GAEKE,IAAO,MAAM,QAAQD,EAAQ,IAAI,IACnCA,EAAQ,KAAK,CAAC,IACbA,EAAQ,QAAQ;AAErB,MAAIC,KACF,MAAMN,EAAK,WAAW,OAAOM,CAAI,CAAC;AAAA,IAEtC,CAAC;AAAA,EACH;AACF,CAAC;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "e2e-mail",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.20",
|
|
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.20",
|
|
65
65
|
"openapi-typescript": "^7.13.0",
|
|
66
66
|
"tsx": "^4.22.4",
|
|
67
67
|
"typescript": "^5.9.0",
|