@bigbinary/neeto-playwright-commons 1.10.2 → 1.10.4

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