@bigbinary/neeto-playwright-commons 1.10.1 → 1.10.3

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
@@ -375,6 +375,7 @@ const COMMON_SELECTORS = {
375
375
  nuiRadioLabel: "nui-radio-label",
376
376
  submitButton: "submit-button",
377
377
  tableRow: ".ant-table-row",
378
+ navigationHeaderLeftBlock: "navigation-header-left-block",
378
379
  };
379
380
 
380
381
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
@@ -13786,49 +13787,54 @@ const LIST_MODIFIER_TAGS = {
13786
13787
  orderedListOption: "ol",
13787
13788
  };
13788
13789
 
13790
+ const optionSelector = (option) => `neeto-editor-fixed-menu-${option}-option`;
13791
+ const fixedMenuSelector = (selector) => `neeto-editor-fixed-menu-${selector}`;
13792
+
13789
13793
  const NEETO_EDITOR_SELECTORS = {
13790
- boldOption: "neeto-editor-fixed-menu-bold-option",
13791
- italicOption: "neeto-editor-fixed-menu-italic-option",
13792
- underlineOption: "neeto-editor-fixed-menu-underline-option",
13793
- strikeOption: "neeto-editor-fixed-menu-strike-option",
13794
- codeBlockOption: "neeto-editor-fixed-menu-code-option",
13795
- highlightOption: "neeto-editor-fixed-menu-highlight-option",
13796
- linkInput: "neeto-editor-fixed-menu-link-option-input",
13797
- linkSubmitButton: "neeto-editor-fixed-menu-link-option-link-button",
13794
+ boldOption: optionSelector("bold"),
13795
+ italicOption: optionSelector("italic"),
13796
+ underlineOption: optionSelector("underline"),
13797
+ strikeOption: optionSelector("strike"),
13798
+ codeBlockOption: optionSelector("code"),
13799
+ highlightOption: optionSelector("highlight"),
13800
+ emojiOption: optionSelector("emoji"),
13801
+ emojiDropdownIcon: "emoji-dropdown-icon",
13802
+ linkInput: fixedMenuSelector("link-option-input"),
13803
+ linkSubmitButton: fixedMenuSelector("link-option-link-button"),
13798
13804
  commandList: (index) => `neeto-editor-command-list-item-${index}`,
13799
13805
  imageUploadUrlSubmitButton: "neeto-editor-media-upload-url-submit",
13800
13806
  imageUploadUrlInputTextField: "neeto-editor-media-upload-url-input",
13801
13807
  uploadInput: "neeto-editor-media-uploader-input",
13802
- editorMenuBarWrapper: "neeto-editor-fixed-menu-wrapper",
13803
- undoOption: "neeto-editor-fixed-menu-undo-option",
13804
- redoOption: "neeto-editor-fixed-menu-redo-option",
13808
+ editorMenuBarWrapper: fixedMenuSelector("wrapper"),
13809
+ undoOption: optionSelector("undo"),
13810
+ redoOption: optionSelector("redo"),
13805
13811
  imageWrapper: "neeto-editor-image-wrapper",
13806
13812
  contentField: "neeto-editor-content",
13807
- addLinkButton: "neeto-editor-fixed-menu-link-option",
13813
+ addLinkButton: optionSelector("link"),
13808
13814
  addLinkTextField: "neeto-editor-add-link-text-input",
13809
13815
  addURLTextField: "neeto-editor-add-link-url-input",
13810
13816
  submitLinkButton: "neeto-editor-add-link",
13811
13817
  fontSizeDropdown: (currentOption) => `${joinHyphenCase(currentOption)}-dropdown-icon`,
13812
- fixedMenuArrow: "neeto-editor-fixed-menu-arrow",
13813
- cannedResponseOption: "neeto-editor-fixed-menu-canned-responses-option",
13818
+ fixedMenuArrow: fixedMenuSelector("arrow"),
13819
+ cannedResponseOption: optionSelector("canned-responses"),
13814
13820
  cannedResponseSelectContainer: "select-a-canned-response-select-container",
13815
- fixedMenuWrapper: "neeto-editor-fixed-menu-wrapper",
13816
- linkOption: "neeto-editor-fixed-menu-link-option",
13821
+ fixedMenuWrapper: optionSelector("wrapper"),
13822
+ linkOption: optionSelector("link"),
13817
13823
  addLinkUrlInput: "neeto-editor-add-link-url-input",
13818
13824
  addLinkDoneButton: "neeto-editor-add-link",
13819
13825
  unlinkButton: "neeto-editor-link-popover-unlink",
13820
- editorAttachmentsButton: "neeto-editor-fixed-menu-attachments-option",
13826
+ editorAttachmentsButton: optionSelector("attachments"),
13821
13827
  attachmentPreviewDeleteButton: "neeto-editor-preview-delete-button",
13822
- imageUploadOption: "neeto-editor-fixed-menu-image-upload-option",
13828
+ imageUploadOption: optionSelector("image-upload"),
13823
13829
  imageUploadLinkInput: "neeto-editor-media-upload-url-input",
13824
13830
  imageUploadButton: "neeto-editor-media-uploader-dnd",
13825
13831
  imageUploadLinkSubmitButton: "neeto-editor-media-upload-url-submit",
13826
13832
  applyButton: "apply-button",
13827
- videoEmbedOption: "neeto-editor-fixed-menu-video-embed-option",
13833
+ videoEmbedOption: optionSelector("video-embed"),
13828
13834
  videoEmbedInput: "neeto-editor-embed-input",
13829
13835
  videoEmbedSubmit: "neeto-editor-embed-cancel",
13830
13836
  videoWrapper: "neeto-editor-video-wrapper",
13831
- paragraphOption: "neeto-editor-fixed-menu-font-size-option-body2",
13837
+ paragraphOption: fixedMenuSelector("font-size-option-body2"),
13832
13838
  attachmentPreview: "ne-attachments-wrapper",
13833
13839
  imageUploadLinkButton: "neeto-editor-media-uploader-link-tab",
13834
13840
  errorText: "neeto-editor-error-text",
@@ -13839,256 +13845,266 @@ const NEETO_EDITOR_SELECTORS = {
13839
13845
  dynamicVariableSelector: (variable) => `dynamic-variables-list-item-${neetoCist.hyphenate(variable)}`,
13840
13846
  };
13841
13847
  const NEETO_TEXT_MODIFIER_SELECTORS = {
13842
- strikeOption: "neeto-editor-fixed-menu-strike-option",
13843
- underlineOption: "neeto-editor-fixed-menu-underline-option",
13844
- highlightOption: "neeto-editor-fixed-menu-highlight-option",
13848
+ strikeOption: optionSelector("strike"),
13849
+ underlineOption: optionSelector("underline"),
13850
+ highlightOption: optionSelector("highlight"),
13845
13851
  };
13846
13852
  const TEXT_MODIFIER_SELECTORS = {
13847
- boldOption: "neeto-editor-fixed-menu-bold-option",
13848
- italicsOption: "neeto-editor-fixed-menu-italic-option",
13849
- codeOption: "neeto-editor-fixed-menu-code-option",
13850
- blockquoteOption: "neeto-editor-fixed-menu-blockquote-option",
13851
- codeblockOption: "neeto-editor-fixed-menu-code-block-option",
13853
+ boldOption: optionSelector("bold"),
13854
+ italicsOption: optionSelector("italic"),
13855
+ codeOption: optionSelector("code"),
13856
+ blockquoteOption: optionSelector("blockquote"),
13857
+ codeblockOption: optionSelector("codeBlock"),
13852
13858
  };
13853
13859
  const LIST_MODIFIER_SELECTORS = {
13854
- bulletListOption: "neeto-editor-fixed-menu-bullet-list-option",
13855
- orderedListOption: "neeto-editor-fixed-menu-ordered-list-option",
13860
+ bulletListOption: optionSelector("bulletList"),
13861
+ orderedListOption: optionSelector("orderedList"),
13856
13862
  };
13857
13863
  const FONT_SIZE_SELECTORS = {
13858
- h1: "neeto-editor-fixed-menu-font-size-option-h1",
13859
- h2: "neeto-editor-fixed-menu-font-size-option-h2",
13860
- h3: "neeto-editor-fixed-menu-font-size-option-h3",
13861
- h4: "neeto-editor-fixed-menu-font-size-option-h4",
13862
- h5: "neeto-editor-fixed-menu-font-size-option-h5",
13864
+ h1: fixedMenuSelector("font-size-option-h1"),
13865
+ h2: fixedMenuSelector("font-size-option-h2"),
13866
+ h3: fixedMenuSelector("font-size-option-h3"),
13867
+ h4: fixedMenuSelector("font-size-option-h4"),
13868
+ h5: fixedMenuSelector("font-size-option-h5"),
13863
13869
  };
13864
13870
 
13865
- /* eslint-disable playwright/no-nth-methods */
13866
13871
  class EditorPage {
13867
- constructor(page, neetoPlaywrightUtilities) {
13868
- 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, }) => {
13869
- if (!editorWrapper)
13870
- editorWrapper = this.page;
13871
- await editorWrapper
13872
- .getByTestId(NEETO_EDITOR_SELECTORS.contentField)
13873
- .fill(text);
13874
- await editorWrapper
13872
+ constructor(page, neetoPlaywrightUtilities, editorWrapper) {
13873
+ this.assertOptionVisibility = async (optionLocator) => {
13874
+ if (await optionLocator.isVisible())
13875
+ return true;
13876
+ (await this.moreMenuSelector.isVisible()) &&
13877
+ (await this.moreMenuSelector.click());
13878
+ return optionLocator.isVisible();
13879
+ };
13880
+ this.verifyFontSize = async (defaultFontSizeOption) => {
13881
+ await this.editorWrapper
13875
13882
  .getByTestId(NEETO_EDITOR_SELECTORS.fontSizeDropdown(defaultFontSizeOption))
13876
13883
  .click();
13877
13884
  const fontSize = Object.keys(FONT_SIZE_SELECTORS);
13878
13885
  for (const font of fontSize) {
13879
13886
  const fontKey = font;
13880
- await editorWrapper.getByTestId(FONT_SIZE_SELECTORS[fontKey]).click();
13881
- await test$1.expect(editorWrapper
13882
- .getByTestId(NEETO_EDITOR_SELECTORS.contentField)
13883
- .getByRole("heading", { level: Number(font.slice(1)) })).toBeVisible();
13884
- await editorWrapper
13887
+ await this.editorWrapper
13888
+ .getByTestId(FONT_SIZE_SELECTORS[fontKey])
13889
+ .click();
13890
+ await test$1.expect(this.contentField.getByRole("heading", { level: Number(font.slice(1)) })).toBeVisible();
13891
+ await this.editorWrapper
13885
13892
  .getByTestId(NEETO_EDITOR_SELECTORS.fontSizeDropdown(EXPANDED_FONT_SIZE[fontKey]))
13886
13893
  .click();
13887
13894
  }
13888
- if (await this.paragraphSelector.isVisible()) {
13889
- await this.paragraphSelector.click();
13890
- const paragraphRole = DESCRIPTION_EDITOR_TEXTS.paragraphOption;
13891
- await test$1.expect(editorWrapper
13892
- .getByTestId(NEETO_EDITOR_SELECTORS.contentField)
13893
- .getByRole(paragraphRole)).toBeVisible();
13894
- }
13895
- (await this.fixedMenuArrowSelector.isVisible()) &&
13896
- (await this.fixedMenuArrowSelector.click());
13897
- await editorWrapper.getByText(text).click({ clickCount: 3 });
13895
+ };
13896
+ this.verifyTextModifiers = async () => {
13898
13897
  const textModifier = Object.keys(TEXT_MODIFIER_SELECTORS);
13899
13898
  for (const modifier of textModifier) {
13900
13899
  const modifierKey = modifier;
13901
13900
  const textModifierRole = TEXT_MODIFIER_ROLES[modifierKey];
13902
- const textModifierSelector = editorWrapper.getByTestId(TEXT_MODIFIER_SELECTORS[modifierKey]);
13903
- if (await textModifierSelector.isVisible()) {
13901
+ const textModifierSelector = this.editorWrapper.getByTestId(TEXT_MODIFIER_SELECTORS[modifierKey]);
13902
+ if (await this.assertOptionVisibility(textModifierSelector)) {
13904
13903
  await textModifierSelector.click();
13905
- await test$1.expect(editorWrapper
13906
- .getByTestId(NEETO_EDITOR_SELECTORS.contentField)
13907
- .getByRole(textModifierRole)).toBeVisible();
13904
+ await test$1.expect(this.contentField.getByRole(textModifierRole)).toBeVisible();
13908
13905
  await textModifierSelector.click();
13909
13906
  }
13910
13907
  }
13908
+ };
13909
+ this.verifyTextDeskModifier = async () => {
13911
13910
  const textDeskModifier = Object.keys(NEETO_TEXT_MODIFIER_SELECTORS);
13912
13911
  for (const modifier of textDeskModifier) {
13913
13912
  const modifierKey = modifier;
13914
- const textModifierSelector = editorWrapper.getByTestId(NEETO_TEXT_MODIFIER_SELECTORS[modifierKey]);
13915
- if (await textModifierSelector.isVisible()) {
13913
+ const textModifierSelector = this.editorWrapper.getByTestId(NEETO_TEXT_MODIFIER_SELECTORS[modifierKey]);
13914
+ if (await this.assertOptionVisibility(textModifierSelector)) {
13916
13915
  await textModifierSelector.click();
13917
- await test$1.expect(editorWrapper
13918
- .getByTestId(NEETO_EDITOR_SELECTORS.contentField)
13919
- .locator(TEXT_MODIFIER_TAGS[modifierKey])).toBeVisible();
13916
+ await test$1.expect(this.contentField.locator(TEXT_MODIFIER_TAGS[modifierKey])).toBeVisible();
13920
13917
  await textModifierSelector.click();
13921
13918
  }
13922
13919
  }
13920
+ };
13921
+ this.verifyListModifiers = async () => {
13923
13922
  const listModifier = Object.keys(LIST_MODIFIER_SELECTORS);
13924
13923
  for (const modifier of listModifier) {
13925
13924
  const modifierKey = modifier;
13926
- const listModifierSelector = editorWrapper.getByTestId(LIST_MODIFIER_SELECTORS[modifierKey]);
13927
- if (await listModifierSelector.isVisible()) {
13925
+ const listModifierSelector = this.editorWrapper.getByTestId(LIST_MODIFIER_SELECTORS[modifierKey]);
13926
+ if (await this.assertOptionVisibility(listModifierSelector)) {
13928
13927
  await listModifierSelector.click();
13929
- await test$1.expect(editorWrapper
13930
- .getByTestId(NEETO_EDITOR_SELECTORS.contentField)
13931
- .locator(LIST_MODIFIER_TAGS[modifierKey])).toBeVisible();
13928
+ await test$1.expect(this.contentField.locator(LIST_MODIFIER_TAGS[modifierKey])).toBeVisible();
13932
13929
  await listModifierSelector.click();
13933
13930
  }
13934
13931
  }
13935
- if (await this.editorLinkButton.isVisible()) {
13936
- await this.editorLinkButton.click();
13937
- await this.page
13938
- .getByTestId(NEETO_EDITOR_SELECTORS.addLinkUrlInput)
13939
- .fill(linkUrl);
13940
- await this.page
13941
- .getByTestId(NEETO_EDITOR_SELECTORS.addLinkDoneButton)
13942
- .click();
13943
- const linkRole = DESCRIPTION_EDITOR_TEXTS.link;
13944
- await test$1.expect(editorWrapper
13945
- .getByTestId(NEETO_EDITOR_SELECTORS.contentField)
13946
- .getByRole(linkRole)).toBeVisible();
13947
- await this.page.getByTestId(NEETO_EDITOR_SELECTORS.unlinkButton).click();
13948
- }
13949
- if (await this.editorAttachmentsButton.isVisible()) {
13950
- const fileUploaderPromise = this.page.waitForEvent("filechooser");
13951
- await this.editorAttachmentsButton.click();
13952
- const fileUploader = await fileUploaderPromise;
13953
- const imagePath = Path__namespace.join(__dirname, filePath);
13954
- await fileUploader.setFiles(imagePath);
13955
- await this.neetoPlaywrightUtilities.interceptMultipleResponses({
13956
- responseUrl: ROUTES.attachment,
13957
- });
13958
- await this.neetoPlaywrightUtilities.verifyToast();
13959
- await test$1.expect(this.attachmentPreview).toBeVisible();
13960
- await this.attachmentPreview
13961
- .getByTestId(COMMON_SELECTORS.dropdownIcon)
13962
- .click();
13963
- await this.page
13964
- .getByTestId(NEETO_EDITOR_SELECTORS.attachmentPreviewDeleteButton)
13965
- .click();
13966
- await this.page
13967
- .getByTestId(COMMON_SELECTORS.alertModalSubmitButton)
13968
- .click();
13969
- await this.neetoPlaywrightUtilities.verifyToast({
13970
- message: ATTACHMENT_DELETION_TOASTR_MESSAGE,
13971
- });
13972
- }
13973
- if (await this.imageUploadOption.isVisible()) {
13974
- await this.imageUploadOption.click();
13975
- const fileUploaderPromise = this.page.waitForEvent("filechooser");
13976
- await this.page
13977
- .getByTestId(NEETO_EDITOR_SELECTORS.imageUploadButton)
13978
- .click();
13979
- const fileUploader = await fileUploaderPromise;
13980
- const imagePath = Path__namespace.join(__dirname, filePath);
13981
- await fileUploader.setFiles(imagePath);
13982
- await test$1.expect(this.imageWrapper).toBeVisible({ timeout: 15000 });
13983
- await this.imageWrapper
13984
- .getByTestId(COMMON_SELECTORS.dropdownIcon)
13985
- .click();
13986
- await this.imageUploadDeleteButton.click();
13987
- await test$1.expect(this.imageWrapper).toBeHidden({
13988
- timeout: 15000,
13989
- });
13990
- await this.imageUploadOption.click();
13991
- await this.page
13992
- .getByTestId(NEETO_EDITOR_SELECTORS.imageUploadLinkButton)
13993
- .click();
13994
- await this.page
13995
- .getByTestId(NEETO_EDITOR_SELECTORS.imageUploadLinkInput)
13996
- .fill(imageUrl);
13997
- await this.page
13998
- .getByTestId(NEETO_EDITOR_SELECTORS.imageUploadLinkSubmitButton)
13999
- .click();
14000
- await test$1.expect(this.imageWrapper).toBeVisible({ timeout: 15000 });
14001
- await this.imageWrapper
14002
- .getByTestId(COMMON_SELECTORS.dropdownIcon)
14003
- .click();
14004
- await this.imageUploadDeleteButton.click();
14005
- await test$1.expect(this.imageWrapper).toBeHidden({
14006
- timeout: 15000,
14007
- });
14008
- }
14009
- if (await this.cannedResponseOption.isVisible()) {
14010
- await this.cannedResponseOption.click();
14011
- await test$1.expect(this.page.getByTestId(COMMON_SELECTORS.paneHeader)).toContainText(DESCRIPTION_EDITOR_TEXTS.cannedResponseHeader);
14012
- await this.page
14013
- .getByTestId(NEETO_EDITOR_SELECTORS.cannedResponseSelectContainer)
14014
- .fill(this.t("neetoRules.labels.feedback"));
14015
- await this.page
14016
- .getByTestId(COMMON_SELECTORS.selectOption(this.t("neetoRules.labels.feedback")))
14017
- .click();
14018
- await this.page.getByTestId(NEETO_EDITOR_SELECTORS.applyButton).click();
14019
- await this.neetoPlaywrightUtilities.verifyToast({
14020
- message: cannedResponseSuccessMessage,
14021
- });
14022
- }
14023
- if (await editorWrapper
14024
- .getByTestId(NEETO_EDITOR_SELECTORS.videoEmbedOption)
14025
- .isVisible()) {
14026
- await this.videoEmbedOption.click();
14027
- await this.videoEmbedInput.fill(videoUrl);
14028
- await this.page
14029
- .getByTestId(NEETO_EDITOR_SELECTORS.videoEmbedSubmit)
14030
- .click();
14031
- await test$1.expect(this.videoWrapperSelector).toBeVisible({ timeout: 15000 });
14032
- await this.videoWrapperSelector
14033
- .getByTestId(COMMON_SELECTORS.dropdownIcon)
14034
- .click();
14035
- await this.imageUploadDeleteButton.click();
14036
- await test$1.expect(this.videoWrapperSelector).toBeHidden({
14037
- timeout: 15000,
14038
- });
14039
- }
14040
- if (await this.emojiDropdownIcon.isVisible()) {
14041
- await this.emojiDropdownIcon.click();
13932
+ };
13933
+ this.verifyEditorLinkButton = async (linkUrl) => {
13934
+ await this.editorLinkButton.click();
13935
+ await this.page
13936
+ .getByTestId(NEETO_EDITOR_SELECTORS.addLinkUrlInput)
13937
+ .fill(linkUrl);
13938
+ await this.page
13939
+ .getByTestId(NEETO_EDITOR_SELECTORS.addLinkDoneButton)
13940
+ .click();
13941
+ const linkRole = DESCRIPTION_EDITOR_TEXTS.link;
13942
+ await test$1.expect(this.contentField.getByRole(linkRole)).toBeVisible();
13943
+ await this.page.getByTestId(NEETO_EDITOR_SELECTORS.unlinkButton).click();
13944
+ };
13945
+ this.verifyEditorAttachmentsButton = async (filePath) => {
13946
+ const fileUploaderPromise = this.page.waitForEvent("filechooser");
13947
+ await this.editorAttachmentsButton.click();
13948
+ const fileUploader = await fileUploaderPromise;
13949
+ const imagePath = Path__namespace.join(__dirname, filePath);
13950
+ await fileUploader.setFiles(imagePath);
13951
+ await this.neetoPlaywrightUtilities.interceptMultipleResponses({
13952
+ responseUrl: ROUTES.attachment,
13953
+ });
13954
+ await this.neetoPlaywrightUtilities.verifyToast();
13955
+ await test$1.expect(this.attachmentPreview).toBeVisible();
13956
+ await this.attachmentPreview
13957
+ .getByTestId(COMMON_SELECTORS.dropdownIcon)
13958
+ .click();
13959
+ await this.page
13960
+ .getByTestId(NEETO_EDITOR_SELECTORS.attachmentPreviewDeleteButton)
13961
+ .click();
13962
+ await this.page
13963
+ .getByTestId(COMMON_SELECTORS.alertModalSubmitButton)
13964
+ .click();
13965
+ await this.neetoPlaywrightUtilities.verifyToast({
13966
+ message: ATTACHMENT_DELETION_TOASTR_MESSAGE,
13967
+ });
13968
+ };
13969
+ this.verifyImageUploadOption = async ({ imageUrl, filePath, }) => {
13970
+ await this.imageUploadOption.click();
13971
+ const fileUploaderPromise = this.page.waitForEvent("filechooser");
13972
+ await this.page
13973
+ .getByTestId(NEETO_EDITOR_SELECTORS.imageUploadButton)
13974
+ .click();
13975
+ const fileUploader = await fileUploaderPromise;
13976
+ const imagePath = Path__namespace.join(__dirname, filePath);
13977
+ await fileUploader.setFiles(imagePath);
13978
+ await test$1.expect(this.imageWrapper).toBeVisible({ timeout: 15000 });
13979
+ await this.imageWrapper.getByTestId(COMMON_SELECTORS.dropdownIcon).click();
13980
+ await this.imageUploadDeleteButton.click();
13981
+ await test$1.expect(this.imageWrapper).toBeHidden({
13982
+ timeout: 15000,
13983
+ });
13984
+ await this.imageUploadOption.click();
13985
+ await this.page
13986
+ .getByTestId(NEETO_EDITOR_SELECTORS.imageUploadLinkButton)
13987
+ .click();
13988
+ await this.page
13989
+ .getByTestId(NEETO_EDITOR_SELECTORS.imageUploadLinkInput)
13990
+ .fill(imageUrl);
13991
+ await this.page
13992
+ .getByTestId(NEETO_EDITOR_SELECTORS.imageUploadLinkSubmitButton)
13993
+ .click();
13994
+ await test$1.expect(this.imageWrapper).toBeVisible({ timeout: 15000 });
13995
+ await this.imageWrapper.getByTestId(COMMON_SELECTORS.dropdownIcon).click();
13996
+ await this.imageUploadDeleteButton.click();
13997
+ await test$1.expect(this.imageWrapper).toBeHidden({
13998
+ timeout: 15000,
13999
+ });
14000
+ };
14001
+ this.verifyCannedResponseOption = async (cannedResponseSuccessMessage) => {
14002
+ await this.cannedResponseOption.click();
14003
+ await test$1.expect(this.page.getByTestId(COMMON_SELECTORS.paneHeader)).toContainText(DESCRIPTION_EDITOR_TEXTS.cannedResponseHeader);
14004
+ await this.page
14005
+ .getByTestId(NEETO_EDITOR_SELECTORS.cannedResponseSelectContainer)
14006
+ .fill(this.t("neetoRules.labels.feedback"));
14007
+ await this.page
14008
+ .getByTestId(COMMON_SELECTORS.selectOption(this.t("neetoRules.labels.feedback")))
14009
+ .click();
14010
+ await this.page.getByTestId(NEETO_EDITOR_SELECTORS.applyButton).click();
14011
+ await this.neetoPlaywrightUtilities.verifyToast({
14012
+ message: cannedResponseSuccessMessage,
14013
+ });
14014
+ };
14015
+ this.verifyVideoEmbedOption = async (videoUrl) => {
14016
+ await this.videoEmbedOption.click();
14017
+ await this.videoEmbedInput.fill(videoUrl);
14018
+ await this.page
14019
+ .getByTestId(NEETO_EDITOR_SELECTORS.videoEmbedSubmit)
14020
+ .click();
14021
+ await test$1.expect(this.videoWrapperSelector).toBeVisible({ timeout: 15000 });
14022
+ await this.videoWrapperSelector
14023
+ .getByTestId(COMMON_SELECTORS.dropdownIcon)
14024
+ .click();
14025
+ await this.imageUploadDeleteButton.click();
14026
+ await test$1.expect(this.videoWrapperSelector).toBeHidden({
14027
+ timeout: 15000,
14028
+ });
14029
+ };
14030
+ this.verifyEmojiSelector = async () => {
14031
+ await this.emojiSelector.click();
14032
+ const emojiContainer = this.page.getByTestId(NEETO_EDITOR_SELECTORS.emojiContainer);
14033
+ await test$1.expect(emojiContainer).toBeVisible({
14034
+ timeout: 10000,
14035
+ });
14036
+ await emojiContainer
14037
+ .getByPlaceholder(DESCRIPTION_EDITOR_TEXTS.search)
14038
+ .fill(EMOJI_LABEL);
14039
+ await this.page.keyboard.press("Enter");
14040
+ await test$1.expect(this.contentField).toContainText("👍");
14041
+ await this.page.keyboard.press("Escape");
14042
+ };
14043
+ this.verifyDynamicVariables = async (dynamicVariables) => {
14044
+ for (const dynamicVariable of dynamicVariables) {
14045
+ await this.dynamicVariablesButton.click();
14046
+ await test$1.expect(this.page.getByTestId(COMMON_SELECTORS.dropdownContainer)).toBeVisible();
14042
14047
  await this.page
14043
- .getByRole("button", { name: DESCRIPTION_EDITOR_TEXTS.emoji })
14048
+ .getByTestId(NEETO_EDITOR_SELECTORS.dynamicVariableSelector(dynamicVariable))
14044
14049
  .click();
14045
- await test$1.expect(this.page.getByTestId(NEETO_EDITOR_SELECTORS.emojiContainer)).toBeVisible({
14046
- timeout: 10000,
14047
- });
14048
- await this.page
14049
- .getByTestId(NEETO_EDITOR_SELECTORS.emojiContainer)
14050
- .getByPlaceholder(DESCRIPTION_EDITOR_TEXTS.search)
14051
- .fill(EMOJI_LABEL);
14052
- await this.page.keyboard.press("Enter");
14053
- await test$1.expect(editorWrapper.getByTestId(NEETO_EDITOR_SELECTORS.contentField)).toContainText("👍");
14054
- await this.page.keyboard.press("Escape");
14050
+ await test$1.expect(this.contentField.getByText(dynamicVariable)).toBeVisible();
14055
14051
  }
14056
- if (dynamicVariables &&
14057
- (await editorWrapper
14058
- .getByTestId(NEETO_EDITOR_SELECTORS.dynamicVariablesButton)
14059
- .isVisible())) {
14060
- for (const dynamicVariable of dynamicVariables) {
14061
- await editorWrapper
14062
- .getByTestId(NEETO_EDITOR_SELECTORS.dynamicVariablesButton)
14063
- .click();
14064
- await test$1.expect(this.page.getByTestId(COMMON_SELECTORS.dropdownContainer)).toBeVisible();
14065
- await this.page
14066
- .getByTestId(NEETO_EDITOR_SELECTORS.dynamicVariableSelector(dynamicVariable))
14067
- .click();
14068
- await test$1.expect(editorWrapper
14069
- .getByTestId(NEETO_EDITOR_SELECTORS.contentField)
14070
- .getByText(dynamicVariable)).toBeVisible();
14071
- }
14052
+ };
14053
+ this.verifyDescriptionEditor = async ({ text, 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, }) => {
14054
+ await this.contentField.fill(text);
14055
+ await this.verifyFontSize(defaultFontSizeOption);
14056
+ if (await this.assertOptionVisibility(this.paragraphSelector)) {
14057
+ await this.paragraphSelector.click();
14058
+ const paragraphRole = DESCRIPTION_EDITOR_TEXTS.paragraphOption;
14059
+ await test$1.expect(this.contentField.getByRole(paragraphRole)).toBeVisible();
14072
14060
  }
14061
+ (await this.fixedMenuArrowSelector.isVisible()) &&
14062
+ (await this.fixedMenuArrowSelector.click());
14063
+ await this.editorWrapper.getByText(text).click({ clickCount: 3 });
14064
+ await this.verifyTextModifiers();
14065
+ await this.verifyTextDeskModifier();
14066
+ await this.verifyListModifiers();
14067
+ (await this.assertOptionVisibility(this.editorLinkButton)) &&
14068
+ (await this.verifyEditorLinkButton(linkUrl));
14069
+ (await this.assertOptionVisibility(this.editorAttachmentsButton)) &&
14070
+ (await this.verifyEditorAttachmentsButton(filePath));
14071
+ (await this.assertOptionVisibility(this.imageUploadOption)) &&
14072
+ (await this.verifyImageUploadOption({
14073
+ imageUrl,
14074
+ filePath,
14075
+ }));
14076
+ (await this.assertOptionVisibility(this.cannedResponseOption)) &&
14077
+ (await this.verifyCannedResponseOption(cannedResponseSuccessMessage));
14078
+ (await this.assertOptionVisibility(this.videoEmbedOption)) &&
14079
+ (await this.verifyVideoEmbedOption(videoUrl));
14080
+ (await this.assertOptionVisibility(this.emojiSelector)) &&
14081
+ (await this.verifyEmojiSelector());
14082
+ dynamicVariables &&
14083
+ (await this.assertOptionVisibility(this.dynamicVariablesButton)) &&
14084
+ (await this.verifyDynamicVariables(dynamicVariables));
14073
14085
  };
14074
14086
  this.page = page;
14075
14087
  this.neetoPlaywrightUtilities = neetoPlaywrightUtilities;
14076
14088
  this.t = playwrightI18nextFixture.getI18nInstance().t;
14077
- this.paragraphSelector = this.page.getByTestId(NEETO_EDITOR_SELECTORS.paragraphOption);
14078
- this.fixedMenuArrowSelector = this.page.getByTestId(NEETO_EDITOR_SELECTORS.fixedMenuArrow);
14079
- this.editorLinkButton = this.page.getByTestId(NEETO_EDITOR_SELECTORS.linkOption);
14080
- this.attachmentPreview = this.page.getByTestId(NEETO_EDITOR_SELECTORS.attachmentPreview);
14081
- this.editorAttachmentsButton = this.page.getByTestId(NEETO_EDITOR_SELECTORS.editorAttachmentsButton);
14082
- this.imageWrapper = this.page.getByTestId(NEETO_EDITOR_SELECTORS.imageWrapper);
14083
- this.imageUploadDeleteButton = this.page.getByTestId(NEETO_EDITOR_SELECTORS.imageUploadDeleteButton);
14084
- this.imageUploadOption = this.page.getByTestId(NEETO_EDITOR_SELECTORS.imageUploadOption);
14085
- this.cannedResponseOption = this.page.getByTestId(NEETO_EDITOR_SELECTORS.cannedResponseOption);
14086
- this.videoEmbedOption = this.page.getByTestId(NEETO_EDITOR_SELECTORS.videoEmbedOption);
14089
+ this.editorWrapper = this.page;
14090
+ if (editorWrapper)
14091
+ this.editorWrapper = editorWrapper;
14092
+ this.paragraphSelector = this.editorWrapper.getByTestId(NEETO_EDITOR_SELECTORS.paragraphOption);
14093
+ this.fixedMenuArrowSelector = this.editorWrapper.getByTestId(NEETO_EDITOR_SELECTORS.fixedMenuArrow);
14094
+ this.editorLinkButton = this.editorWrapper.getByTestId(NEETO_EDITOR_SELECTORS.linkOption);
14095
+ this.attachmentPreview = this.editorWrapper.getByTestId(NEETO_EDITOR_SELECTORS.attachmentPreview);
14096
+ this.editorAttachmentsButton = this.editorWrapper.getByTestId(NEETO_EDITOR_SELECTORS.editorAttachmentsButton);
14097
+ this.imageWrapper = this.editorWrapper.getByTestId(NEETO_EDITOR_SELECTORS.imageWrapper);
14098
+ this.imageUploadDeleteButton = this.editorWrapper.getByTestId(NEETO_EDITOR_SELECTORS.imageUploadDeleteButton);
14099
+ this.imageUploadOption = this.editorWrapper.getByTestId(NEETO_EDITOR_SELECTORS.imageUploadOption);
14100
+ this.cannedResponseOption = this.editorWrapper.getByTestId(NEETO_EDITOR_SELECTORS.cannedResponseOption);
14101
+ this.videoEmbedOption = this.editorWrapper.getByTestId(NEETO_EDITOR_SELECTORS.videoEmbedOption);
14087
14102
  this.videoEmbedInput = this.page.getByTestId(NEETO_EDITOR_SELECTORS.videoEmbedInput);
14088
- this.videoWrapperSelector = this.page.getByTestId(NEETO_EDITOR_SELECTORS.videoWrapper);
14089
- this.emojiDropdownIcon = this.page
14090
- .getByTestId(NEETO_EDITOR_SELECTORS.fixedMenuWrapper)
14091
- .getByTestId(COMMON_SELECTORS.dropdownIcon);
14103
+ this.videoWrapperSelector = this.editorWrapper.getByTestId(NEETO_EDITOR_SELECTORS.videoWrapper);
14104
+ this.emojiSelector = this.editorWrapper.getByTestId(NEETO_EDITOR_SELECTORS.emojiOption);
14105
+ this.moreMenuSelector = this.editorWrapper.getByTestId(COMMON_SELECTORS.dropdownIcon);
14106
+ this.contentField = this.editorWrapper.getByTestId(NEETO_EDITOR_SELECTORS.contentField);
14107
+ this.dynamicVariablesButton = this.editorWrapper.getByTestId(NEETO_EDITOR_SELECTORS.dynamicVariablesButton);
14092
14108
  }
14093
14109
  }
14094
14110