e2e-mail 0.0.13 → 0.0.15
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/core/mailtm/types/index.d.ts +2 -0
- package/dist/core/mailtm/types/index.d.ts.map +1 -1
- package/dist/cypress/cypress.d.ts +2 -5
- package/dist/cypress/cypress.d.ts.map +1 -1
- package/dist/cypress.js +21 -19
- package/dist/cypress.js.map +1 -1
- package/dist/playwright/playwright.d.ts +1 -3
- package/dist/playwright/playwright.d.ts.map +1 -1
- package/dist/playwright.js +1 -1
- package/dist/playwright.js.map +1 -1
- package/package.json +2 -2
|
@@ -13,6 +13,8 @@ export type SearchFilters = {
|
|
|
13
13
|
export type PollingOptions = {
|
|
14
14
|
/** Timeout before exisitng polling loop */
|
|
15
15
|
timeout?: number;
|
|
16
|
+
/** Interval for polling search */
|
|
17
|
+
interval?: number;
|
|
16
18
|
/** If true, delete the email immediately when fetched
|
|
17
19
|
* @default true
|
|
18
20
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/mailtm/types/index.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GAAG;IAC1B,qDAAqD;IACrD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,yDAAyD;IACzD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,sDAAsD;IACtD,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,2CAA2C;IAC3C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/mailtm/types/index.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GAAG;IAC1B,qDAAqD;IACrD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,yDAAyD;IACzD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,sDAAsD;IACtD,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,2CAA2C;IAC3C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,kCAAkC;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC"}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { PollingOptions, SearchFilters } from '../core/mailtm/types';
|
|
2
|
-
import { components } from '../core/api/types/mailtm-api';
|
|
3
|
-
type Message = components["schemas"]["Message-message.read"];
|
|
4
2
|
declare global {
|
|
5
3
|
namespace Cypress {
|
|
6
4
|
interface Chainable {
|
|
@@ -9,13 +7,13 @@ declare global {
|
|
|
9
7
|
* @param address Email address
|
|
10
8
|
* @param password Account password
|
|
11
9
|
*/
|
|
12
|
-
initializeMailbox(address: string, password: string): void
|
|
10
|
+
initializeMailbox(address: string, password: string): Chainable<void>;
|
|
13
11
|
/**
|
|
14
12
|
* Get most recent inbox match for an existing or new mail account
|
|
15
13
|
* @param filters Optional search filters
|
|
16
14
|
* @param options Configuration for message polling
|
|
17
15
|
*/
|
|
18
|
-
searchMailbox(filters?: SearchFilters, options?: PollingOptions): Chainable<
|
|
16
|
+
searchMailbox(filters?: SearchFilters, options?: PollingOptions): Chainable<void>;
|
|
19
17
|
/**
|
|
20
18
|
* Delete the account mailbox and all its emails from the server
|
|
21
19
|
*/
|
|
@@ -23,5 +21,4 @@ declare global {
|
|
|
23
21
|
}
|
|
24
22
|
}
|
|
25
23
|
}
|
|
26
|
-
export {};
|
|
27
24
|
//# sourceMappingURL=cypress.d.ts.map
|
|
@@ -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;AAG1E,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,32 +1,34 @@
|
|
|
1
1
|
import { E2EMailClient as s } from "./core/mailtm/index.js";
|
|
2
2
|
let i = null;
|
|
3
|
-
Cypress.Commands.add("initializeMailbox", (
|
|
4
|
-
i = new s(
|
|
5
|
-
})
|
|
6
|
-
Cypress.Commands.add("removeMailbox", () =>
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
3
|
+
Cypress.Commands.add("initializeMailbox", (e, t) => {
|
|
4
|
+
cy.then(() => (cy.log(`Initializing mailbox ${e}`), i = new s(e, t), i.initialize()));
|
|
5
|
+
});
|
|
6
|
+
Cypress.Commands.add("removeMailbox", () => {
|
|
7
|
+
cy.then(() => {
|
|
8
|
+
if (!i)
|
|
9
|
+
throw new Error(
|
|
10
|
+
"Mailbox client not initialized. Call cy.initializeMailbox() first."
|
|
11
|
+
);
|
|
12
|
+
return i.dispose();
|
|
13
|
+
});
|
|
14
|
+
});
|
|
15
|
+
Cypress.Commands.add("searchMailbox", (e, t = {}) => {
|
|
14
16
|
const {
|
|
15
|
-
timeout:
|
|
17
|
+
timeout: a = Cypress.config().defaultCommandTimeout ?? 4e3,
|
|
16
18
|
autoDelete: r
|
|
17
|
-
} =
|
|
18
|
-
return cy.then({ timeout:
|
|
19
|
+
} = t;
|
|
20
|
+
return cy.then({ timeout: a + 2e3 }, async () => {
|
|
19
21
|
if (!i)
|
|
20
22
|
throw new Error(
|
|
21
23
|
"Mailbox client not initialized. Call cy.initializeMailbox() first."
|
|
22
24
|
);
|
|
23
|
-
const
|
|
24
|
-
timeout:
|
|
25
|
+
const l = await i.pollMessages(e, {
|
|
26
|
+
timeout: a,
|
|
25
27
|
autoDelete: r
|
|
26
|
-
}), o = Array.isArray(
|
|
27
|
-
|
|
28
|
+
}), o = Array.isArray(l.html) ? l.html[0] : l.html;
|
|
29
|
+
o && cy.document().then((n) => {
|
|
28
30
|
n.open(), n.write(String(o)), n.close();
|
|
29
|
-
})
|
|
31
|
+
});
|
|
30
32
|
});
|
|
31
33
|
});
|
|
32
34
|
//# 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\";\
|
|
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\nlet mailClient: E2EMailClient | null = null;\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.then(() => {\n cy.log(`Initializing mailbox ${address}`);\n\n mailClient = new E2EMailClient(address, password);\n return mailClient.initialize();\n });\n});\n\nCypress.Commands.add(\"removeMailbox\", () => {\n cy.then(() => {\n if (!mailClient) {\n throw new Error(\n \"Mailbox client not initialized. Call cy.initializeMailbox() first.\",\n );\n }\n\n return mailClient.dispose();\n });\n});\n\nCypress.Commands.add(\"searchMailbox\", (filters, options = {}) => {\n const {\n timeout = Cypress.config().defaultCommandTimeout ?? 4000,\n autoDelete,\n } = options;\n\n return cy.then({ timeout: timeout + 2000 }, async () => {\n if (!mailClient) {\n throw new Error(\n \"Mailbox client not initialized. Call cy.initializeMailbox() first.\",\n );\n }\n\n // Get most recent match\n const message = await mailClient.pollMessages(filters, {\n timeout,\n autoDelete,\n });\n const html = Array.isArray(message.html) ? message.html[0] : 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"],"names":["mailClient","address","password","E2EMailClient","filters","options","timeout","autoDelete","message","html","doc"],"mappings":";AAGA,IAAIA,IAAmC;AA6BvC,QAAQ,SAAS,IAAI,qBAAqB,CAACC,GAASC,MAAa;AAC/D,KAAG,KAAK,OACN,GAAG,IAAI,wBAAwBD,CAAO,EAAE,GAExCD,IAAa,IAAIG,EAAcF,GAASC,CAAQ,GACzCF,EAAW,WAAA,EACnB;AACH,CAAC;AAED,QAAQ,SAAS,IAAI,iBAAiB,MAAM;AAC1C,KAAG,KAAK,MAAM;AACZ,QAAI,CAACA;AACH,YAAM,IAAI;AAAA,QACR;AAAA,MAAA;AAIJ,WAAOA,EAAW,QAAA;AAAA,EACpB,CAAC;AACH,CAAC;AAED,QAAQ,SAAS,IAAI,iBAAiB,CAACI,GAASC,IAAU,OAAO;AAC/D,QAAM;AAAA,IACJ,SAAAC,IAAU,QAAQ,OAAA,EAAS,yBAAyB;AAAA,IACpD,YAAAC;AAAA,EAAA,IACEF;AAEJ,SAAO,GAAG,KAAK,EAAE,SAASC,IAAU,IAAA,GAAQ,YAAY;AACtD,QAAI,CAACN;AACH,YAAM,IAAI;AAAA,QACR;AAAA,MAAA;AAKJ,UAAMQ,IAAU,MAAMR,EAAW,aAAaI,GAAS;AAAA,MACrD,SAAAE;AAAA,MACA,YAAAC;AAAA,IAAA,CACD,GACKE,IAAO,MAAM,QAAQD,EAAQ,IAAI,IAAIA,EAAQ,KAAK,CAAC,IAAIA,EAAQ;AAGrE,IAAIC,KACF,GAAG,SAAA,EAAW,KAAK,CAACC,MAAQ;AAC1B,MAAAA,EAAI,KAAA,GACJA,EAAI,MAAM,OAAOD,CAAI,CAAC,GACtBC,EAAI,MAAA;AAAA,IACN,CAAC;AAAA,EAEL,CAAC;AACH,CAAC;"}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { expect, TestType } from '@playwright/test';
|
|
2
2
|
import { PollingOptions, SearchFilters } from '../core/mailtm/types';
|
|
3
|
-
import { components } from '../core/api/types/mailtm-api';
|
|
4
|
-
type Message = components["schemas"]["Message-message.read"];
|
|
5
3
|
export type MailFixtures = {
|
|
6
4
|
/**
|
|
7
5
|
* Initialize mailbox session
|
|
@@ -10,7 +8,7 @@ export type MailFixtures = {
|
|
|
10
8
|
/**
|
|
11
9
|
* Get most recent inbox match for an existing or new mail account
|
|
12
10
|
*/
|
|
13
|
-
searchMailbox: (filters?: SearchFilters, options?: PollingOptions) => Promise<
|
|
11
|
+
searchMailbox: (filters?: SearchFilters, options?: PollingOptions) => Promise<void>;
|
|
14
12
|
/**
|
|
15
13
|
* Delete the account mailbox and all its emails from the server
|
|
16
14
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"playwright.d.ts","sourceRoot":"","sources":["../../src/playwright/playwright.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,MAAM,EAAE,KAAK,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAEvE,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"playwright.d.ts","sourceRoot":"","sources":["../../src/playwright/playwright.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,MAAM,EAAE,KAAK,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAEvE,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAI1E,MAAM,MAAM,YAAY,GAAG;IACzB;;OAEG;IACH,iBAAiB,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAExE;;OAEG;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;AAGF,eAAO,MAAM,IAAI,EAAE,QAAQ,CAAC,YAAY,EAAE,EAAE,CA0C1C,CAAC;AAEH,OAAO,EAAE,MAAM,EAAE,CAAC"}
|
package/dist/playwright.js
CHANGED
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, type TestType } from \"@playwright/test\"; // 1. Import TestType\nimport { E2EMailClient } from \"../core/mailtm\";\nimport type { PollingOptions, SearchFilters } from \"../core/mailtm/types\";\
|
|
1
|
+
{"version":3,"file":"playwright.js","sources":["../src/playwright/playwright.ts"],"sourcesContent":["import { test as base, expect, type TestType } from \"@playwright/test\"; // 1. Import TestType\nimport { E2EMailClient } from \"../core/mailtm\";\nimport type { PollingOptions, SearchFilters } from \"../core/mailtm/types\";\n\nlet mailClient: E2EMailClient | undefined;\n\nexport type MailFixtures = {\n /**\n * Initialize mailbox session\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 */\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\n// 2. Explicitly type the \"test\" constant using TestType<MailFixtures>\nexport const test: TestType<MailFixtures, {}> = base.extend<MailFixtures>({\n initializeMailbox: async ({}, use) => {\n await use(async (address, password) => {\n mailClient = new E2EMailClient(address, password);\n await mailClient.initialize();\n });\n },\n removeMailbox: async ({}, use) => {\n await use(async () => {\n if (!mailClient) {\n throw new Error(\n \"Mailbox client not initialized. Call initializeMailbox() first.\",\n );\n }\n await mailClient.dispose();\n });\n },\n searchMailbox: async ({ page }, use) => {\n await use(async (filters, options = {}) => {\n const {\n timeout = test.info().project.use.actionTimeout ?? 4000,\n autoDelete,\n } = options;\n\n if (!mailClient) {\n throw new Error(\n \"Mailbox client not initialized. Call initializeMailbox() first.\",\n );\n }\n\n const message = await mailClient.pollMessages(filters, {\n timeout,\n autoDelete,\n });\n\n const html = message.html?.[0] ?? message.html ?? \"\";\n\n if (html) {\n await page.setContent(String(html));\n }\n });\n },\n});\n\nexport { expect };\n"],"names":["mailClient","test","base","use","address","password","E2EMailClient","page","filters","options","timeout","autoDelete","message","html","_a"],"mappings":";;;AAIA,IAAIA;AAuBG,MAAMC,IAAmCC,EAAK,OAAqB;AAAA,EACxE,mBAAmB,OAAO,CAAA,GAAIC,MAAQ;AACpC,UAAMA,EAAI,OAAOC,GAASC,MAAa;AACrC,MAAAL,IAAa,IAAIM,EAAcF,GAASC,CAAQ,GAChD,MAAML,EAAW,WAAA;AAAA,IACnB,CAAC;AAAA,EACH;AAAA,EACA,eAAe,OAAO,CAAA,GAAIG,MAAQ;AAChC,UAAMA,EAAI,YAAY;AACpB,UAAI,CAACH;AACH,cAAM,IAAI;AAAA,UACR;AAAA,QAAA;AAGJ,YAAMA,EAAW,QAAA;AAAA,IACnB,CAAC;AAAA,EACH;AAAA,EACA,eAAe,OAAO,EAAE,MAAAO,EAAA,GAAQJ,MAAQ;AACtC,UAAMA,EAAI,OAAOK,GAASC,IAAU,CAAA,MAAO;;AACzC,YAAM;AAAA,QACJ,SAAAC,IAAUT,EAAK,KAAA,EAAO,QAAQ,IAAI,iBAAiB;AAAA,QACnD,YAAAU;AAAA,MAAA,IACEF;AAEJ,UAAI,CAACT;AACH,cAAM,IAAI;AAAA,UACR;AAAA,QAAA;AAIJ,YAAMY,IAAU,MAAMZ,EAAW,aAAaQ,GAAS;AAAA,QACrD,SAAAE;AAAA,QACA,YAAAC;AAAA,MAAA,CACD,GAEKE,MAAOC,IAAAF,EAAQ,SAAR,gBAAAE,EAAe,OAAMF,EAAQ,QAAQ;AAElD,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.15",
|
|
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.2",
|
|
63
63
|
"cypress": "^15.17.0",
|
|
64
|
-
"e2e-mail": "^0.0.
|
|
64
|
+
"e2e-mail": "^0.0.14",
|
|
65
65
|
"openapi-fetch": "^0.17.0",
|
|
66
66
|
"openapi-typescript": "^7.13.0",
|
|
67
67
|
"tsx": "^4.22.4",
|