@bigbinary/neeto-playwright-commons 4.11.17 → 4.12.1-beta1

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/index.d.ts CHANGED
@@ -4192,7 +4192,7 @@ declare class EditorPage {
4192
4192
  private verifyFontSizeV2;
4193
4193
  private verifyTextModifiers;
4194
4194
  private verifyTextDeskModifier;
4195
- private openHighlighterContainer;
4195
+ private pickHighlightColor;
4196
4196
  private focusText;
4197
4197
  private highlightText;
4198
4198
  private verifyTextHighlighter;
@@ -4208,6 +4208,7 @@ declare class EditorPage {
4208
4208
  private verifyTableSelector;
4209
4209
  private verifyVideoUploadOption;
4210
4210
  private verifyTodoListSelector;
4211
+ private openDynamicVariablesMenu;
4211
4212
  verifyDynamicVariables: (dynamicVariables: KeyValuePair[]) => Promise<void>;
4212
4213
  private verifyTextColor;
4213
4214
  private verifyCalloutSelector;
@@ -8173,6 +8174,7 @@ declare const NEETO_EDITOR_SELECTORS: {
8173
8174
  highlightBg: (bgColorIndex: number) => string;
8174
8175
  neetoEditorHighlightTextColor: (textColorIndex: number) => string;
8175
8176
  neetoEditorHighlightBgColor: (bgColorIndex: number) => string;
8177
+ highlightTextColorGrid: string;
8176
8178
  todoList: string;
8177
8179
  selectedText: string;
8178
8180
  commandListItem: (index: number) => string;
@@ -10788,7 +10790,8 @@ interface ReplyInboundEmailParams extends InboundEmailParams {
10788
10790
  replyToMessageId: string;
10789
10791
  }
10790
10792
  /**
10791
- * Injects inbound emails via the Rails ActionMailbox conductor (development only).
10793
+ * Injects inbound emails via the Rails ActionMailbox conductor in development
10794
+ * and via the signed Mailgun ingress elsewhere.
10792
10795
  */
10793
10796
  declare class InboundEmailApis {
10794
10797
  private neetoPlaywrightUtilities;
@@ -10826,6 +10829,7 @@ declare class InboundEmailApis {
10826
10829
  */
10827
10830
  reply: (emailParams: ReplyInboundEmailParams) => Promise<playwright_core.APIResponse<any> | undefined>;
10828
10831
  private deliverSource;
10832
+ private deliverViaMailgunIngress;
10829
10833
  }
10830
10834
  export { ACTIONS, ADMIN_PANEL_SELECTORS, ALL_RESOURCES, ANALYTICS_RESOURCES, API_KEYS_SELECTORS, API_ROUTES, APP_RESOURCES, AUDIT_LOGS_SELECTORS, ApiKeysApi, ApiKeysPage, ApiKeysPageV2, AuditLogsPage, BASE_URL, CALENDAR_LABELS, CERTIFICATE_LIMIT_EXCEEDED_MESSAGE, CERTIFICATE_LIMIT_EXCEEDED_REGEXP, CERTIFICATE_PROVISION_FAILED_MESSAGE, CERTIFICATE_PROVISION_FAILED_REGEXP, CHANGELOG_WIDGET_SELECTORS, CHAT_WIDGET_SELECTORS, CHAT_WIDGET_TEXTS, COLOR, COMMON_SELECTORS, COMMON_TEXTS, COMMUNITY_TEXTS, CREDENTIALS, CURRENT_TIME_RANGES, CUSTOM_DOMAIN_EDGE_CERTIFICATE_SUFFIX, CUSTOM_DOMAIN_SELECTORS, CUSTOM_DOMAIN_SUFFIX, ColorPickerUtils, CustomCommands, CustomCommandsV2, CustomDomainApi, CustomDomainPage, DATE_FORMATS, DATE_PICKER_SELECTORS, DATE_RANGES, DATE_TEXTS, DEFAULT_TIMEZONE_ID, DEFAULT_WEBHOOKS_RESPONSE_TEXT, DESCRIPTION_EDITOR_TEXTS, EDITOR_VERIFY_TEXT_COLOR, EMBED_SELECTORS, EMOJI_LABEL, EMPTY_STORAGE_STATE, ENGAGE_TEXTS, ENVIRONMENT, EXAMPLE_URL, EXPANDED_FONT_SIZE, EXPORT_FILE_TYPES, EditorPage, EmailDeliveryUtils, EmbedBase, FILE_FORMATS, FONTS_RESOURCES, FONT_SIZE_SELECTORS, FROM_EMAIL_ENV_KEYS, GLOBAL_TRANSLATIONS_PATTERN, GOOGLE_ANALYTICS_SELECTORS, GOOGLE_CALENDAR_DATE_FORMAT, GOOGLE_LOGIN_SELECTORS, GOOGLE_LOGIN_TEXTS, GOOGLE_SHEETS_SELECTORS, GooglePage, HELP_CENTER_ROUTES, HELP_CENTER_SELECTORS, HelpAndProfilePage, HelpAndProfilePageV2, INTEGRATIONS_TEXTS, INTEGRATION_SELECTORS, IPRestrictionsPage, IP_RESTRICTIONS_SELECTORS, IS_CI, IS_DEV_CI, IS_DEV_ENV, IS_MAILPIT_ENABLED, IS_PLAYWRIGHT_RUN, IS_REVIEW_ENV, IS_SHADCN_UI, IS_STAGING_ENV, IS_WEBKIT, ImageUploader, InboundEmailApis, IntegrationBase, IpRestrictionsApi, KEYBOARD_SHORTCUTS_SELECTORS, KEYBOARD_SHORTCUT_TEST_CASES, LIST_MODIFIER_SELECTORS, LIST_MODIFIER_TAGS, LOGIN_DEFAULTS, LOGIN_SELECTORS, LOGIN_STRATEGIES, LOGIN_TIMEOUT, MAILPIT_BASE_URL, MAILPIT_DOMAIN_NAME, MEMBER_FORM_SELECTORS, MEMBER_SELECTORS, MEMBER_TEXTS, MERGE_TAGS_SELECTORS, MICROSOFT_LOGIN_SELECTORS, MICROSOFT_LOGIN_TEXTS, MailerUtils, MailpitApi, Member, MemberApis, MicrosoftPage, NEETO_AUTH_BASE_URL, NEETO_EDITOR_SELECTORS, NEETO_FILTERS_SELECTORS, NEETO_IMAGE_UPLOADER_SELECTORS, NEETO_ROUTES, NEETO_SEO_SELECTORS, NEETO_TEXT_MODIFIER_SELECTORS, NeetoAuthServer, NeetoChatWidget, NeetoEmailDeliveryApi, NeetoTowerApi, ONBOARDING_SELECTORS, ORGANIZATION_TEXTS, OTP_EMAIL_PATTERN, OTP_FETCH_TIMEOUT, OrganizationPage, PAST_TIME_RANGES, PHONE_NUMBER_FORMATS, PLURAL, PRODUCT_ROLES_ROUTE_MAP, PROFILE_LINKS, PROFILE_SECTION_SELECTORS, PROJECT_NAMES, PROJECT_TRANSLATIONS_PATH, REVIEW_APP_CUSTOM_DOMAIN_SUFFIX, ROLES_SELECTORS, ROUTES, RailsEmailApiClient, RailsEmailUtils, RoleApis, RolesPage, RolesPageV2, SIGNUP_SELECTORS, SINGULAR, SLACK_DATA_QA_SELECTORS, SLACK_DEFAULT_CHANNEL, SLACK_SELECTORS, SLACK_WEB_TEXTS, STATUS_TEXTS, STORAGE_STATE, SecurityApi, SidebarSection, SlackApi, SlackPage, SmsApi, SmsUtils, TABLE_SELECTORS, TAB_SELECTORS, TAGS_SELECTORS, TEAM_MEMBER_TEXTS, TEXT_MODIFIER_ROLES, TEXT_MODIFIER_SELECTORS, TEXT_MODIFIER_TAGS, THANK_YOU_SELECTORS, THEMES_SELECTORS, THEMES_TEXTS, THIRD_PARTY_RESOURCES, THIRD_PARTY_ROUTES, TIME_RANGES, TOASTR_MESSAGES, TWILIO_SELECTORS, TagsApi, TagsPage, TeamMembers, TeamMembersV2, ThankYouApi, ThankYouPage, TwilioApi, USER_AGENTS, WEBHOOK_SELECTORS, WebhookSiteApi, WebhooksPage, ZAPIER_LIMIT_EXHAUSTED_MESSAGE, ZAPIER_SELECTORS, ZAPIER_TEST_EMAIL, ZAPIER_TEST_EMAIL_V2, ZAPIER_WEB_TEXTS, ZapierPage, authenticateUser, baseURLGenerator, basicHTMLContent, clearCredentials, commands, cpuThrottlingUsingCDP, createOrganizationViaApi, createOrganizationViaRake, currencyUtils, dataQa, decodeQRCodeFromFile, definePlaywrightConfig, exampleEmail, executeWithThrottledResources, extractSubdomainFromError, filterUtils, fixedMenuSelector, generatePhoneNumber, generatePhoneNumberDetails, generateRandomBypassEmail, generateRandomFile, generateStagingData, getByDataQA, getClipboardContent, getDirname, getFormattedPhoneNumber, getFullUrl, getGithubToken, getGlobalUserProps, getGlobalUserState, getImagePathAndName, getIsoCodeFromPhoneCode, getListCount, globalShortcuts, grantClipboardPermissions, hexToRGB, hexToRGBA, i18nFixture, imageRegex, initializeCredentials, initializeReviewAppCredentials, initializeTestData, initializeTotp, isGithubIssueOpen, isStagingOrganizationExpired, joinHyphenCase, joinString, login, loginToReviewApp, mailpitDomainName, minutesAgo, networkConditions, networkThrottlingUsingCDP, optionSelector, readFileAsBrowserFile, readFileSyncIfExists, removeCredentialFile, reviewAppBaseURL, serializeFileForBrowser, shouldSkipCustomDomainSetup, shouldSkipSetupAndTeardown, simulateClickWithDelay, simulateTypingWithDelay, skipTest, squish, _default as stealthTest, tableUtils, toCamelCase, updateCredentials, waitForReviewApp, warmup, withCookieCache, writeDataToFile };
10831
10835
  export type { BaseThemeStyle, BaseThemeStyleType, ColumnMenuAction, CountryProps, CustomFixture, EmailDeliveryConnectParams, EmailDeliveryProvider, EmailDeliveryVerifiedEmail, EmailDeliveryVerifyEmailParams, EmailDeliveryVerifyEmailResponse, EmailMatchCriteria, InboundEmailParams, IntroPageThemeStyle, IntroPageThemeStyleType, LoginStrategy, OAuthEmailDeliveryProvider, ProjectName, ReplyInboundEmailParams, Sms, SmsFilters, SmsProvider, SmsSearchCriteria, SmsSearchParams, ThemeCategory, ValueOf, WaitForSmsOptions };
package/index.js CHANGED
@@ -23,7 +23,7 @@ import customParseFormat from 'dayjs/plugin/customParseFormat.js';
23
23
  import timezone from 'dayjs/plugin/timezone.js';
24
24
  import utc from 'dayjs/plugin/utc.js';
25
25
  import https from 'https';
26
- import { createPrivateKey } from 'node:crypto';
26
+ import { createPrivateKey, randomBytes, createHmac } from 'node:crypto';
27
27
  import { countries } from 'countries-list';
28
28
  import { parsePhoneNumberWithError } from 'libphonenumber-js';
29
29
  import * as http from 'http';
@@ -2491,6 +2491,7 @@ const NEETO_EDITOR_SELECTORS = {
2491
2491
  highlightBg: (bgColorIndex) => `--neeto-editor-highlight-bg-${bgColorIndex}`,
2492
2492
  neetoEditorHighlightTextColor: (textColorIndex) => `neeto-editor-highlight-text-color-dot-${textColorIndex}`,
2493
2493
  neetoEditorHighlightBgColor: (bgColorIndex) => `neeto-editor-highlight-background-color-dot-${bgColorIndex}`,
2494
+ highlightTextColorGrid: "neeto-editor-highlight-text-color-grid",
2494
2495
  todoList: "[data-type='todoList']",
2495
2496
  selectedText: ".selected-text",
2496
2497
  commandListItem: (index) => `neeto-editor-command-list-item-${index}`,
@@ -6797,9 +6798,19 @@ class EditorPage {
6797
6798
  await this.clickToolbarOption(textModifierSelector, isButtonInMoreMenu);
6798
6799
  return [{ key: modifierKey, value: randomText }];
6799
6800
  };
6800
- openHighlighterContainer = (isButtonInMoreMenu) => expect(async () => {
6801
- await this.clickToolbarOption(this.toolbarOption(NEETO_TEXT_MODIFIER_SELECTORS["highlight"]), isButtonInMoreMenu);
6802
- await expect(this.page.getByTestId(COMMON_SELECTORS.customDropdownContainer())).toBeVisible({ timeout: 5_000 });
6801
+ // A pick closes the palette on newer editors, and its state can still read
6802
+ // "open" for a few ms afterwards, so the dot is clicked inside the retry: a
6803
+ // palette that closes under the click is reopened and the dot clicked again.
6804
+ pickHighlightColor = (colorPalette, colorDot, isButtonInMoreMenu) => expect(async () => {
6805
+ const isPaletteOpen = (await colorPalette.isVisible()) &&
6806
+ (await colorPalette.getAttribute("data-state", { timeout: 1_000 })) !==
6807
+ "closed";
6808
+ if (!isPaletteOpen) {
6809
+ await expect(colorPalette).toBeHidden({ timeout: 5_000 });
6810
+ await this.clickToolbarOption(this.toolbarOption(NEETO_TEXT_MODIFIER_SELECTORS["highlight"]), isButtonInMoreMenu);
6811
+ await expect(colorPalette).toBeVisible({ timeout: 5_000 });
6812
+ }
6813
+ await colorDot.click({ timeout: 2_000 });
6803
6814
  }).toPass({ timeout: 30_000 });
6804
6815
  focusText = (textLocator) => expect(async () => {
6805
6816
  await textLocator.click();
@@ -6810,15 +6821,13 @@ class EditorPage {
6810
6821
  }).toPass({ timeout: 20_000 });
6811
6822
  highlightText = async (isButtonInMoreMenu, colorIndex) => {
6812
6823
  const randomText = await this.fillRandomText();
6813
- await this.openHighlighterContainer(isButtonInMoreMenu);
6814
- const colorPallete = this.page.getByTestId(COMMON_SELECTORS.customDropdownContainer());
6815
- await colorPallete
6816
- .getByTestId(NEETO_EDITOR_SELECTORS.neetoEditorHighlightTextColor(colorIndex))
6817
- .click();
6818
- await this.openHighlighterContainer(isButtonInMoreMenu);
6819
- await colorPallete
6820
- .getByTestId(NEETO_EDITOR_SELECTORS.neetoEditorHighlightBgColor(colorIndex))
6821
- .click();
6824
+ const colorPallete = this.page
6825
+ .getByTestId(COMMON_SELECTORS.customDropdownContainer())
6826
+ .filter({
6827
+ has: this.page.getByTestId(NEETO_EDITOR_SELECTORS.highlightTextColorGrid),
6828
+ });
6829
+ await this.pickHighlightColor(colorPallete, colorPallete.getByTestId(NEETO_EDITOR_SELECTORS.neetoEditorHighlightTextColor(colorIndex)), isButtonInMoreMenu);
6830
+ await this.pickHighlightColor(colorPallete, colorPallete.getByTestId(NEETO_EDITOR_SELECTORS.neetoEditorHighlightBgColor(colorIndex)), isButtonInMoreMenu);
6822
6831
  const highlightedText = this.contentField.getByText(randomText);
6823
6832
  await this.focusText(highlightedText);
6824
6833
  const textStyle = await highlightedText.getAttribute("style");
@@ -7020,10 +7029,20 @@ class EditorPage {
7020
7029
  await this.moveCursorAtBottom();
7021
7030
  return [{ key: "todoList", value: randomText }];
7022
7031
  };
7032
+ openDynamicVariablesMenu = (variablesMenu) => expect(async () => {
7033
+ const isMenuOpen = (await variablesMenu.isVisible()) &&
7034
+ (await variablesMenu.getAttribute("data-state", { timeout: 1_000 })) !==
7035
+ "closed";
7036
+ if (isMenuOpen)
7037
+ return;
7038
+ await expect(variablesMenu).toBeHidden({ timeout: 5_000 });
7039
+ await this.dynamicVariablesButton.click();
7040
+ await expect(variablesMenu).toBeVisible({ timeout: 5_000 });
7041
+ }).toPass({ timeout: 30_000 });
7023
7042
  verifyDynamicVariables = async (dynamicVariables) => {
7043
+ const variablesMenu = this.page.getByTestId(COMMON_SELECTORS.dropdownContainer);
7024
7044
  for (const { key, value } of dynamicVariables) {
7025
- await this.dynamicVariablesButton.click();
7026
- await expect(this.page.getByTestId(COMMON_SELECTORS.dropdownContainer)).toBeVisible();
7045
+ await this.openDynamicVariablesMenu(variablesMenu);
7027
7046
  await this.page
7028
7047
  .getByTestId(NEETO_EDITOR_SELECTORS.dynamicVariableList(key))
7029
7048
  .getByTestId(NEETO_EDITOR_SELECTORS.dynamicVariableSelector(value))
@@ -13170,10 +13189,12 @@ const definePlaywrightConfig = (overrides) => {
13170
13189
  };
13171
13190
 
13172
13191
  const INBOUND_EMAIL_SOURCES_URL = "/rails/conductor/action_mailbox/inbound_emails/sources";
13192
+ const MAILGUN_INGRESS_URL = "/rails/action_mailbox/mailgun/inbound_emails/mime";
13173
13193
  const normalizeMessageId = (id) => id.replace(/^<|>$/g, "");
13174
13194
  const sanitizeHeaderValue = (value) => value.replace(/[\r\n]+/g, " ");
13175
13195
  /**
13176
- * Injects inbound emails via the Rails ActionMailbox conductor (development only).
13196
+ * Injects inbound emails via the Rails ActionMailbox conductor in development
13197
+ * and via the signed Mailgun ingress elsewhere.
13177
13198
  */
13178
13199
  class InboundEmailApis {
13179
13200
  neetoPlaywrightUtilities;
@@ -13230,11 +13251,29 @@ class InboundEmailApis {
13230
13251
  "",
13231
13252
  body,
13232
13253
  ].join("\r\n");
13254
+ return IS_DEV_ENV
13255
+ ? this.neetoPlaywrightUtilities.apiRequest({
13256
+ url: INBOUND_EMAIL_SOURCES_URL,
13257
+ method: "post",
13258
+ body: { source },
13259
+ headers: { accept: "text/html" },
13260
+ })
13261
+ : this.deliverViaMailgunIngress(source);
13262
+ };
13263
+ deliverViaMailgunIngress = (source) => {
13264
+ const signingKey = process.env.MAILGUN_INGRESS_SIGNING_KEY;
13265
+ if (!signingKey) {
13266
+ throw new Error("MAILGUN_INGRESS_SIGNING_KEY is required to inject inbound emails outside development");
13267
+ }
13268
+ const timestamp = Math.floor(Date.now() / 1000).toString();
13269
+ const token = randomBytes(25).toString("hex");
13270
+ const signature = createHmac("sha256", signingKey)
13271
+ .update(`${timestamp}${token}`)
13272
+ .digest("hex");
13233
13273
  return this.neetoPlaywrightUtilities.apiRequest({
13234
- url: INBOUND_EMAIL_SOURCES_URL,
13274
+ url: MAILGUN_INGRESS_URL,
13235
13275
  method: "post",
13236
- body: { source },
13237
- headers: { accept: "text/html" },
13276
+ form: { "body-mime": source, timestamp, token, signature },
13238
13277
  });
13239
13278
  };
13240
13279
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bigbinary/neeto-playwright-commons",
3
- "version": "4.11.17",
3
+ "version": "4.12.1-beta1",
4
4
  "description": "A package encapsulating common playwright code across neeto projects.",
5
5
  "repository": "git@github.com:bigbinary/neeto-playwright-commons.git",
6
6
  "license": "apache-2.0",
@@ -105,4 +105,4 @@
105
105
  "puppeteer-extra-plugin-stealth": "2.11.2"
106
106
  },
107
107
  "packageManager": "yarn@4.18.1"
108
- }
108
+ }
File without changes