e2e-mail 0.0.13 → 0.0.14
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 +2 -5
- package/dist/cypress/cypress.d.ts.map +1 -1
- package/dist/cypress.js +19 -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
|
@@ -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 {
|
|
@@ -15,13 +13,12 @@ declare global {
|
|
|
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
|
*/
|
|
22
|
-
removeMailbox():
|
|
20
|
+
removeMailbox(): void;
|
|
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;AAM1E,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,OAAO,CAAC;QAChB,UAAU,SAAS;YACjB;;;;eAIG;YACH,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;YAE3D;;;;eAIG;YACH,aAAa,CACX,OAAO,CAAC,EAAE,aAAa,EACvB,OAAO,CAAC,EAAE,cAAc,GACvB,SAAS,CAAC,IAAI,CAAC,CAAC;YAEnB;;eAEG;YACH,aAAa,IAAI,IAAI,CAAC;SACvB;KACF;CACF"}
|
package/dist/cypress.js
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import { E2EMailClient as
|
|
1
|
+
import { E2EMailClient as r } from "./core/mailtm/index.js";
|
|
2
2
|
let i = null;
|
|
3
|
-
Cypress.Commands.add("initializeMailbox", (
|
|
4
|
-
i = new
|
|
5
|
-
})
|
|
6
|
-
Cypress.Commands.add("removeMailbox", () =>
|
|
3
|
+
Cypress.Commands.add("initializeMailbox", (l, e) => {
|
|
4
|
+
cy.log(`Initializing mailbox ${l}`), i = new r(l, e), i.initialize();
|
|
5
|
+
});
|
|
6
|
+
Cypress.Commands.add("removeMailbox", () => {
|
|
7
7
|
if (!i)
|
|
8
8
|
throw new Error(
|
|
9
9
|
"Mailbox client not initialized. Call cy.initializeMailbox() first."
|
|
10
10
|
);
|
|
11
|
-
|
|
12
|
-
})
|
|
13
|
-
Cypress.Commands.add("searchMailbox", (
|
|
11
|
+
i.dispose();
|
|
12
|
+
});
|
|
13
|
+
Cypress.Commands.add("searchMailbox", (l, e = {}) => {
|
|
14
14
|
const {
|
|
15
|
-
timeout:
|
|
16
|
-
autoDelete:
|
|
17
|
-
} =
|
|
18
|
-
|
|
15
|
+
timeout: n = Cypress.config().defaultCommandTimeout ?? 4e3,
|
|
16
|
+
autoDelete: s
|
|
17
|
+
} = e;
|
|
18
|
+
cy.wrap(async () => {
|
|
19
19
|
if (!i)
|
|
20
20
|
throw new Error(
|
|
21
21
|
"Mailbox client not initialized. Call cy.initializeMailbox() first."
|
|
22
22
|
);
|
|
23
|
-
const
|
|
24
|
-
timeout:
|
|
25
|
-
autoDelete:
|
|
26
|
-
}), o = Array.isArray(
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
})
|
|
23
|
+
const t = await i.pollMessages(l, {
|
|
24
|
+
timeout: n,
|
|
25
|
+
autoDelete: s
|
|
26
|
+
}), o = Array.isArray(t.html) ? t.html[0] : t.html;
|
|
27
|
+
o && cy.document().then((a) => {
|
|
28
|
+
a.open(), a.write(String(o)), a.close();
|
|
29
|
+
});
|
|
30
30
|
});
|
|
31
31
|
});
|
|
32
32
|
//# 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\";\nimport type { components } from \"../core/api/types/mailtm-api\";\n\nlet mailClient: E2EMailClient | null = null;\n\ntype Message = components[\"schemas\"][\"Message-message.read\"];\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): 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<
|
|
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\";\nimport type { components } from \"../core/api/types/mailtm-api\";\n\nlet mailClient: E2EMailClient | null = null;\n\ntype Message = components[\"schemas\"][\"Message-message.read\"];\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): 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(): void;\n }\n }\n}\n\nCypress.Commands.add(\"initializeMailbox\", (address, password) => {\n cy.log(`Initializing mailbox ${address}`);\n\n mailClient = new E2EMailClient(address, password);\n mailClient.initialize();\n});\n\nCypress.Commands.add(\"removeMailbox\", () => {\n if (!mailClient) {\n throw new Error(\n \"Mailbox client not initialized. Call cy.initializeMailbox() first.\",\n );\n }\n\n mailClient.dispose();\n});\n\nCypress.Commands.add(\"searchMailbox\", (filters, options = {}) => {\n const {\n timeout = Cypress.config().defaultCommandTimeout ?? 4000,\n autoDelete,\n } = options;\n\n cy.wrap(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\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":";AAIA,IAAIA,IAAmC;AA+BvC,QAAQ,SAAS,IAAI,qBAAqB,CAACC,GAASC,MAAa;AAC/D,KAAG,IAAI,wBAAwBD,CAAO,EAAE,GAExCD,IAAa,IAAIG,EAAcF,GAASC,CAAQ,GAChDF,EAAW,WAAA;AACb,CAAC;AAED,QAAQ,SAAS,IAAI,iBAAiB,MAAM;AAC1C,MAAI,CAACA;AACH,UAAM,IAAI;AAAA,MACR;AAAA,IAAA;AAIJ,EAAAA,EAAW,QAAA;AACb,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,KAAG,KAAK,YAAY;AAClB,QAAI,CAACL;AACH,YAAM,IAAI;AAAA,QACR;AAAA,MAAA;AAKJ,UAAMQ,IAAU,MAAMR,EAAW,aAAaI,GAAS;AAAA,MACrD,SAAAE;AAAA,MACA,YAAAC;AAAA,IAAA,CACD,GAEKE,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;AAO1E,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,CAsC1C,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\";\nimport type { components } from \"../core/api/types/mailtm-api\";\n\nlet mailClient: E2EMailClient | undefined;\n\ntype Message = components[\"schemas\"][\"Message-message.read\"];\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<
|
|
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\";\nimport type { components } from \"../core/api/types/mailtm-api\";\n\nlet mailClient: E2EMailClient | undefined;\n\ntype Message = components[\"schemas\"][\"Message-message.read\"];\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 if (!mailClient) {\n throw new Error(\n \"Mailbox client not initialized. Call initializeMailbox() first.\",\n );\n }\n const message = await mailClient.pollMessages(filters, {\n timeout,\n autoDelete,\n });\n const html = message.html?.[0] ?? message.html ?? \"\";\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":";;;AAKA,IAAIA;AAyBG,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;AACJ,UAAI,CAACT;AACH,cAAM,IAAI;AAAA,UACR;AAAA,QAAA;AAGJ,YAAMY,IAAU,MAAMZ,EAAW,aAAaQ,GAAS;AAAA,QACrD,SAAAE;AAAA,QACA,YAAAC;AAAA,MAAA,CACD,GACKE,MAAOC,IAAAF,EAAQ,SAAR,gBAAAE,EAAe,OAAMF,EAAQ,QAAQ;AAClD,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.14",
|
|
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",
|