@bigbinary/neeto-playwright-commons 1.9.31 → 1.9.33

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.cjs.js CHANGED
@@ -143,6 +143,9 @@ const CREDENTIALS = {
143
143
  const OTP_EMAIL_PATTERN = "is your login code";
144
144
  const SLACK_DEFAULT_CHANNEL = "general";
145
145
  const ZAPIER_TEST_EMAIL = (product) => `neeto-${product}-zapier-test@${process.env.INTEGRATION_MAILOSAUR_SERVER_ID}.mailosaur.net`;
146
+ // constants for translation
147
+ const SINGULAR = { count: 1 };
148
+ const PLURAL = { count: 2 };
146
149
 
147
150
  /* eslint-disable playwright/no-skipped-test */
148
151
  const execCommand = (command) => child_process.execSync(command)
@@ -3580,7 +3583,10 @@ class CustomCommands {
3580
3583
  await test$1.expect(this.page.getByTestId(selectMenu)).toBeVisible({
3581
3584
  timeout: options.visibilityTimeout,
3582
3585
  });
3583
- await this.page.getByTestId(selectMenu).getByText(value).click();
3586
+ await this.page
3587
+ .getByTestId(selectMenu)
3588
+ .getByText(value, { exact: true })
3589
+ .click();
3584
3590
  await test$1.expect(this.page.getByTestId(selectValueContainer)).toContainText(value, { timeout: options.textAssertionTimeout });
3585
3591
  }).toPass({ timeout: options.retryTimeout });
3586
3592
  };
@@ -13596,7 +13602,7 @@ const TOASTR_MESSAGES = {
13596
13602
  zapierApiKeyGenerated: "Zapier API key is generated successfully!",
13597
13603
  };
13598
13604
  const ZAPIER_LIMIT_EXHAUSTED_MESSAGE = "Zapier free task limit is exhausted. Test will be aborted";
13599
- const EMOJI_PICKER_LABEL = "Smileys & People";
13605
+ const EMOJI_LABEL = "thumbs up";
13600
13606
  const ATTACHMENT_DELETION_TOASTR_MESSAGE = "Attachment has been successfully deleted.";
13601
13607
 
