@bigbinary/neeto-playwright-commons 1.22.38 → 1.22.40

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
@@ -3754,6 +3754,7 @@ const NEETO_EDITOR_SELECTORS = {
3754
3754
  videoEmbedSubmit: "neeto-editor-embed-cancel",
3755
3755
  videoWrapper: "neeto-editor-video-wrapper",
3756
3756
  paragraphOption: fixedMenuSelector("font-size-option-body2"),
3757
+ calloutOption: fixedMenuSelector("callout-option"),
3757
3758
  attachmentPreview: "ne-attachments-wrapper",
3758
3759
  imageUploadLinkButton: "neeto-editor-media-uploader-link-tab",
3759
3760
  errorText: "neeto-editor-error-text",
@@ -3767,8 +3768,14 @@ const NEETO_EDITOR_SELECTORS = {
3767
3768
  videoUploadOption: optionSelector("video-upload"),
3768
3769
  todoListOption: optionSelector("todoList"),
3769
3770
  editorMenuWrapper: "neeto-editor-fixed-menu-wrapper",
3771
+ dataEmojiType: (type) => `[data-emoji="${type}"]`,
3772
+ //Use data-cy once https://github.com/neetozone/neeto-editor/issues/1651 is resolved
3773
+ calloutContent: ".callout-content",
3774
+ //Use data-cy once https://github.com/neetozone/neeto-editor/issues/1648 is resolved
3775
+ calloutTypeOption: ".neeto-editor-callout-dropdown__type-option",
3770
3776
  editorMediaUploaderTab: "neeto-editor-media-uploader-local-tab",
3771
3777
  dynamicVariableSelector: (variable) => `dynamic-variables-list-item-${joinHyphenCase(variable)}`,
3778
+ dynamicVariableList: (variable) => `dynamic-variables-list-${neetoCist.hyphenate(variable)}`,
3772
3779
  neetoEditorFixedMenuFontSize: "neeto-editor-fixed-menu-font-size-option",
3773
3780
  highlightText: (textColorIndex) => `--neeto-editor-highlight-text-${textColorIndex}`,
3774
3781
  highlightBg: (bgColorIndex) => `--neeto-editor-highlight-bg-${bgColorIndex}`,
@@ -192720,7 +192727,7 @@ class EditorPage {
192720
192727
  }
192721
192728
  return [{ key: "attachments", value: filePath }];
192722
192729
  };
192723
- this.verifyImageUploadOption = async ({ imageUrl, filePath, isButtonInMoreMenu, shouldRemoveImage = false, }) => {
192730
+ this.verifyImageUploadOption = async ({ filePath, isButtonInMoreMenu, shouldRemoveImage = false, }) => {
192724
192731
  isButtonInMoreMenu && (await this.moreMenuSelector.click());
192725
192732
  await this.imageUploadOption.click();
192726
192733
  await test$1.expect(this.page.getByTestId(NEETO_IMAGE_UPLOADER_SELECTORS.restrictionMessage)).toBeVisible();
@@ -192741,7 +192748,7 @@ class EditorPage {
192741
192748
  timeout: 15000,
192742
192749
  });
192743
192750
  }
192744
- return [{ key: "image-upload", value: imageUrl }];
192751
+ return [{ key: "image-upload", value: imagePath }];
192745
192752
  };
192746
192753
  this.verifyCannedResponseOption = async (isButtonInMoreMenu, cannedResponseSuccessMessage) => {
192747
192754
  isButtonInMoreMenu && (await this.moreMenuSelector.click());
@@ -192874,11 +192881,36 @@ class EditorPage {
192874
192881
  await this.dynamicVariablesButton.click();
192875
192882
  await test$1.expect(this.page.getByTestId(COMMON_SELECTORS.dropdownContainer)).toBeVisible();
192876
192883
  await this.page
192877
- .getByTestId(NEETO_EDITOR_SELECTORS.dynamicVariableSelector(key))
192884
+ .getByTestId(NEETO_EDITOR_SELECTORS.dynamicVariableList(key))
192885
+ .getByTestId(NEETO_EDITOR_SELECTORS.dynamicVariableSelector(value))
192878
192886
  .click();
192879
- await test$1.expect(this.contentField.getByText(neetoCist.truncate(value, 25))).toBeVisible();
192887
+ await test$1.expect(this.contentField.getByText(neetoCist.truncate(`${key}:${value}`, 25))).toBeVisible();
192880
192888
  }
192881
192889
  };
