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.
@@ -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;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"}
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 s } from "./core/mailtm/index.js";
2
- let i = null;
3
- Cypress.Commands.add("initializeMailbox", (e, t) => {
4
- cy.log(`Initializing mailbox ${e}`), cy.then(() => (i = new s(e, t), i.initialize()));
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", (e, t = {}) => {
17
+ Cypress.Commands.add("searchMailbox", (i, e = {}) => {
16
18
  const {
17
- timeout: a = Cypress.config().defaultCommandTimeout ?? 4e3,
18
- autoDelete: r
19
- } = t;
20
- return cy.then({ timeout: a + 2e3 }, async () => {
21
- if (!i)
22
- throw new Error(
23
- "Mailbox client not initialized. Call cy.initializeMailbox() first."
24
- );
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();
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
@@ -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\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.log(`Initializing mailbox ${address}`);\n\n cy.then(() => {\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,IAAI,wBAAwBD,CAAO,EAAE,GAExC,GAAG,KAAK,OACND,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
+ {"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,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"}
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"}
@@ -1,43 +1,45 @@
1
- import { test as m } from "@playwright/test";
2
- import { expect as h } from "@playwright/test";
3
- import { E2EMailClient as w } from "./core/mailtm/index.js";
4
- let i;
5
- const x = m.extend({
6
- initializeMailbox: async ({}, t) => {
7
- await t(async (a, e) => {
8
- i = new w(a, e), await i.initialize();
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 ({}, t) => {
12
- await t(async () => {
13
- if (!i)
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 i.dispose();
20
+ await t.client.dispose(), t.client = void 0;
18
21
  });
19
22
  },
20
- searchMailbox: async ({ page: t }, a) => {
21
- await a(async (e, s = {}) => {
22
- var l;
23
+ searchMailbox: async ({ page: t, mailState: i }, e) => {
24
+ await e(async (n, a = {}) => {
23
25
  const {
24
- timeout: r = x.info().project.use.actionTimeout ?? 4e3,
25
- autoDelete: c
26
- } = s;
27
- if (!i)
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 i.pollMessages(e, {
33
+ const o = await l.pollMessages(n, {
32
34
  timeout: r,
33
- autoDelete: c
34
- }), n = ((l = o.html) == null ? void 0 : l[0]) ?? o.html ?? "";
35
- n && await t.setContent(String(n));
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
- h as expect,
41
- x as test
42
+ b as expect,
43
+ c as test
42
44
  };
43
45
  //# sourceMappingURL=playwright.js.map
@@ -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\";\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;"}
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.19",
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.19",
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",