@bigbinary/neeto-playwright-commons 1.9.2 → 1.9.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
@@ -7,12 +7,12 @@ var child_process = require('child_process');
7
7
  var fs$d = require('fs');
8
8
  var ramda = require('ramda');
9
9
  var require$$0$2 = require('util');
10
+ var Path = require('path');
10
11
  var faker = require('@faker-js/faker');
11
12
  var MailosaurClient = require('mailosaur');
12
13
  var dayjs = require('dayjs');
13
14
  var require$$1$1 = require('tty');
14
15
  var require$$0$3 = require('os');
15
- var Path = require('path');
16
16
  var Stream$4 = require('stream');
17
17
  var require$$0$4 = require('events');
18
18
  var playwrightI18nextFixture = require('playwright-i18next-fixture');
@@ -53,11 +53,12 @@ var test__default = /*#__PURE__*/_interopDefaultLegacy(test$1);
53
53
  var fs__namespace = /*#__PURE__*/_interopNamespace(fs$d);
54
54
  var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs$d);
55
55
  var require$$0__default = /*#__PURE__*/_interopDefaultLegacy(require$$0$2);
56
+ var Path__default = /*#__PURE__*/_interopDefaultLegacy(Path);
57
+ var Path__namespace = /*#__PURE__*/_interopNamespace(Path);
56
58
  var MailosaurClient__default = /*#__PURE__*/_interopDefaultLegacy(MailosaurClient);
57
59
  var dayjs__default = /*#__PURE__*/_interopDefaultLegacy(dayjs);
58
60
  var require$$1__default = /*#__PURE__*/_interopDefaultLegacy(require$$1$1);
59
61
  var require$$0__default$1 = /*#__PURE__*/_interopDefaultLegacy(require$$0$3);
60
- var Path__default = /*#__PURE__*/_interopDefaultLegacy(Path);
61
62
  var Stream__default = /*#__PURE__*/_interopDefaultLegacy(Stream$4);
62
63
  var require$$0__default$2 = /*#__PURE__*/_interopDefaultLegacy(require$$0$4);
63
64
  var http__default = /*#__PURE__*/_interopDefaultLegacy(http$1);
@@ -72,6 +73,59 @@ var require$$1__default$1 = /*#__PURE__*/_interopDefaultLegacy(require$$1$2);
72
73
  var require$$4__default = /*#__PURE__*/_interopDefaultLegacy(require$$4$1);
73
74
  var require$$3__default$2 = /*#__PURE__*/_interopDefaultLegacy(require$$3$2);
74
75
 