192890
+ this.verifyCalloutSelector = async (isButtonInMoreMenu) => {
192891
+ isButtonInMoreMenu && (await this.moreMenuSelector.click());
192892
+ const calloutTypes = ["default", "info", "warning", "error", "success"];
192893
+ const calloutContentField = this.contentField.locator(NEETO_EDITOR_SELECTORS.calloutContent);
192894
+ const calloutTypeOption = this.page.locator(NEETO_EDITOR_SELECTORS.calloutTypeOption);
192895
+ await this.moveCursorAtBottom();
192896
+ for (const [index, type] of calloutTypes.entries()) {
192897
+ await this.calloutSelector.click();
192898
+ const calloutType = calloutTypeOption.filter({ hasText: type });
192899
+ await test$1.expect(calloutType).toBeVisible({ timeout: 10000 });
192900
+ await calloutType.click();
192901
+ await Promise.all([
192902
+ test$1.expect(calloutTypeOption).toBeHidden(),
192903
+ test$1.expect(this.contentField.locator(NEETO_EDITOR_SELECTORS.dataEmojiType(type))).toBeVisible(),
192904
+ ]);
192905
+ const randomText = faker.faker.lorem.word(10);
192906
+ await this.page.keyboard.type(randomText);
192907
+ // The index is important here as it determines which callout content field to interact with
192908
+ // eslint-disable-next-line playwright/no-nth-methods
192909
+ await test$1.expect(calloutContentField.nth(index)).toContainText(randomText);
192910
+ await this.moveCursorAtBottom();
192911
+ }
192912
+ return [{ key: "callout" }];
192913
+ };
192882
192914
  this.buttonsAndVerifications = {
192883
192915
  "font-size": () => this.verifyFontSize(),
192884
192916
  emoji: isButtonInMoreMenu => this.verifyEmojiSelector(isButtonInMoreMenu),
@@ -192904,6 +192936,7 @@ class EditorPage {
192904
192936
  undo: isButtonInMoreMenu => this.verifyUndoSelector(isButtonInMoreMenu),
192905
192937
  redo: isButtonInMoreMenu => this.verifyRedoSelector(isButtonInMoreMenu),
192906
192938
  table: isButtonInMoreMenu => this.verifyTableSelector(isButtonInMoreMenu),
192939
+ callout: isButtonInMoreMenu => this.verifyCalloutSelector(isButtonInMoreMenu),
192907
192940
  "video-upload": isButtonInMoreMenu => this.verifyVideoUploadOption({
192908
192941
  filePath: this.videoPath,
192909
192942
  isButtonInMoreMenu,
@@ -192980,6 +193013,7 @@ class EditorPage {
192980
193013
  .getByTestId(COMMON_SELECTORS.dropdownIcon);
192981
193014
  this.contentField = this.editorWrapper.getByTestId(NEETO_EDITOR_SELECTORS.contentField);
192982
193015
  this.dynamicVariablesButton = this.editorWrapper.getByTestId(NEETO_EDITOR_SELECTORS.dynamicVariablesButton);
193016
+ this.calloutSelector = this.editorWrapper.getByTestId(NEETO_EDITOR_SELECTORS.calloutOption);
192983
193017
  this.undoSelector = this.editorWrapper.getByTestId(NEETO_EDITOR_SELECTORS.undoOption);
192984
193018
  this.redoSelector = this.editorWrapper.getByTestId(NEETO_EDITOR_SELECTORS.redoOption);
192985
193019
  this.tableOption = this.editorWrapper.getByTestId(NEETO_EDITOR_SELECTORS.tableOption);
@@ -199097,7 +199131,7 @@ const definePlaywrightConfig = (overrides) => {
199097
199131
  use: {
199098
199132
  baseURL: process.env.BASE_URL,
199099
199133
  testIdAttribute: "data-cy",
199100
- trace: "retain-on-failure",
199134
+ trace: "on",
199101
199135
  screenshot: "only-on-failure",
199102
199136
  navigationTimeout: 35000,
199103
199137
  actionTimeout: 10 * 1000,