e2e-mail 0.0.14 → 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 -2
- 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.map +1 -1
- package/dist/playwright.js.map +1 -1
- package/package.json +1 -1
|
@@ -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"}
|
|
@@ -7,7 +7,7 @@ declare global {
|
|
|
7
7
|
* @param address Email address
|
|
8
8
|
* @param password Account password
|
|
9
9
|
*/
|
|
10
|
-
initializeMailbox(address: string, password: string): void
|
|
10
|
+
initializeMailbox(address: string, password: string): Chainable<void>;
|
|
11
11
|
/**
|
|
12
12
|
* Get most recent inbox match for an existing or new mail account
|
|
13
13
|
* @param filters Optional search filters
|
|
@@ -17,7 +17,7 @@ declare global {
|
|
|
17
17
|
/**
|
|
18
18
|
* Delete the account mailbox and all its emails from the server
|
|
19
19
|
*/
|
|
20
|
-
removeMailbox(): void
|
|
20
|
+
removeMailbox(): Chainable<void>;
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
}
|
|
@@ -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,31 +1,33 @@
|
|
|
1
|
-
import { E2EMailClient as
|
|
1
|
+
import { E2EMailClient as s } from "./core/mailtm/index.js";
|
|
2
2
|
let i = null;
|
|
3
|
-
Cypress.Commands.add("initializeMailbox", (
|
|
4
|
-
cy.log(`Initializing mailbox ${
|
|
3
|
+
Cypress.Commands.add("initializeMailbox", (e, t) => {
|
|
4
|
+
cy.then(() => (cy.log(`Initializing mailbox ${e}`), i = new s(e, t), i.initialize()));
|
|
5
5
|
});
|
|
6
6
|
Cypress.Commands.add("removeMailbox", () => {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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
|
+
});
|
|
12
14
|
});
|
|
13
|
-
Cypress.Commands.add("searchMailbox", (
|
|
15
|
+
Cypress.Commands.add("searchMailbox", (e, t = {}) => {
|
|
14
16
|
const {
|
|
15
|
-
timeout:
|
|
16
|
-
autoDelete:
|
|
17
|
-
} =
|
|
18
|
-
cy.
|
|
17
|
+
timeout: a = Cypress.config().defaultCommandTimeout ?? 4e3,
|
|
18
|
+
autoDelete: r
|
|
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
|
-
autoDelete:
|
|
26
|
-
}), o = Array.isArray(
|
|
27
|
-
o && cy.document().then((
|
|
28
|
-
|
|
25
|
+
const l = await i.pollMessages(e, {
|
|
26
|
+
timeout: a,
|
|
27
|
+
autoDelete: r
|
|
28
|
+
}), o = Array.isArray(l.html) ? l.html[0] : l.html;
|
|
29
|
+
o && cy.document().then((n) => {
|
|
30
|
+
n.open(), n.write(String(o)), n.close();
|
|
29
31
|
});
|
|
30
32
|
});
|
|
31
33
|
});
|
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 +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.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;"}
|