76
+ const BASE_URL = "/api/v1";
77
+ const NEETO_AUTH_BASE_URL = (subdomain = "app") => `https://${subdomain}.neetoauth.net`;
78
+ const ROUTES = {
79
+ neetoAuthSignup: `${NEETO_AUTH_BASE_URL()}/signups/new`,
80
+ neetoAuth: NEETO_AUTH_BASE_URL(),
81
+ loginLink: "/login",
82
+ profile: "/profile",
83
+ admin: "/admin",
84
+ myProfile: "/my/profile",
85
+ authSettings: "/settings",
86
+ webhooks: "/webhooks",
87
+ login: `${BASE_URL}/login`,
88
+ signup: `${BASE_URL}/signups`,
89
+ subdomainAvailability: `${BASE_URL}/subdomain_availability`,
90
+ countries: `${BASE_URL}/countries`,
91
+ neetoApps: `${BASE_URL}/neeto_apps`,
92
+ directUploads: "/direct_uploads",
93
+ teamMembers: {
94
+ all: "/team_members*/**",
95
+ bulkUpdate: "/team_members/teams/bulk_update",
96
+ index: "/team_members/teams",
97
+ show: (id) => `/team_members/teams/${id}`,
98
+ },
99
+ attachment: `/neeto_editor${BASE_URL}/direct_uploads/attach`,
100
+ };
101
+ const API_ROUTES = {
102
+ teamMembers: {
103
+ all: "/team_members*/**",
104
+ bulkUpdate: "/team_members/teams/bulk_update",
105
+ index: "/team_members/teams",
106
+ show: (id) => `/team_members/teams/${id}`,
107
+ },
108
+ integrations: {
109
+ zapier: {
110
+ api_keys: "/neeto_integrations/zapier/api_keys",
111
+ },
112
+ },
113
+ };
114
+ const THIRD_PARTY_ROUTES = {
115
+ webhooks: { site: "https://webhook.site/" },
116
+ slack: {
117
+ loginWithPassword: (workspace) => `https://${workspace}.slack.com/sign_in_with_password`,
118
+ },
119
+ zapier: {
120
+ login: "https://zapier.com/app/login",
121
+ logOut: "https://zapier.com/logout",
122
+ zapEditor: (zapId) => `https://zapier.com/editor/${zapId}`,
123
+ },
124
+ };
125
+ const NEETO_ROUTES = {
126
+ imageUploader: "/neeto_image_uploader_engine",
127
+ };
128
+
75
129
  const NEETO_FILTERS_SELECTORS = {
76
130
  emailSelectContainer: "email-select-container-wrapper",
77
131
  filterPaneHeading: "neeto-filters-pane-header",
@@ -91,6 +145,34 @@ const NEETO_FILTERS_SELECTORS = {
91
145
  searchTermBlock: "neeto-filters-search-term-block",
92
146
  };
93
147
 
148
+ const NEETO_IMAGE_UPLOADER_SELECTORS = {
149
+ imageUploaderWrapper: "image-uploader-wrapper",
150
+ browseText: "neeto-image-uploader-browse-text",
151
+ fileInput: "neeto-image-uploader-file-input",
152
+ uploadedImage: "uploaded-image",
153
+ uploadNewAsset: "upload-new-asset",
154
+ basicImageUploaderRemoveButton: "basic-image-uploader-remove-button",
155
+ removeButton: "image-uploader-remove-button",
156
+ openImageLibraryButton: "image-uploader-open-image-library-button",
157
+ openAssetLibraryButton: "open-asset-library-button",
158
+ imageEditorBackButton: "image-editor-back-button",
159
+ aspectRatioWidthInput: "aspect-ratio-width-input",
160
+ aspectRatioHeightInput: "aspect-ratio-height-input",
161
+ cropSubmitButton: "neeto-image-uploader-crop-submit-button",
162
+ restrictionMessage: "neeto-image-uploader-restriction-message",
163
+ progressBar: "neeto-image-uploader-progress-bar",
164
+ myImagesTab: "neeto-image-uploader-my-images-tab",
165
+ unsplashTab: "neeto-image-uploader-unsplash-tab",
166
+ nthLibraryImage: (index) => `niu-library-image-${index}`,
167
+ nthUnsplashImage: (index) => `niu-unsplash-image-${index}`,
168
+ unsplashSearchInput: "niu-unsplash-image-picker-search-input",
169
+ imageEditorUploadedImage: "image-editor-uploaded-image",
170
+ selectOriginalImageSwitch: "select-original-image-switch",
171
+ lockAspectRatioSwitch: "lock-aspect-ratio-switch",
172
+ widthInputField: "width-input-field",
173
+ heightInputField: "height-input-field",
174
+ };
175
+
94
176
  const ENVIRONMENT = {
95
177
  development: "development",
96
178
  staging: "staging",
@@ -2550,6 +2632,12 @@ var lib$7 = {
2550
2632
 
2551
2633
  var qs$1 = /*@__PURE__*/getDefaultExportFromCjs(lib$7);
2552
2634
 
2635
+ const getImagePathAndName = (localImagePath) => {
2636
+ const imagePath = Path__default["default"].join(__dirname, localImagePath);
2637
+ const imageName = Path__default["default"].basename(localImagePath, Path__default["default"].extname(localImagePath));
2638
+ return { imagePath, imageName };
2639
+ };
2640
+
2553
2641
  class CustomCommands {
2554
2642
  constructor(page, request, baseURL = process.env.BASE_URL) {
2555
2643
  this.interceptMultipleResponses = ({ responseUrl = "", responseStatus = 200, times = 1, baseUrl, customPageContext, timeout = 35000, } = {}) => {
@@ -2664,6 +2752,20 @@ class CustomCommands {
2664
2752
  await test$1.expect(this.page.getByTestId(countSelector)).toContainText(countText);
2665
2753
  }).toPass({ timeout: 15000 });
2666
2754
  };
2755
+ this.uploadImage = async (localImagePath) => {
2756
+ const { imageName, imagePath } = getImagePathAndName(localImagePath);
2757
+ await this.page
2758
+ .getByTestId(NEETO_IMAGE_UPLOADER_SELECTORS.browseText)
2759
+ .click();
2760
+ const uploadFile = this.interceptMultipleResponses({
2761
+ responseUrl: ROUTES.directUploads,
2762
+ });
2763
+ await this.page
2764
+ .getByTestId(NEETO_IMAGE_UPLOADER_SELECTORS.fileInput)
2765
+ .setInputFiles(imagePath);
2766
+ await uploadFile;
2767
+ await test$1.expect(this.page.getByTestId(NEETO_IMAGE_UPLOADER_SELECTORS.uploadedImage)).toHaveAttribute("src", new RegExp(imageName), { timeout: 20000 });
2768
+ };
2667
2769
  this.page = page;
2668
2770
  this.responses = [];
2669
2771
  this.request = request;
@@ -12594,54 +12696,6 @@ class EmbedBase {
12594
12696
  }
12595
12697
  }
12596
12698
 
12597
- const BASE_URL = "/api/v1";
12598
- const NEETO_AUTH_BASE_URL = (subdomain = "app") => `https://${subdomain}.neetoauth.net`;
12599
- const ROUTES = {
12600
- neetoAuthSignup: `${NEETO_AUTH_BASE_URL()}/signups/new`,
12601
- neetoAuth: NEETO_AUTH_BASE_URL(),
12602
- loginLink: "/login",
12603
- profile: "/profile",
12604
- admin: "/admin",
12605
- myProfile: "/my/profile",
12606
- authSettings: "/settings",
12607
- webhooks: "/webhooks",
12608
- login: `${BASE_URL}/login`,
12609
- signup: `${BASE_URL}/signups`,
12610
- subdomainAvailability: `${BASE_URL}/subdomain_availability`,
12611
- countries: `${BASE_URL}/countries`,
12612
- neetoApps: `${BASE_URL}/neeto_apps`,
12613
- teamMembers: {
12614
- all: "/team_members*/**",
12615
- bulkUpdate: "/team_members/teams/bulk_update",
12616
- index: "/team_members/teams",
12617
- show: (id) => `/team_members/teams/${id}`,
12618
- },
12619
- };
12620
- const API_ROUTES = {
12621
- teamMembers: {
12622
- all: "/team_members*/**",
12623
- bulkUpdate: "/team_members/teams/bulk_update",
12624
- index: "/team_members/teams",
12625
- show: (id) => `/team_members/teams/${id}`,
12626
- },
12627
- integrations: {
12628
- zapier: {
12629
- api_keys: "/neeto_integrations/zapier/api_keys",
12630
- },
12631
- },
12632
- };
12633
- const THIRD_PARTY_ROUTES = {
12634
- webhooks: { site: "https://webhook.site/" },
12635
- slack: {
12636
- loginWithPassword: (workspace) => `https://${workspace}.slack.com/sign_in_with_password`,
12637
- },
12638
- zapier: {
12639
- login: "https://zapier.com/app/login",
12640
- logOut: "https://zapier.com/logout",
12641
- zapEditor: (zapId) => `https://zapier.com/editor/${zapId}`,
12642
- },
12643
- };
12644
-
12645
12699
  const CHAT_WIDGET_TEXTS = {
12646
12700
  newConversation: "New Conversation",
12647
12701
  welcomeChatBubble: "Hi! I'm here to assist you with any questions you may have. What can I do for you?",
@@ -12690,6 +12744,8 @@ const TOASTR_MESSAGES = {
12690
12744
  zapierApiKeyGenerated: "Zapier API key is generated successfully!",
12691
12745
  };
12692
12746
  const ZAPIER_LIMIT_EXHAUSTED_MESSAGE = "Zapier free task limit is exhausted. Test will be aborted";
12747
+ const EMOJI_PICKER_LABEL = "Smileys & People";
12748
+ const ATTACHMENT_DELETION_TOASTR_MESSAGE = "Attachment has been successfully deleted.";
12693
12749
 
12694
12750
  const HELP_CENTER_SELECTORS = {
12695
12751
  helpButton: "help-button",
@@ -13526,6 +13582,463 @@ class ZapierPage extends IntegrationBase {
13526
13582
  }
13527
13583
  }
13528
13584
 
13585
+ const DESCRIPTION_EDITOR_TEXTS = {
13586
+ fontSize: "Font size",
13587
+ paragraph: "Paragraph",
13588
+ pasteLink: "Paste the link here...",
13589
+ invalidURLError: "Please enter a valid URL",
13590
+ pasteURL: "Paste URL",
13591
+ delete: "Delete",
13592
+ linkTag: "a",
13593
+ link: "Link",
13594
+ cannedResponseHeader: "Canned responses",
13595
+ paragraphOption: "paragraph",
13596
+ };
13597
+ const EXPANDED_FONT_SIZE = {
13598
+ h1: "Heading 1",
13599
+ h2: "Heading 2",
13600
+ h3: "Heading 3",
13601
+ h4: "Heading 4",
13602
+ h5: "Heading 5",
13603
+ };
13604
+ const TEXT_MODIFIER_TAGS = {
13605
+ underlineOption: "u",
13606
+ strikeOption: "s",
13607
+ highlightOption: "mark",
13608
+ };
13609
+ const TEXT_MODIFIER_ROLES = {
13610
+ boldOption: "strong",
13611
+ italicsOption: "emphasis",
13612
+ blockquoteOption: "blockquote",
13613
+ codeblockOption: "code",
13614
+ codeOption: "code",
13615
+ };
13616
+ const LIST_MODIFIER_TAGS = {
13617
+ bulletListOption: "ul",
13618
+ orderedListOption: "ol",
13619
+ };
13620
+
13621
+ const NEETO_EDITOR_SELECTORS = {
13622
+ boldOption: "neeto-editor-fixed-menu-bold-option",
13623
+ italicOption: "neeto-editor-fixed-menu-italic-option",
13624
+ underlineOption: "neeto-editor-fixed-menu-underline-option",
13625
+ strikeOption: "neeto-editor-fixed-menu-strike-option",
13626
+ codeBlockOption: "neeto-editor-fixed-menu-code-option",
13627
+ highlightOption: "neeto-editor-fixed-menu-highlight-option",
13628
+ linkInput: "neeto-editor-fixed-menu-link-option-input",
13629
+ linkSubmitButton: "neeto-editor-fixed-menu-link-option-link-button",
13630
+ commandList: (index) => `neeto-editor-command-list-item-${index}`,
13631
+ imageUploadUrlSubmitButton: "neeto-editor-media-upload-url-submit",
13632
+ imageUploadUrlInputTextField: "neeto-editor-media-upload-url-input",
13633
+ uploadInput: "neeto-editor-media-uploader-input",
13634
+ editorMenuBarWrapper: "neeto-editor-fixed-menu-wrapper",
13635
+ undoOption: "neeto-editor-fixed-menu-undo-option",
13636
+ redoOption: "neeto-editor-fixed-menu-redo-option",
13637
+ imageWrapper: "neeto-editor-image-wrapper",
13638
+ contentField: "neeto-editor-content",
13639
+ addLinkButton: "neeto-editor-fixed-menu-link-option",
13640
+ addLinkTextField: "neeto-editor-add-link-text-input",
13641
+ addURLTextField: "neeto-editor-add-link-url-input",
13642
+ submitLinkButton: "neeto-editor-add-link",
13643
+ fontSizeDropdown: (currentOption = "Paragraph") => `${joinHyphenCase(currentOption)}-dropdown-icon`,
13644
+ fixedMenuArrow: "neeto-editor-fixed-menu-arrow",
13645
+ cannedResponseOption: "neeto-editor-fixed-menu-canned-responses-option",
13646
+ cannedResponseSelectContainer: "select-a-canned-response-select-container",
13647
+ fixedMenuWrapper: "neeto-editor-fixed-menu-wrapper",
13648
+ linkOption: "neeto-editor-fixed-menu-link-option",
13649
+ addLinkUrlInput: "neeto-editor-add-link-url-input",
13650
+ addLinkDoneButton: "neeto-editor-add-link",
13651
+ unlinkButton: "neeto-editor-link-popover-unlink",
13652
+ editorAttachmentsButton: "neeto-editor-fixed-menu-attachments-option",
13653
+ attachmentPreviewDeleteButton: "neeto-editor-preview-delete-button",
13654
+ imageUploadOption: "neeto-editor-fixed-menu-image-upload-option",
13655
+ imageUploadLinkInput: "neeto-editor-media-upload-url-input",
13656
+ imageUploadButton: "neeto-editor-media-uploader-dnd",
13657
+ imageUploadLinkSubmitButton: "neeto-editor-media-upload-url-submit",
13658
+ applyButton: "apply-button",
13659
+ videoEmbedOption: "neeto-editor-fixed-menu-video-embed-option",
13660
+ videoEmbedInput: "neeto-editor-embed-input",
13661
+ videoEmbedSubmit: "neeto-editor-embed-cancel",
13662
+ // TODO: Fix the selector after the issue is resolved: https://github.com/bigbinary/neeto-editor/issues/1047
13663
+ videoWrapper: ".neeto-editor__video-wrapper",
13664
+ paragraphOption: "neeto-editor-fixed-menu-font-size-option-body2",
13665
+ attachmentPreview: "ne-attachments-wrapper",
13666
+ };
13667
+ const NEETO_TEXT_MODIFIER_SELECTORS = {
13668
+ strikeOption: "neeto-editor-fixed-menu-strike-option",
13669
+ underlineOption: "neeto-editor-fixed-menu-underline-option",
13670
+ highlightOption: "neeto-editor-fixed-menu-highlight-option",
13671
+ };
13672
+ const TEXT_MODIFIER_SELECTORS = {
13673
+ boldOption: "neeto-editor-fixed-menu-bold-option",
13674
+ italicsOption: "neeto-editor-fixed-menu-italic-option",
13675
+ codeOption: "neeto-editor-fixed-menu-code-option",
13676
+ blockquoteOption: "neeto-editor-fixed-menu-block-quote-option",
13677
+ codeblockOption: "neeto-editor-fixed-menu-code-block-option",
13678
+ };
13679
+ const LIST_MODIFIER_SELECTORS = {
13680
+ bulletListOption: "neeto-editor-fixed-menu-bullet-list-option",
13681
+ orderedListOption: "neeto-editor-fixed-menu-ordered-list-option",
13682
+ };
13683
+ const FONT_SIZE_SELECTORS = {
13684
+ h1: "neeto-editor-fixed-menu-font-size-option-h1",
13685
+ h2: "neeto-editor-fixed-menu-font-size-option-h2",
13686
+ h3: "neeto-editor-fixed-menu-font-size-option-h3",
13687
+ h4: "neeto-editor-fixed-menu-font-size-option-h4",
13688
+ h5: "neeto-editor-fixed-menu-font-size-option-h5",
13689
+ };
13690
+
13691
+ /* eslint-disable playwright/no-nth-methods */
13692
+ class EditorPage {
13693
+ constructor(page, neetoPlaywrightUtilities) {
13694
+ this.verifyDescriptionEditor = async ({ text, linkUrl = faker.faker.internet.url(), fileName = "../../../e2e/assets/images/BigBinary.png", imageUrl = "https://picsum.photos/200/300", videoUrl = "https://youtu.be/jNQXAC9IVRw", cannedResponseSuccessMessage, }) => {
13695
+ await this.page.getByTestId(NEETO_EDITOR_SELECTORS.contentField).fill(text);
13696
+ await this.page
13697
+ .getByTestId(NEETO_EDITOR_SELECTORS.fontSizeDropdown())
13698
+ .click();
13699
+ const fontSize = Object.keys(FONT_SIZE_SELECTORS);
13700
+ for (const font of fontSize) {
13701
+ const fontKey = font;
13702
+ await this.page.getByTestId(FONT_SIZE_SELECTORS[fontKey]).click();
13703
+ await test$1.expect(this.page
13704
+ .getByTestId(NEETO_EDITOR_SELECTORS.contentField)
13705
+ .getByRole("heading", { level: Number(font.slice(1)) })).toBeVisible();
13706
+ await this.page
13707
+ .getByTestId(NEETO_EDITOR_SELECTORS.fontSizeDropdown(EXPANDED_FONT_SIZE[fontKey]))
13708
+ .click();
13709
+ }
13710
+ if (await this.paragraphSelector.isVisible()) {
13711
+ await this.paragraphSelector.click();
13712
+ const paragraphRole = DESCRIPTION_EDITOR_TEXTS.paragraphOption;
13713
+ await test$1.expect(this.page
13714
+ .getByTestId(NEETO_EDITOR_SELECTORS.contentField)
13715
+ .getByRole(paragraphRole)).toBeVisible();
13716
+ }
13717
+ (await this.fixedMenuArrowSelector.isVisible()) &&
13718
+ (await this.fixedMenuArrowSelector.click());
13719
+ await this.page.getByText(text).click({ clickCount: 3 });
13720
+ const textModifier = Object.keys(TEXT_MODIFIER_SELECTORS);
13721
+ for (const modifier of textModifier) {
13722
+ const modifierKey = modifier;
13723
+ const textModifierRole = TEXT_MODIFIER_ROLES[modifierKey];
13724
+ const textModifierSelector = this.page.getByTestId(TEXT_MODIFIER_SELECTORS[modifierKey]);
13725
+ if (await textModifierSelector.isVisible()) {
13726
+ await textModifierSelector.click();
13727
+ await test$1.expect(this.page
13728
+ .getByTestId(NEETO_EDITOR_SELECTORS.contentField)
13729
+ .getByRole(textModifierRole)).toBeVisible();
13730
+ await textModifierSelector.click();
13731
+ }
13732
+ }
13733
+ const textDeskModifier = Object.keys(NEETO_TEXT_MODIFIER_SELECTORS);
13734
+ for (const modifier of textDeskModifier) {
13735
+ const modifierKey = modifier;
13736
+ const textModifierSelector = this.page.getByTestId(NEETO_TEXT_MODIFIER_SELECTORS[modifierKey]);
13737
+ if (await textModifierSelector.isVisible()) {
13738
+ await textModifierSelector.click();
13739
+ await test$1.expect(this.page
13740
+ .getByTestId(NEETO_EDITOR_SELECTORS.contentField)
13741
+ .locator(TEXT_MODIFIER_TAGS[modifierKey])).toBeVisible();
13742
+ await textModifierSelector.click();
13743
+ }
13744
+ }
13745
+ const listModifier = Object.keys(LIST_MODIFIER_SELECTORS);
13746
+ for (const modifier of listModifier) {
13747
+ const modifierKey = modifier;
13748
+ const listModifierSelector = this.page.getByTestId(LIST_MODIFIER_SELECTORS[modifierKey]);
13749
+ if (await listModifierSelector.isVisible()) {
13750
+ await listModifierSelector.click();
13751
+ await test$1.expect(this.page
13752
+ .getByTestId(NEETO_EDITOR_SELECTORS.contentField)
13753
+ .locator(LIST_MODIFIER_TAGS[modifierKey])).toBeVisible();
13754
+ await listModifierSelector.click();
13755
+ }
13756
+ }
13757
+ if (await this.editorLinkButton.isVisible()) {
13758
+ await this.editorLinkButton.click();
13759
+ await this.page
13760
+ .getByTestId(NEETO_EDITOR_SELECTORS.addLinkUrlInput)
13761
+ .fill(linkUrl);
13762
+ await this.page
13763
+ .getByTestId(NEETO_EDITOR_SELECTORS.addLinkDoneButton)
13764
+ .click();
13765
+ const linkRole = DESCRIPTION_EDITOR_TEXTS.link;
13766
+ await test$1.expect(this.page
13767
+ .getByTestId(NEETO_EDITOR_SELECTORS.contentField)
13768
+ .getByRole(linkRole)).toBeVisible();
13769
+ await this.page.getByTestId(NEETO_EDITOR_SELECTORS.unlinkButton).click();
13770
+ }
13771
+ if (await this.editorAttachmentsButton.isVisible()) {
13772
+ const fileUploaderPromise = this.page.waitForEvent("filechooser");
13773
+ await this.editorAttachmentsButton.click();
13774
+ const fileUploader = await fileUploaderPromise;
13775
+ const imagePath = Path__namespace.join(__dirname, fileName);
13776
+ await fileUploader.setFiles(imagePath);
13777
+ await this.neetoPlaywrightUtilities.interceptMultipleResponses({
13778
+ responseUrl: ROUTES.attachment,
13779
+ });
13780
+ await this.neetoPlaywrightUtilities.verifySuccessToast();
13781
+ await test$1.expect(this.attachmentPreview).toBeVisible();
13782
+ await this.attachmentPreview
13783
+ .getByTestId(COMMON_SELECTORS.dropdownIcon)
13784
+ .click();
13785
+ await this.page
13786
+ .getByTestId(NEETO_EDITOR_SELECTORS.attachmentPreviewDeleteButton)
13787
+ .click();
13788
+ await this.page
13789
+ .getByTestId(COMMON_SELECTORS.alertModalSubmitButton)
13790
+ .click();
13791
+ }
13792
+ await this.neetoPlaywrightUtilities.verifySuccessToast({
13793
+ message: ATTACHMENT_DELETION_TOASTR_MESSAGE,
13794
+ });
13795
+ if (await this.imageUploadOption.isVisible()) {
13796
+ await this.imageUploadOption.click();
13797
+ const fileUploaderPromise = this.page.waitForEvent("filechooser");
13798
+ await this.page
13799
+ .getByTestId(NEETO_EDITOR_SELECTORS.imageUploadButton)
13800
+ .click();
13801
+ const fileUploader = await fileUploaderPromise;
13802
+ const imagePath = Path__namespace.join(__dirname, fileName);
13803
+ await fileUploader.setFiles(imagePath);
13804
+ await test$1.expect(this.imageWrapper).toBeVisible({ timeout: 15000 });
13805
+ await this.neetoPlaywrightUtilities.verifySuccessToast();
13806
+ await this.imageWrapper
13807
+ .getByTestId(COMMON_SELECTORS.dropdownIcon)
13808
+ .click();
13809
+ await this.imageUploadDeleteButton.click();
13810
+ await test$1.expect(this.imageWrapper).toBeHidden({
13811
+ timeout: 15000,
13812
+ });
13813
+ await this.imageUploadOption.click();
13814
+ // TODO: Fix the selector after the issue is resolved: https://github.com/bigbinary/neeto-editor/issues/1048
13815
+ await this.page
13816
+ .getByTestId(COMMON_SELECTORS.tabItem)
13817
+ .getByText(DESCRIPTION_EDITOR_TEXTS.link)
13818
+ .click();
13819
+ await this.page
13820
+ .getByTestId(NEETO_EDITOR_SELECTORS.imageUploadLinkInput)
13821
+ .fill(imageUrl);
13822
+ await this.page
13823
+ .getByTestId(NEETO_EDITOR_SELECTORS.imageUploadLinkSubmitButton)
13824
+ .click();
13825
+ await test$1.expect(this.imageWrapper).toBeVisible({ timeout: 15000 });
13826
+ await this.imageWrapper
13827
+ .getByTestId(COMMON_SELECTORS.dropdownIcon)
13828
+ .click();
13829
+ await this.imageUploadDeleteButton.click();
13830
+ await test$1.expect(this.imageWrapper).toBeHidden({
13831
+ timeout: 15000,
13832
+ });
13833
+ }
13834
+ if (await this.cannedResponseOption.isVisible()) {
13835
+ await this.cannedResponseOption.click();
13836
+ await test$1.expect(this.page.getByTestId(COMMON_SELECTORS.paneHeader)).toContainText(DESCRIPTION_EDITOR_TEXTS.cannedResponseHeader);
13837
+ await this.page
13838
+ .getByTestId(NEETO_EDITOR_SELECTORS.cannedResponseSelectContainer)
13839
+ .fill(this.t("neetoRules.labels.feedback"));
13840
+ await this.page
13841
+ .getByTestId(COMMON_SELECTORS.selectOption(this.t("neetoRules.labels.feedback")))
13842
+ .click();
13843
+ await this.page.getByTestId(NEETO_EDITOR_SELECTORS.applyButton).click();
13844
+ await this.neetoPlaywrightUtilities.verifySuccessToast({
13845
+ message: cannedResponseSuccessMessage,
13846
+ });
13847
+ }
13848
+ if (await this.page
13849
+ .getByTestId(NEETO_EDITOR_SELECTORS.videoEmbedOption)
13850
+ .isVisible()) {
13851
+ await this.videoEmbedOption.click();
13852
+ await this.videoEmbedOption.fill(videoUrl);
13853
+ await this.page
13854
+ .getByTestId(NEETO_EDITOR_SELECTORS.videoEmbedSubmit)
13855
+ .click();
13856
+ await test$1.expect(this.videoWrapperSelector).toBeVisible({ timeout: 15000 });
13857
+ await this.videoWrapperSelector
13858
+ .getByTestId(COMMON_SELECTORS.dropdownIcon)
13859
+ .click();
13860
+ await this.imageUploadDeleteButton.click();
13861
+ await test$1.expect(this.videoWrapperSelector).toBeHidden({
13862
+ timeout: 15000,
13863
+ });
13864
+ }
13865
+ if (await this.emojiDropdownIcon.isVisible()) {
13866
+ await this.emojiDropdownIcon.click();
13867
+ await this.page
13868
+ .getByRole("region", {
13869
+ name: EMOJI_PICKER_LABEL,
13870
+ })
13871
+ .getByText("👍")
13872
+ .click();
13873
+ await test$1.expect(this.page.getByTestId(NEETO_EDITOR_SELECTORS.contentField)).toContainText("👍");
13874
+ }
13875
+ };
13876
+ this.page = page;
13877
+ this.neetoPlaywrightUtilities = neetoPlaywrightUtilities;
13878
+ this.t = playwrightI18nextFixture.getI18nInstance().t;
13879
+ this.paragraphSelector = this.page.getByTestId(NEETO_EDITOR_SELECTORS.paragraphOption);
13880
+ this.fixedMenuArrowSelector = this.page.getByTestId(NEETO_EDITOR_SELECTORS.fixedMenuArrow);
13881
+ this.editorLinkButton = this.page.getByTestId(NEETO_EDITOR_SELECTORS.linkOption);
13882
+ this.attachmentPreview = this.page.getByTestId(NEETO_EDITOR_SELECTORS.attachmentPreview);
13883
+ this.editorAttachmentsButton = this.page.getByTestId(NEETO_EDITOR_SELECTORS.editorAttachmentsButton);
13884
+ this.imageWrapper = this.page.getByTestId(NEETO_EDITOR_SELECTORS.imageWrapper);
13885
+ // TODO: Fix the selector after the issue is resolved: https://github.com/bigbinary/neeto-editor/issues/1047
13886
+ this.imageUploadDeleteButton = this.page
13887
+ .getByTestId(COMMON_SELECTORS.dropdownContainer)
13888
+ .getByRole("button")
13889
+ .nth(3);
13890
+ this.imageUploadOption = this.page.getByTestId(NEETO_EDITOR_SELECTORS.imageUploadOption);
13891
+ this.cannedResponseOption = this.page.getByTestId(NEETO_EDITOR_SELECTORS.cannedResponseOption);
13892
+ this.videoEmbedOption = this.page.getByTestId(NEETO_EDITOR_SELECTORS.videoEmbedOption);
13893
+ // TODO: Fix the selector after the issue is resolved: https://github.com/bigbinary/neeto-editor/issues/1047
13894
+ this.videoWrapperSelector = this.page.locator(NEETO_EDITOR_SELECTORS.videoWrapper);
13895
+ this.emojiDropdownIcon = this.page
13896
+ .getByTestId(NEETO_EDITOR_SELECTORS.fixedMenuWrapper)
13897
+ .getByTestId(COMMON_SELECTORS.dropdownIcon);
13898
+ }
13899
+ }
13900
+
13901
+ class ImageUploader {
13902
+ constructor({ page, neetoPlaywrightUtilities, }) {
13903
+ this.submitCroppedImage = async () => {
13904
+ const cropImage = this.neetoPlaywrightUtilities.interceptMultipleResponses({
13905
+ responseUrl: ROUTES.directUploads,
13906
+ });
13907
+ await this.page
13908
+ .getByTestId(NEETO_IMAGE_UPLOADER_SELECTORS.cropSubmitButton)
13909
+ .click();
13910
+ await cropImage;
13911
+ };
13912
+ this.removeImage = async () => {
13913
+ await this.page
13914
+ .getByTestId(NEETO_IMAGE_UPLOADER_SELECTORS.imageUploaderWrapper)
13915
+ .getByTestId(COMMON_SELECTORS.dropdownIcon)
13916
+ .click();
13917
+ await this.page
13918
+ .getByTestId(NEETO_IMAGE_UPLOADER_SELECTORS.removeButton)
13919
+ .click();
13920
+ await test$1.expect(this.page.getByTestId(NEETO_IMAGE_UPLOADER_SELECTORS.uploadedImage)).toBeHidden();
13921
+ };
13922
+ this.openImageLibrary = async () => {
13923
+ const fetchImages = this.neetoPlaywrightUtilities.interceptMultipleResponses({
13924
+ responseUrl: NEETO_ROUTES.imageUploader,
13925
+ });
13926
+ await this.page
13927
+ .getByTestId(NEETO_IMAGE_UPLOADER_SELECTORS.openAssetLibraryButton)
13928
+ .click();
13929
+ await fetchImages;
13930
+ };
13931
+ this.cropImage = async ({ toggleAspectRatioLock = false, width = "100", height = "100", aspectRatioHeight = "9", aspectRatioWidth = "16", } = {}) => {
13932
+ toggleAspectRatioLock &&
13933
+ (await this.page
13934
+ .getByTestId(NEETO_IMAGE_UPLOADER_SELECTORS.lockAspectRatioSwitch)
13935
+ .click());
13936
+ await this.page
13937
+ .getByTestId(NEETO_IMAGE_UPLOADER_SELECTORS.aspectRatioHeightInput)
13938
+ .fill(aspectRatioHeight);
13939
+ await this.page
13940
+ .getByTestId(NEETO_IMAGE_UPLOADER_SELECTORS.aspectRatioWidthInput)
13941
+ .fill(aspectRatioWidth);
13942
+ await this.page
13943
+ .getByTestId(NEETO_IMAGE_UPLOADER_SELECTORS.widthInputField)
13944
+ .fill(width);
13945
+ await this.page
13946
+ .getByTestId(NEETO_IMAGE_UPLOADER_SELECTORS.heightInputField)
13947
+ .fill(height);
13948
+ };
13949
+ this.uploadNewImageFromLibrary = async ({ localImagePath, toggleOrginalImage = false, toggleAspectRatioLock = false, aspectRatioHeight = "9", aspectRatioWidth = "16", width = "100", height = "100", }) => {
13950
+ await this.openImageLibrary();
13951
+ const fileUploaderPromise = this.page.waitForEvent("filechooser");
13952
+ await this.page
13953
+ .getByTestId(NEETO_IMAGE_UPLOADER_SELECTORS.uploadNewAsset)
13954
+ .click();
13955
+ const fileUploader = await fileUploaderPromise;
13956
+ const { imagePath, imageName } = getImagePathAndName(localImagePath);
13957
+ await fileUploader.setFiles(imagePath);
13958
+ await test$1.expect(this.page.getByTestId(NEETO_IMAGE_UPLOADER_SELECTORS.imageEditorUploadedImage)).toHaveAttribute("src", new RegExp(imageName), { timeout: 20000 });
13959
+ toggleOrginalImage
13960
+ ? await this.page
13961
+ .getByTestId(NEETO_IMAGE_UPLOADER_SELECTORS.selectOriginalImageSwitch)
13962
+ .click()
13963
+ : await this.cropImage({
13964
+ toggleAspectRatioLock,
13965
+ aspectRatioHeight,
13966
+ aspectRatioWidth,
13967
+ width,
13968
+ height,
13969
+ });
13970
+ await this.submitCroppedImage();
13971
+ };
13972
+ this.selectImageFromWeb = async ({ nthImage = 0, searchTerm = "", toggleOrginalImage = false, toggleAspectRatioLock = false, aspectRatioHeight = "9", aspectRatioWidth = "16", width = "100", height = "100", } = {}) => {
13973
+ await this.openImageLibrary();
13974
+ const switchImageTab = this.neetoPlaywrightUtilities.interceptMultipleResponses({
13975
+ responseUrl: NEETO_ROUTES.imageUploader,
13976
+ });
13977
+ await this.page
13978
+ .getByTestId(NEETO_IMAGE_UPLOADER_SELECTORS.unsplashTab)
13979
+ .click();
13980
+ await switchImageTab;
13981
+ if (neetoCist.isNotEmpty(searchTerm)) {
13982
+ await this.page
13983
+ .getByTestId(NEETO_IMAGE_UPLOADER_SELECTORS.unsplashSearchInput)
13984
+ .fill(searchTerm);
13985
+ await test$1.expect(this.page.getByTestId(COMMON_SELECTORS.spinner)).toBeHidden({
13986
+ timeout: 10000,
13987
+ });
13988
+ }
13989
+ await this.page
13990
+ .getByTestId(NEETO_IMAGE_UPLOADER_SELECTORS.nthUnsplashImage(nthImage))
13991
+ .click();
13992
+ await test$1.expect(this.page.getByTestId(COMMON_SELECTORS.spinner)).toBeHidden({
13993
+ timeout: 10000,
13994
+ });
13995
+ toggleOrginalImage
13996
+ ? await this.page
13997
+ .getByTestId(NEETO_IMAGE_UPLOADER_SELECTORS.selectOriginalImageSwitch)
13998
+ .click()
13999
+ : await this.cropImage({
14000
+ toggleAspectRatioLock,
14001
+ aspectRatioHeight,
14002
+ aspectRatioWidth,
14003
+ width,
14004
+ height,
14005
+ });
14006
+ await this.submitCroppedImage();
14007
+ };
14008
+ this.selectImageFromLibrary = async ({ nthImage = 0, searchTerm = "", toggleOrginalImage = false, toggleAspectRatioLock = false, aspectRatioHeight = "9", aspectRatioWidth = "16", width = "100", height = "100", } = {}) => {
14009
+ await this.openImageLibrary();
14010
+ await test$1.expect(this.page.getByTestId(COMMON_SELECTORS.spinner)).toBeHidden({
14011
+ timeout: 10000,
14012
+ });
14013
+ if (neetoCist.isNotEmpty(searchTerm)) {
14014
+ await this.page
14015
+ .getByTestId(NEETO_IMAGE_UPLOADER_SELECTORS.unsplashSearchInput)
14016
+ .fill(searchTerm);
14017
+ await test$1.expect(this.page.getByTestId(COMMON_SELECTORS.spinner)).toBeHidden({
14018
+ timeout: 10000,
14019
+ });
14020
+ }
14021
+ await this.page
14022
+ .getByTestId(NEETO_IMAGE_UPLOADER_SELECTORS.nthLibraryImage(nthImage))
14023
+ .click();
14024
+ toggleOrginalImage
14025
+ ? await this.page
14026
+ .getByTestId(NEETO_IMAGE_UPLOADER_SELECTORS.selectOriginalImageSwitch)
14027
+ .click()
14028
+ : await this.cropImage({
14029
+ toggleAspectRatioLock,
14030
+ aspectRatioHeight,
14031
+ aspectRatioWidth,
14032
+ width,
14033
+ height,
14034
+ });
14035
+ await this.submitCroppedImage();
14036
+ };
14037
+ this.page = page;
14038
+ this.neetoPlaywrightUtilities = neetoPlaywrightUtilities;
14039
+ }
14040
+ }
14041
+
13529
14042
  const LOGIN_SELECTORS = {
13530
14043
  appleAuthenticationButton: "apple-authentication-button",
13531
14044
  emailTextField: "login-email-text-field",
@@ -13830,30 +14343,6 @@ const networkConditions = {
13830
14343
  },
13831
14344
  };
13832
14345
 
13833
- const NEETO_EDITOR_SELECTORS = {
13834
- boldOption: "neeto-editor-fixed-menu-bold-option",
13835
- italicOption: "neeto-editor-fixed-menu-italic-option",
13836
- underlineOption: "neeto-editor-fixed-menu-underline-option",
13837
- strikeOption: "neeto-editor-fixed-menu-strike-option",
13838
- codeBlockOption: "neeto-editor-fixed-menu-code-option",
13839
- highlightOption: "neeto-editor-fixed-menu-highlight-option",
13840
- linkInput: "neeto-editor-fixed-menu-link-option-input",
13841
- linkSubmitButton: "neeto-editor-fixed-menu-link-option-link-button",
13842
- commandList: (index) => `neeto-editor-command-list-item-${index}`,
13843
- imageUploadUrlSubmitButton: "neeto-editor-media-upload-url-submit",
13844
- imageUploadUrlInputTextField: "neeto-editor-media-upload-url-input",
13845
- uploadInput: "neeto-editor-media-uploader-input",
13846
- editorMenuBarWrapper: "neeto-editor-fixed-menu-wrapper",
13847
- undoOption: "neeto-editor-fixed-menu-undo-option",
13848
- redoOption: "neeto-editor-fixed-menu-redo-option",
13849
- imageWrapper: "neeto-editor-image-wrapper",
13850
- contentField: "neeto-editor-content",
13851
- addLinkButton: "neeto-editor-fixed-menu-link-option",
13852
- addLinkTextField: "neeto-editor-add-link-text-input",
13853
- addURLTextField: "neeto-editor-add-link-url-input",
13854
- submitLinkButton: "neeto-editor-add-link",
13855
- };
13856
-
13857
14346
  const MEMBER_SELECTORS = {
13858
14347
  membersTab: "members-nav-tab",
13859
14348
  newButton: "ntm-add-member-button",
@@ -147532,6 +148021,7 @@ const definePlaywrightConfig = (overrides) => {
147532
148021
  };
147533
148022
 
147534
148023
  exports.API_ROUTES = API_ROUTES;
148024
+ exports.ATTACHMENT_DELETION_TOASTR_MESSAGE = ATTACHMENT_DELETION_TOASTR_MESSAGE;
147535
148025
  exports.BASE_URL = BASE_URL;
147536
148026
  exports.CHANGELOG_WIDGET_SELECTORS = CHANGELOG_WIDGET_SELECTORS;
147537
148027
  exports.CHAT_WIDGET_SELECTORS = CHAT_WIDGET_SELECTORS;
@@ -147539,17 +148029,25 @@ exports.CHAT_WIDGET_TEXTS = CHAT_WIDGET_TEXTS;
147539
148029
  exports.COMMON_SELECTORS = COMMON_SELECTORS;
147540
148030
  exports.CREDENTIALS = CREDENTIALS;
147541
148031
  exports.CustomCommands = CustomCommands;
148032
+ exports.DESCRIPTION_EDITOR_TEXTS = DESCRIPTION_EDITOR_TEXTS;
147542
148033
  exports.EMBED_SELECTORS = EMBED_SELECTORS;
148034
+ exports.EMOJI_PICKER_LABEL = EMOJI_PICKER_LABEL;
147543
148035
  exports.ENVIRONMENT = ENVIRONMENT;
148036
+ exports.EXPANDED_FONT_SIZE = EXPANDED_FONT_SIZE;
148037
+ exports.EditorPage = EditorPage;
147544
148038
  exports.EmbedBase = EmbedBase;
148039
+ exports.FONT_SIZE_SELECTORS = FONT_SIZE_SELECTORS;
147545
148040
  exports.GLOBAL_TRANSLATIONS_PATTERN = GLOBAL_TRANSLATIONS_PATTERN;
147546
148041
  exports.HELP_CENTER_SELECTORS = HELP_CENTER_SELECTORS;
147547
148042
  exports.HelpAndProfilePage = HelpAndProfilePage;
147548
148043
  exports.INTEGRATIONS_TEXTS = INTEGRATIONS_TEXTS;
147549
148044
  exports.INTEGRATION_SELECTORS = INTEGRATION_SELECTORS;
147550
148045
  exports.IS_STAGING_ENV = IS_STAGING_ENV;
148046
+ exports.ImageUploader = ImageUploader;
147551
148047
  exports.IntegrationBase = IntegrationBase;
147552
148048
  exports.KEYBOARD_SHORTCUTS_SELECTORS = KEYBOARD_SHORTCUTS_SELECTORS;
148049
+ exports.LIST_MODIFIER_SELECTORS = LIST_MODIFIER_SELECTORS;
148050
+ exports.LIST_MODIFIER_TAGS = LIST_MODIFIER_TAGS;
147553
148051
  exports.LOGIN_SELECTORS = LOGIN_SELECTORS;
147554
148052
  exports.MEMBER_FORM_SELECTORS = MEMBER_FORM_SELECTORS;
147555
148053
  exports.MEMBER_SELECTORS = MEMBER_SELECTORS;
@@ -147559,6 +148057,9 @@ exports.MailosaurUtils = MailosaurUtils;
147559
148057
  exports.NEETO_AUTH_BASE_URL = NEETO_AUTH_BASE_URL;
147560
148058
  exports.NEETO_EDITOR_SELECTORS = NEETO_EDITOR_SELECTORS;
147561
148059
  exports.NEETO_FILTERS_SELECTORS = NEETO_FILTERS_SELECTORS;
148060
+ exports.NEETO_IMAGE_UPLOADER_SELECTORS = NEETO_IMAGE_UPLOADER_SELECTORS;
148061
+ exports.NEETO_ROUTES = NEETO_ROUTES;
148062
+ exports.NEETO_TEXT_MODIFIER_SELECTORS = NEETO_TEXT_MODIFIER_SELECTORS;
147562
148063
  exports.OTP_EMAIL_PATTERN = OTP_EMAIL_PATTERN;
147563
148064
  exports.OrganizationPage = OrganizationPage;
147564
148065
  exports.PROFILE_SECTION_SELECTORS = PROFILE_SECTION_SELECTORS;
@@ -147574,6 +148075,9 @@ exports.STORAGE_STATE = STORAGE_STATE;
147574
148075
  exports.SidebarSection = SidebarSection;
147575
148076
  exports.SlackPage = SlackPage;
147576
148077
  exports.TAGS_SELECTORS = TAGS_SELECTORS;
148078
+ exports.TEXT_MODIFIER_ROLES = TEXT_MODIFIER_ROLES;
148079
+ exports.TEXT_MODIFIER_SELECTORS = TEXT_MODIFIER_SELECTORS;
148080
+ exports.TEXT_MODIFIER_TAGS = TEXT_MODIFIER_TAGS;
147577
148081
  exports.THIRD_PARTY_ROUTES = THIRD_PARTY_ROUTES;
147578
148082
  exports.TOASTR_MESSAGES = TOASTR_MESSAGES;
147579
148083
  exports.USER_AGENTS = USER_AGENTS;
@@ -147596,6 +148100,7 @@ exports.generateRandomBypassEmail = generateRandomBypassEmail;
147596
148100
  exports.generateStagingData = generateStagingData;
147597
148101
  exports.getByDataQA = getByDataQA;
147598
148102
  exports.getGlobalUserState = getGlobalUserState;
148103
+ exports.getImagePathAndName = getImagePathAndName;
147599
148104
  exports.headerUtils = headerUtils;
147600
148105
  exports.hexToRGB = hexToRGB;
147601
148106
  exports.hyphenize = hyphenize;