13602
13608
  const HELP_CENTER_SELECTORS = {
@@ -14453,6 +14459,7 @@ class ZapierPage extends IntegrationBase {
14453
14459
  const DESCRIPTION_EDITOR_TEXTS = {
14454
14460
  fontSize: "Font size",
14455
14461
  paragraph: "Paragraph",
14462
+ normalText: "Normal text",
14456
14463
  pasteLink: "Paste the link here...",
14457
14464
  invalidURLError: "Please enter a valid URL",
14458
14465
  pasteURL: "Paste URL",
@@ -14461,6 +14468,8 @@ const DESCRIPTION_EDITOR_TEXTS = {
14461
14468
  link: "Link",
14462
14469
  cannedResponseHeader: "Canned responses",
14463
14470
  paragraphOption: "paragraph",
14471
+ search: "Search",
14472
+ emoji: "Emoji",
14464
14473
  };
14465
14474
  const EXPANDED_FONT_SIZE = {
14466
14475
  h1: "Heading 1",
@@ -14508,7 +14517,7 @@ const NEETO_EDITOR_SELECTORS = {
14508
14517
  addLinkTextField: "neeto-editor-add-link-text-input",
14509
14518
  addURLTextField: "neeto-editor-add-link-url-input",
14510
14519
  submitLinkButton: "neeto-editor-add-link",
14511
- fontSizeDropdown: (currentOption = "Paragraph") => `${joinHyphenCase(currentOption)}-dropdown-icon`,
14520
+ fontSizeDropdown: (currentOption) => `${joinHyphenCase(currentOption)}-dropdown-icon`,
14512
14521
  fixedMenuArrow: "neeto-editor-fixed-menu-arrow",
14513
14522
  cannedResponseOption: "neeto-editor-fixed-menu-canned-responses-option",
14514
14523
  cannedResponseSelectContainer: "select-a-canned-response-select-container",
@@ -14534,6 +14543,9 @@ const NEETO_EDITOR_SELECTORS = {
14534
14543
  errorText: "neeto-editor-error-text",
14535
14544
  content: "editor-content",
14536
14545
  imageUploadDeleteButton: "neeto-editor-image-menu-Delete",
14546
+ dynamicVariablesButton: "dynamic-variables-button",
14547
+ emojiContainer: "neeto-editor-emoji-picker",
14548
+ dynamicVariableSelector: (variable) => `dynamic-variables-list-item-${neetoCist.hyphenate(variable)}`,
14537
14549
  };
14538
14550
  const NEETO_TEXT_MODIFIER_SELECTORS = {
14539
14551
  strikeOption: "neeto-editor-fixed-menu-strike-option",
@@ -14544,7 +14556,7 @@ const TEXT_MODIFIER_SELECTORS = {
14544
14556
  boldOption: "neeto-editor-fixed-menu-bold-option",
14545
14557
  italicsOption: "neeto-editor-fixed-menu-italic-option",
14546
14558
  codeOption: "neeto-editor-fixed-menu-code-option",
14547
- blockquoteOption: "neeto-editor-fixed-menu-block-quote-option",
14559
+ blockquoteOption: "neeto-editor-fixed-menu-blockquote-option",
14548
14560
  codeblockOption: "neeto-editor-fixed-menu-code-block-option",
14549
14561
  };
14550
14562
  const LIST_MODIFIER_SELECTORS = {
@@ -14562,40 +14574,44 @@ const FONT_SIZE_SELECTORS = {
14562
14574
  /* eslint-disable playwright/no-nth-methods */
14563
14575
  class EditorPage {
14564
14576
  constructor(page, neetoPlaywrightUtilities) {
14565
- this.verifyDescriptionEditor = async ({ text, linkUrl = faker.faker.internet.url(), filePath = "../../../e2e/assets/images/BigBinary.png", imageUrl = "https://picsum.photos/200/300", videoUrl = "https://youtu.be/jNQXAC9IVRw", cannedResponseSuccessMessage, }) => {
14566
- await this.page.getByTestId(NEETO_EDITOR_SELECTORS.contentField).fill(text);
14567
- await this.page
14568
- .getByTestId(NEETO_EDITOR_SELECTORS.fontSizeDropdown())
14577
+ this.verifyDescriptionEditor = async ({ text, editorWrapper, dynamicVariables, defaultFontSizeOption = "Paragraph", linkUrl = faker.faker.internet.url(), filePath = "../../../e2e/assets/images/BigBinary.png", imageUrl = "https://picsum.photos/200/300", videoUrl = "https://youtu.be/jNQXAC9IVRw", cannedResponseSuccessMessage, }) => {
14578
+ if (!editorWrapper)
14579
+ editorWrapper = this.page;
14580
+ await editorWrapper
14581
+ .getByTestId(NEETO_EDITOR_SELECTORS.contentField)
14582
+ .fill(text);
14583
+ await editorWrapper
14584
+ .getByTestId(NEETO_EDITOR_SELECTORS.fontSizeDropdown(defaultFontSizeOption))
14569
14585
  .click();
14570
14586
  const fontSize = Object.keys(FONT_SIZE_SELECTORS);
14571
14587
  for (const font of fontSize) {
14572
14588
  const fontKey = font;
14573
- await this.page.getByTestId(FONT_SIZE_SELECTORS[fontKey]).click();
14574
- await test$1.expect(this.page
14589
+ await editorWrapper.getByTestId(FONT_SIZE_SELECTORS[fontKey]).click();
14590
+ await test$1.expect(editorWrapper
14575
14591
  .getByTestId(NEETO_EDITOR_SELECTORS.contentField)
14576
14592
  .getByRole("heading", { level: Number(font.slice(1)) })).toBeVisible();
14577
- await this.page
14593
+ await editorWrapper
14578
14594
  .getByTestId(NEETO_EDITOR_SELECTORS.fontSizeDropdown(EXPANDED_FONT_SIZE[fontKey]))
14579
14595
  .click();
14580
14596
  }
14581
14597
  if (await this.paragraphSelector.isVisible()) {
14582
14598
  await this.paragraphSelector.click();
14583
14599
  const paragraphRole = DESCRIPTION_EDITOR_TEXTS.paragraphOption;
14584
- await test$1.expect(this.page
14600
+ await test$1.expect(editorWrapper
14585
14601
  .getByTestId(NEETO_EDITOR_SELECTORS.contentField)
14586
14602
  .getByRole(paragraphRole)).toBeVisible();
14587
14603
  }
14588
14604
  (await this.fixedMenuArrowSelector.isVisible()) &&
14589
14605
  (await this.fixedMenuArrowSelector.click());
14590
- await this.page.getByText(text).click({ clickCount: 3 });
14606
+ await editorWrapper.getByText(text).click({ clickCount: 3 });
14591
14607
  const textModifier = Object.keys(TEXT_MODIFIER_SELECTORS);
14592
14608
  for (const modifier of textModifier) {
14593
14609
  const modifierKey = modifier;
14594
14610
  const textModifierRole = TEXT_MODIFIER_ROLES[modifierKey];
14595
- const textModifierSelector = this.page.getByTestId(TEXT_MODIFIER_SELECTORS[modifierKey]);
14611
+ const textModifierSelector = editorWrapper.getByTestId(TEXT_MODIFIER_SELECTORS[modifierKey]);
14596
14612
  if (await textModifierSelector.isVisible()) {
14597
14613
  await textModifierSelector.click();
14598
- await test$1.expect(this.page
14614
+ await test$1.expect(editorWrapper
14599
14615
  .getByTestId(NEETO_EDITOR_SELECTORS.contentField)
14600
14616
  .getByRole(textModifierRole)).toBeVisible();
14601
14617
  await textModifierSelector.click();
@@ -14604,10 +14620,10 @@ class EditorPage {
14604
14620
  const textDeskModifier = Object.keys(NEETO_TEXT_MODIFIER_SELECTORS);
14605
14621
  for (const modifier of textDeskModifier) {
14606
14622
  const modifierKey = modifier;
14607
- const textModifierSelector = this.page.getByTestId(NEETO_TEXT_MODIFIER_SELECTORS[modifierKey]);
14623
+ const textModifierSelector = editorWrapper.getByTestId(NEETO_TEXT_MODIFIER_SELECTORS[modifierKey]);
14608
14624
  if (await textModifierSelector.isVisible()) {
14609
14625
  await textModifierSelector.click();
14610
- await test$1.expect(this.page
14626
+ await test$1.expect(editorWrapper
14611
14627
  .getByTestId(NEETO_EDITOR_SELECTORS.contentField)
14612
14628
  .locator(TEXT_MODIFIER_TAGS[modifierKey])).toBeVisible();
14613
14629
  await textModifierSelector.click();
@@ -14616,10 +14632,10 @@ class EditorPage {
14616
14632
  const listModifier = Object.keys(LIST_MODIFIER_SELECTORS);
14617
14633
  for (const modifier of listModifier) {
14618
14634
  const modifierKey = modifier;
14619
- const listModifierSelector = this.page.getByTestId(LIST_MODIFIER_SELECTORS[modifierKey]);
14635
+ const listModifierSelector = editorWrapper.getByTestId(LIST_MODIFIER_SELECTORS[modifierKey]);
14620
14636
  if (await listModifierSelector.isVisible()) {
14621
14637
  await listModifierSelector.click();
14622
- await test$1.expect(this.page
14638
+ await test$1.expect(editorWrapper
14623
14639
  .getByTestId(NEETO_EDITOR_SELECTORS.contentField)
14624
14640
  .locator(LIST_MODIFIER_TAGS[modifierKey])).toBeVisible();
14625
14641
  await listModifierSelector.click();
@@ -14634,7 +14650,7 @@ class EditorPage {
14634
14650
  .getByTestId(NEETO_EDITOR_SELECTORS.addLinkDoneButton)
14635
14651
  .click();
14636
14652
  const linkRole = DESCRIPTION_EDITOR_TEXTS.link;
14637
- await test$1.expect(this.page
14653
+ await test$1.expect(editorWrapper
14638
14654
  .getByTestId(NEETO_EDITOR_SELECTORS.contentField)
14639
14655
  .getByRole(linkRole)).toBeVisible();
14640
14656
  await this.page.getByTestId(NEETO_EDITOR_SELECTORS.unlinkButton).click();
@@ -14659,10 +14675,10 @@ class EditorPage {
14659
14675
  await this.page
14660
14676
  .getByTestId(COMMON_SELECTORS.alertModalSubmitButton)
14661
14677
  .click();
14678
+ await this.neetoPlaywrightUtilities.verifyToast({
14679
+ message: ATTACHMENT_DELETION_TOASTR_MESSAGE,
14680
+ });
14662
14681
  }
14663
- await this.neetoPlaywrightUtilities.verifyToast({
14664
- message: ATTACHMENT_DELETION_TOASTR_MESSAGE,
14665
- });
14666
14682
  if (await this.imageUploadOption.isVisible()) {
14667
14683
  await this.imageUploadOption.click();
14668
14684
  const fileUploaderPromise = this.page.waitForEvent("filechooser");
@@ -14673,7 +14689,6 @@ class EditorPage {
14673
14689
  const imagePath = Path__namespace.join(__dirname, filePath);
14674
14690
  await fileUploader.setFiles(imagePath);
14675
14691
  await test$1.expect(this.imageWrapper).toBeVisible({ timeout: 15000 });
14676
- await this.neetoPlaywrightUtilities.verifyToast();
14677
14692
  await this.imageWrapper
14678
14693
  .getByTestId(COMMON_SELECTORS.dropdownIcon)
14679
14694
  .click();
@@ -14714,11 +14729,11 @@ class EditorPage {
14714
14729
  message: cannedResponseSuccessMessage,
14715
14730
  });
14716
14731
  }
14717
- if (await this.page
14732
+ if (await editorWrapper
14718
14733
  .getByTestId(NEETO_EDITOR_SELECTORS.videoEmbedOption)
14719
14734
  .isVisible()) {
14720
14735
  await this.videoEmbedOption.click();
14721
- await this.videoEmbedOption.fill(videoUrl);
14736
+ await this.videoEmbedInput.fill(videoUrl);
14722
14737
  await this.page
14723
14738
  .getByTestId(NEETO_EDITOR_SELECTORS.videoEmbedSubmit)
14724
14739
  .click();
@@ -14734,12 +14749,35 @@ class EditorPage {
14734
14749
  if (await this.emojiDropdownIcon.isVisible()) {
14735
14750
  await this.emojiDropdownIcon.click();
14736
14751
  await this.page
14737
- .getByRole("region", {
14738
- name: EMOJI_PICKER_LABEL,
14739
- })
14740
- .getByText("👍")
14752
+ .getByRole("button", { name: DESCRIPTION_EDITOR_TEXTS.emoji })
14741
14753
  .click();
14742
- await test$1.expect(this.page.getByTestId(NEETO_EDITOR_SELECTORS.contentField)).toContainText("👍");
14754
+ await test$1.expect(this.page.getByTestId(NEETO_EDITOR_SELECTORS.emojiContainer)).toBeVisible({
14755
+ timeout: 10000,
14756
+ });
14757
+ await this.page
14758
+ .getByTestId(NEETO_EDITOR_SELECTORS.emojiContainer)
14759
+ .getByPlaceholder(DESCRIPTION_EDITOR_TEXTS.search)
14760
+ .fill(EMOJI_LABEL);
14761
+ await this.page.keyboard.press("Enter");
14762
+ await test$1.expect(editorWrapper.getByTestId(NEETO_EDITOR_SELECTORS.contentField)).toContainText("👍");
14763
+ await this.page.keyboard.press("Escape");
14764
+ }
14765
+ if (dynamicVariables &&
14766
+ (await editorWrapper
14767
+ .getByTestId(NEETO_EDITOR_SELECTORS.dynamicVariablesButton)
14768
+ .isVisible())) {
14769
+ for (const dynamicVariable of dynamicVariables) {
14770
+ await editorWrapper
14771
+ .getByTestId(NEETO_EDITOR_SELECTORS.dynamicVariablesButton)
14772
+ .click();
14773
+ await test$1.expect(this.page.getByTestId(COMMON_SELECTORS.dropdownContainer)).toBeVisible();
14774
+ await this.page
14775
+ .getByTestId(NEETO_EDITOR_SELECTORS.dynamicVariableSelector(dynamicVariable))
14776
+ .click();
14777
+ await test$1.expect(editorWrapper
14778
+ .getByTestId(NEETO_EDITOR_SELECTORS.contentField)
14779
+ .getByText(dynamicVariable)).toBeVisible();
14780
+ }
14743
14781
  }
14744
14782
  };
14745
14783
  this.page = page;
@@ -14755,6 +14793,7 @@ class EditorPage {
14755
14793
  this.imageUploadOption = this.page.getByTestId(NEETO_EDITOR_SELECTORS.imageUploadOption);
14756
14794
  this.cannedResponseOption = this.page.getByTestId(NEETO_EDITOR_SELECTORS.cannedResponseOption);
14757
14795
  this.videoEmbedOption = this.page.getByTestId(NEETO_EDITOR_SELECTORS.videoEmbedOption);
14796
+ this.videoEmbedInput = this.page.getByTestId(NEETO_EDITOR_SELECTORS.videoEmbedInput);
14758
14797
  this.videoWrapperSelector = this.page.getByTestId(NEETO_EDITOR_SELECTORS.videoWrapper);
14759
14798
  this.emojiDropdownIcon = this.page
14760
14799
  .getByTestId(NEETO_EDITOR_SELECTORS.fixedMenuWrapper)
@@ -148623,6 +148662,37 @@ const filterUtils = {
148623
148662
  clearFiltersFromActionBlock,
148624
148663
  };
148625
148664
 
148665
+ const getAmountWithSymbol = (amount, options) => {
148666
+ const formatter = new Intl.NumberFormat(dayjs__default["default"].locale(), {
148667
+ ...options,
148668
+ });
148669
+ return formatter.format(Number(amount));
148670
+ };
148671
+ const currencyFormat = {
148672
+ withAmount: (amount, options = { minimumFractionDigits: 2 }) => getAmountWithSymbol(amount, {
148673
+ style: undefined,
148674
+ ...options,
148675
+ }), // 1000, { maximumFractionDigits: 1 } => 1,000.0
148676
+ withSymbol: (amount, currency, options) => getAmountWithSymbol(amount, {
148677
+ ...options,
148678
+ style: "currency",
148679
+ currency,
148680
+ }), // 1000, "INR", { maximumFractionDigits: 0 } => ₹1,000
148681
+ withCode: (amount, currency, options = { minimumFractionDigits: 2 }) => `${getAmountWithSymbol(amount, {
148682
+ ...options,
148683
+ style: undefined,
148684
+ })} ${currency}`, // 1000, "USD" => 1,000.00 USD
148685
+ withSymbolAndCode: (amount, currency, options) => `${getAmountWithSymbol(amount, {
148686
+ ...options,
148687
+ style: "currency",
148688
+ currency,
148689
+ })} ${currency}`, // 1000, "INR", { maximumFractionDigits: 0 } => ₹1,000 INR
148690
+ };
148691
+ const currencyUtils = {
148692
+ getAmountWithSymbol,
148693
+ currencyFormat,
148694
+ };
148695
+
148626
148696
  var main$2 = {exports: {}};
148627
148697
 
148628
148698
  var name = "dotenv";
@@ -149263,7 +149333,7 @@ exports.CREDENTIALS = CREDENTIALS;
149263
149333
  exports.CustomCommands = CustomCommands;
149264
149334
  exports.DESCRIPTION_EDITOR_TEXTS = DESCRIPTION_EDITOR_TEXTS;
149265
149335
  exports.EMBED_SELECTORS = EMBED_SELECTORS;
149266
- exports.EMOJI_PICKER_LABEL = EMOJI_PICKER_LABEL;
149336
+ exports.EMOJI_LABEL = EMOJI_LABEL;
149267
149337
  exports.ENVIRONMENT = ENVIRONMENT;
149268
149338
  exports.EXPANDED_FONT_SIZE = EXPANDED_FONT_SIZE;
149269
149339
  exports.EditorPage = EditorPage;
@@ -149294,11 +149364,13 @@ exports.NEETO_ROUTES = NEETO_ROUTES;
149294
149364
  exports.NEETO_TEXT_MODIFIER_SELECTORS = NEETO_TEXT_MODIFIER_SELECTORS;
149295
149365
  exports.OTP_EMAIL_PATTERN = OTP_EMAIL_PATTERN;
149296
149366
  exports.OrganizationPage = OrganizationPage;
149367
+ exports.PLURAL = PLURAL;
149297
149368
  exports.PROFILE_SECTION_SELECTORS = PROFILE_SECTION_SELECTORS;
149298
149369
  exports.PROJECT_TRANSLATIONS_PATH = PROJECT_TRANSLATIONS_PATH;
149299
149370
  exports.ROLES_SELECTORS = ROLES_SELECTORS;
149300
149371
  exports.ROUTES = ROUTES;
149301
149372
  exports.SIGNUP_SELECTORS = SIGNUP_SELECTORS;
149373
+ exports.SINGULAR = SINGULAR;
149302
149374
  exports.SLACK_DATA_QA_SELECTORS = SLACK_DATA_QA_SELECTORS;
149303
149375
  exports.SLACK_DEFAULT_CHANNEL = SLACK_DEFAULT_CHANNEL;
149304
149376
  exports.SLACK_SELECTORS = SLACK_SELECTORS;
@@ -149325,6 +149397,7 @@ exports.basicHTMLContent = basicHTMLContent;
149325
149397
  exports.clearCredentials = clearCredentials;
149326
149398
  exports.commands = commands;
149327
149399
  exports.cpuThrottlingUsingCDP = cpuThrottlingUsingCDP;
149400
+ exports.currencyUtils = currencyUtils;
149328
149401
  exports.decodeQRCodeFromFile = decodeQRCodeFromFile;
149329
149402
  exports.definePlaywrightConfig = definePlaywrightConfig;
149330
149403
  exports.executeWithThrottledResources = executeWithThrottledResources;