@bigbinary/neeto-playwright-commons 1.12.11 → 1.13.0

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.
@@ -231,7 +231,7 @@ export const handleUtilityMethods = (node, entityTitleToDescMapOfAllFiles) => {
231
231
  const members =
232
232
  node?.declarations?.[0]?.id?.typeAnnotation?.typeAnnotation?.members;
233
233
 
234
- members.map(methodNode => {
234
+ members?.map(methodNode => {
235
235
  handleEntity(
236
236
  methodNode,
237
237
  entityTitleToDescMapOfAllFiles,
package/index.cjs.js CHANGED
@@ -131,7 +131,7 @@ const CREDENTIALS = {
131
131
  };
132
132
  const OTP_EMAIL_PATTERN = "is your login code";
133
133
  const SLACK_DEFAULT_CHANNEL = "general";
134
- const ZAPIER_TEST_EMAIL = (product) => `neeto-${product}-zapier-test@${process.env.INTEGRATION_MAILOSAUR_SERVER_ID}.mailosaur.net`;
134
+ const ZAPIER_TEST_EMAIL = (product) => `neeto-${product}-zapier-test@${process.env.FASTMAIL_DOMAIN_NAME}`;
135
135
  // constants for translation
136
136
  const SINGULAR = { count: 1 };
137
137
  const PLURAL = { count: 2 };
@@ -11641,6 +11641,32 @@ class FastmailApi {
11641
11641
  }
11642
11642
  }
11643
11643
 
11644
+ const basicHTMLContent = (content) => `
11645
+ <!DOCTYPE html>
11646
+ <html lang="en">
11647
+ <head>
11648
+ <meta charset="UTF-8" />
11649
+ <meta name="viewport" content="width=device-width" />
11650
+ </head>
11651
+ <body>
11652
+ ${content}
11653
+ </body>
11654
+ </html>`;
11655
+ const hexToRGB = (hex) => {
11656
+ let r = "", g = "", b = "";
11657
+ if (hex.length === 4) {
11658
+ r = `0x${hex[1]}${hex[1]}`;
11659
+ g = `0x${hex[2]}${hex[2]}`;
11660
+ b = `0x${hex[3]}${hex[3]}`;
11661
+ }
11662
+ else if (hex.length === 7) {
11663
+ r = `0x${hex[1]}${hex[2]}`;
11664
+ g = `0x${hex[3]}${hex[4]}`;
11665
+ b = `0x${hex[5]}${hex[6]}`;
11666
+ }
11667
+ return `rgb(${Number(r)}, ${Number(g)}, ${Number(b)})`;
11668
+ };
11669
+
11644
11670
  const dateTimeOneHourAgo = () => new Date(new Date().valueOf() - 60 * 60 * 1000);
11645
11671
  class MailerUtils {
11646
11672
  constructor(neetoPlaywrightUtilities) {
@@ -11681,7 +11707,10 @@ class MailerUtils {
11681
11707
  body: emailBody,
11682
11708
  ...contentRecognitions,
11683
11709
  };
11684
- const document = new DOMParser().parseFromString(emailBody, "text/html").documentElement;
11710
+ const wrappedHtml = /<html[\s>]/i.test(emailBody)
11711
+ ? emailBody
11712
+ : basicHTMLContent(emailBody);
11713
+ const document = new DOMParser().parseFromString(wrappedHtml, "text/html").documentElement;
11685
11714
  const text = {
11686
11715
  body: ((_a = document === null || document === void 0 ? void 0 : document.getElementsByTagName("body")[0].textContent) === null || _a === void 0 ? void 0 : _a.trim()) || "",
11687
11716
  ...contentRecognitions,
@@ -20709,8 +20738,9 @@ const mergeTaxonomies = async (translations, page) => {
20709
20738
 
20710
20739
  const i18nFixture = {
20711
20740
  i18n: [
20712
- async ({ page }, use) => {
20741
+ async ({}, use) => {
20713
20742
  const translation = readTranslations();
20743
+ const page = await (await test$1.chromium.launch()).newPage();
20714
20744
  const taxonomies = await mergeTaxonomies(translation, page);
20715
20745
  const options = {
20716
20746
  debug: false,
@@ -20740,17 +20770,19 @@ const i18nFixture = {
20740
20770
  const i18nInitialized = await playwrightI18nextFixture.initI18n({
20741
20771
  plugins: [removeTagsProcessor, sentenceCaseProcessor],
20742
20772
  options,
20743
- // Fetch translations in every test or fetch once
20744
20773
  cache: true,
20745
20774
  });
20775
+ await page.close();
20746
20776
  await use(i18nInitialized);
20747
20777
  },
20748
- // Run as auto fixture to be available through all tests by getI18nInstance()
20749
- { auto: true },
20778
+ { auto: true, scope: "worker" },
20779
+ ],
20780
+ t: [
20781
+ async ({ i18n }, use) => {
20782
+ await use(i18n.t);
20783
+ },
20784
+ { scope: "worker" },
20750
20785
  ],
20751
- t: async ({ i18n }, use) => {
20752
- await use(i18n.t);
20753
- },
20754
20786
  };
20755
20787
 
20756
20788
  const THANK_YOU_SELECTORS = {
@@ -20943,32 +20975,6 @@ const EMBED_SELECTORS = {
20943
20975
  previewElementPopupButton: "preview-element-popup-button",
20944
20976
  };
20945
20977
 
20946
- const basicHTMLContent = (content) => `
20947
- <!DOCTYPE html>
20948
- <html lang="en">
20949
- <head>
20950
- <meta charset="UTF-8" />
20951
- <meta name="viewport" content="width=device-width" />
20952
- </head>
20953
- <body>
20954
- ${content}
20955
- </body>
20956
- </html>`;
20957
- const hexToRGB = (hex) => {
20958
- let r = "", g = "", b = "";
20959
- if (hex.length === 4) {
20960
- r = `0x${hex[1]}${hex[1]}`;
20961
- g = `0x${hex[2]}${hex[2]}`;
20962
- b = `0x${hex[3]}${hex[3]}`;
20963
- }
20964
- else if (hex.length === 7) {
20965
- r = `0x${hex[1]}${hex[2]}`;
20966
- g = `0x${hex[3]}${hex[4]}`;
20967
- b = `0x${hex[5]}${hex[6]}`;
20968
- }
20969
- return `rgb(${Number(r)}, ${Number(g)}, ${Number(b)})`;
20970
- };
20971
-
20972
20978
  class EmbedBase {
20973
20979
  constructor({ context, page, neetoPlaywrightUtilities, appName, }) {
20974
20980
  this.initializeEmbedPage = async ({ embedType, embedCode, customElementText = "Click here", }) => {
@@ -23789,7 +23795,7 @@ const ZAPIER_SELECTORS = {
23789
23795
  };
23790
23796
 
23791
23797
  class ZapierPage extends IntegrationBase {
23792
- constructor({ page, neetoPlaywrightUtilities, integrationRouteIndex, }) {
23798
+ constructor({ page, neetoPlaywrightUtilities, integrationRouteIndex, mailerUtils, }) {
23793
23799
  super({
23794
23800
  page,
23795
23801
  integration: "zapier",
@@ -23930,7 +23936,7 @@ class ZapierPage extends IntegrationBase {
23930
23936
  timeout: 10000,
23931
23937
  });
23932
23938
  };
23933
- this.verifyZapIsTriggered = ({ productName, submittedEmail, zapTriggeredAfter, }) => this.mailosaur.messages.get(process.env.INTEGRATION_MAILOSAUR_SERVER_ID, { sentTo: ZAPIER_TEST_EMAIL(productName), body: submittedEmail }, { timeout: 5 * 60000, receivedAfter: zapTriggeredAfter });
23939
+ this.verifyZapIsTriggered = ({ productName, submittedEmail, zapTriggeredAfter, }) => this.mailerUtils.findMessage({ to: ZAPIER_TEST_EMAIL(productName), body: submittedEmail }, { timeout: 2 * 60000, receivedAfter: zapTriggeredAfter });
23934
23940
  this.skipIfTaskLimitIsExhausted = async () => {
23935
23941
  var _a;
23936
23942
  // Zapier provides 100 free task limit for free account; skip test if it's exhausted
@@ -23982,16 +23988,12 @@ class ZapierPage extends IntegrationBase {
23982
23988
  });
23983
23989
  await this.verifyIntegrationStatus("disconnected");
23984
23990
  };
23985
- if (ramda.isNil(process.env.INTEGRATION_MAILOSAUR_API_KEY) ||
23986
- ramda.isNil(process.env.INTEGRATION_MAILOSAUR_SERVER_ID)) {
23987
- throw new Error("ENV variable INTEGRATION_MAILOSAUR_API_KEY or INTEGRATION_MAILOSAUR_SERVER_ID is not properly configured");
23988
- }
23989
23991
  if (ramda.isNil(process.env.ZAPIER_LOGIN_PASSWORD) ||
23990
23992
  ramda.isNil(process.env.ZAPIER_LOGIN_EMAIL) ||
23991
23993
  ramda.isNil(process.env.ZAP_ID)) {
23992
23994
  throw new Error("ENV variable ZAPIER_LOGIN_PASSWORD or ZAPIER_LOGIN_EMAIL or ZAP_ID is not properly configured");
23993
23995
  }
23994
- this.mailosaur = new MailosaurClient(process.env.INTEGRATION_MAILOSAUR_API_KEY);
23996
+ this.mailerUtils = mailerUtils;
23995
23997
  }
23996
23998
  }
23997
23999