@bigbinary/neeto-playwright-commons 1.9.20 → 1.9.22

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.d.ts CHANGED
@@ -27,6 +27,11 @@ interface VerifySuccessToastParams {
27
27
  message: string;
28
28
  closeAfterVerification: boolean;
29
29
  }
30
+ interface VerifyToastParams {
31
+ message: string;
32
+ closeAfterVerification: boolean;
33
+ toastType: "success" | "error";
34
+ }
30
35
  type ConditionProps = Record<string, string>[];
31
36
  type FilterProps = Record<string, ConditionProps>;
32
37
  type ParamFilters = FilterProps[];
@@ -119,9 +124,12 @@ declare class CustomCommands {
119
124
  * @endexample
120
125
  */
121
126
  executeRecursively: ExecuteRecursively;
127
+ /**
128
+ * @deprecated Use verifyToast instead.
129
+ */
122
130
  /**
123
131
  *
124
- * Command to assert the toastr message. It takes the following parameters:
132
+ * Command to assert the success toastr message. It takes the following parameters:
125
133
  *
126
134
  * closeAfterVerification(optional): Boolean to close the toast after verification. Default is true.
127
135
  *
@@ -139,6 +147,30 @@ declare class CustomCommands {
139
147
  message,
140
148
  closeAfterVerification
141
149
  }?: Partial<VerifySuccessToastParams>) => Promise<void>;
150
+ /**
151
+ *
152
+ * Command to assert the toastr message. It takes the following parameters:
153
+ *
154
+ * closeAfterVerification(optional): Boolean to close the toast after verification. Default is true.
155
+ *
156
+ * message(optional): Text that should be on toast.
157
+ *
158
+ * toastType(optional): Type of toast. It takes either success or error as it's value. Default is success.
159
+ *
160
+ * @example
161
+ *
162
+ * await neetoPlaywrightUtilities.verifyToast({
163
+ * message: "Toastr message",
164
+ * closeAfterVerification: false,
165
+ * toastType: "error"
166
+ * });
167
+ * @endexample
168
+ */
169
+ verifyToast: ({
170
+ message,
171
+ toastType,
172
+ closeAfterVerification
173
+ }?: Partial<VerifyToastParams>) => Promise<void>;
142
174
  /**
143
175
  *
144
176
  * Command to reload and wait for the API responses.
@@ -1327,7 +1359,7 @@ declare class ZapierPage extends IntegrationBase {
1327
1359
  interface VerifyDescriptionEditorParams {
1328
1360
  text: string;
1329
1361
  linkUrl?: string;
1330
- fileName?: string;
1362
+ filePath?: string;
1331
1363
  attachedImageName?: string;
1332
1364
  imageUrl?: string;
1333
1365
  videoUrl?: string;
@@ -1350,10 +1382,34 @@ declare class EditorPage {
1350
1382
  videoWrapperSelector: Locator;
1351
1383
  emojiDropdownIcon: Locator;
1352
1384
  constructor(page: Page, neetoPlaywrightUtilities: CustomCommands);
1385
+ /**
1386
+ *
1387
+ * Used to verify description editor functionality
1388
+ *
1389
+ * text (required): The text to be filled in editor content field.
1390
+ *
1391
+ * linkUrl (optional): The url to be added when we select the button on the editor menu to link a url to a text. Default is faker.internet.url().
1392
+ *
1393
+ * filePath (optional): The file path to be added when we select the button on the editor menu to attach a file in the editor. Default is "../../../e2e/assets/images/BigBinary.png".
1394
+ *
1395
+ * imageUrl (optional): The url to be added when we select the button on the editor menu to upload an image in the editor. Default is https://picsum.photos/200/300.
1396
+ *
1397
+ * videoUrl (optional): The url to be added when we select the button on the editor menu to upload a video in the editor. Default is https://youtu.be/jNQXAC9IVRw.
1398
+ *
1399
+ * cannedResponseSuccessMessage (optional): The success toastr message after applying canned reesponse.
1400
+ *
1401
+ * @example
1402
+ *
1403
+ * await editorPage.verifyDescriptionEditor({
1404
+ * text: t("tickets.updated_one"),
1405
+ * cannedResponseSuccessMessage: t("messages.successCannedResponse"),
1406
+ * });
1407
+ * @endexample
1408
+ */
1353
1409
  verifyDescriptionEditor: ({
1354
1410
  text,
1355
1411
  linkUrl,
1356
- fileName,
1412
+ filePath,
1357
1413
  imageUrl,
1358
1414
  videoUrl,
1359
1415
  cannedResponseSuccessMessage
@@ -2709,6 +2765,7 @@ declare const COMMON_SELECTORS: {
2709
2765
  actionSelectIndicator: string;
2710
2766
  takeActionDropdown: string;
2711
2767
  columnsSearchInput: string;
2768
+ errorToastIcon: string;
2712
2769
  };
2713
2770
  /**
2714
2771
  *
@@ -2812,6 +2869,7 @@ declare const NEETO_EDITOR_SELECTORS: {
2812
2869
  imageUploadLinkButton: string;
2813
2870
  errorText: string;
2814
2871
  content: string;
2872
+ imageUploadDeleteButton: string;
2815
2873
  };
2816
2874
  declare const NEETO_TEXT_MODIFIER_SELECTORS: {
2817
2875
  strikeOption: string;
package/index.js CHANGED
@@ -313,6 +313,7 @@ const COMMON_SELECTORS = {
313
313
  actionSelectIndicator: "action-select-indicator",
314
314
  takeActionDropdown: "take-action-dropdown-icon",
315
315
  columnsSearchInput: "neeto-ui-columns-search",
316
+ errorToastIcon: "error-toast-icon",
316
317
  };
317
318
 
318
319
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
@@ -3427,6 +3428,9 @@ class CustomCommands {
3427
3428
  const startTime = Date.now();
3428
3429
  await this.recursiveMethod(callback, condition, timeout, startTime);
3429
3430
  };
3431
+ /**
3432
+ * @deprecated Use verifyToast instead.
3433
+ */
3430
3434
  this.verifySuccessToast = async ({ message = "", closeAfterVerification = true, } = {}) => {
3431
3435
  if (!isEmpty$1(message)) {
3432
3436
  await expect(this.page.getByTestId(COMMON_SELECTORS.toastMessage)).toContainText(message);
@@ -3438,6 +3442,22 @@ class CustomCommands {
3438
3442
  (await this.page.getByTestId(COMMON_SELECTORS.toastCloseButton).click());
3439
3443
  await expect(this.page.locator(COMMON_SELECTORS.toastIcon)).toBeHidden();
3440
3444
  };
3445
+ this.verifyToast = async ({ message = "", toastType = "success", closeAfterVerification = true, } = {}) => {
3446
+ if (toastType === "error") {
3447
+ await expect(this.page.getByTestId(COMMON_SELECTORS.errorToastIcon)).toBeVisible({ timeout: 10000 });
3448
+ }
3449
+ const toastrCloseButton = this.page.getByTestId(COMMON_SELECTORS.toastCloseButton);
3450
+ if (!isEmpty$1(message)) {
3451
+ await expect(this.page.getByTestId(COMMON_SELECTORS.toastMessage)).toContainText(message, { timeout: 10000 });
3452
+ }
3453
+ else {
3454
+ await expect(this.page.locator(COMMON_SELECTORS.toastIcon)).toContainText("👍");
3455
+ }
3456
+ if (closeAfterVerification && (await toastrCloseButton.isVisible())) {
3457
+ await toastrCloseButton.click();
3458
+ await expect(toastrCloseButton).toBeHidden();
3459
+ }
3460
+ };
3441
3461
  this.reloadAndWait = async (requestCount, customPageContext, interceptMultipleResponsesProps = {}) => {
3442
3462
  const pageContext = customPageContext !== null && customPageContext !== void 0 ? customPageContext : this.page;
3443
3463
  const reloadRequests = this.interceptMultipleResponses({
@@ -14424,13 +14444,13 @@ const NEETO_EDITOR_SELECTORS = {
14424
14444
  videoEmbedOption: "neeto-editor-fixed-menu-video-embed-option",
14425
14445
  videoEmbedInput: "neeto-editor-embed-input",
14426
14446
  videoEmbedSubmit: "neeto-editor-embed-cancel",
14427
- // TODO: Fix the selector after the issue is resolved: https://github.com/bigbinary/neeto-editor/issues/1047
14428
- videoWrapper: ".neeto-editor__video-wrapper",
14447
+ videoWrapper: "neeto-editor-video-wrapper",
14429
14448
  paragraphOption: "neeto-editor-fixed-menu-font-size-option-body2",
14430
14449
  attachmentPreview: "ne-attachments-wrapper",
14431
14450
  imageUploadLinkButton: "neeto-editor-media-uploader-link-tab",
14432
14451
  errorText: "neeto-editor-error-text",
14433
14452
  content: "editor-content",
14453
+ imageUploadDeleteButton: "neeto-editor-image-menu-Delete",
14434
14454
  };
14435
14455
  const NEETO_TEXT_MODIFIER_SELECTORS = {
14436
14456
  strikeOption: "neeto-editor-fixed-menu-strike-option",
@@ -14459,7 +14479,7 @@ const FONT_SIZE_SELECTORS = {
14459
14479
  /* eslint-disable playwright/no-nth-methods */
14460
14480
  class EditorPage {
14461
14481
  constructor(page, neetoPlaywrightUtilities) {
14462
- this.verifyDescriptionEditor = async ({ text, linkUrl = faker.internet.url(), fileName = "../../../e2e/assets/images/BigBinary.png", imageUrl = "https://picsum.photos/200/300", videoUrl = "https://youtu.be/jNQXAC9IVRw", cannedResponseSuccessMessage, }) => {
14482
+ this.verifyDescriptionEditor = async ({ text, linkUrl = faker.internet.url(), filePath = "../../../e2e/assets/images/BigBinary.png", imageUrl = "https://picsum.photos/200/300", videoUrl = "https://youtu.be/jNQXAC9IVRw", cannedResponseSuccessMessage, }) => {
14463
14483
  await this.page.getByTestId(NEETO_EDITOR_SELECTORS.contentField).fill(text);
14464
14484
  await this.page
14465
14485
  .getByTestId(NEETO_EDITOR_SELECTORS.fontSizeDropdown())
@@ -14540,7 +14560,7 @@ class EditorPage {
14540
14560
  const fileUploaderPromise = this.page.waitForEvent("filechooser");
14541
14561
  await this.editorAttachmentsButton.click();
14542
14562
  const fileUploader = await fileUploaderPromise;
14543
- const imagePath = Path.join(__dirname, fileName);
14563
+ const imagePath = Path.join(__dirname, filePath);
14544
14564
  await fileUploader.setFiles(imagePath);
14545
14565
  await this.neetoPlaywrightUtilities.interceptMultipleResponses({
14546
14566
  responseUrl: ROUTES.attachment,
@@ -14567,7 +14587,7 @@ class EditorPage {
14567
14587
  .getByTestId(NEETO_EDITOR_SELECTORS.imageUploadButton)
14568
14588
  .click();
14569
14589
  const fileUploader = await fileUploaderPromise;
14570
- const imagePath = Path.join(__dirname, fileName);
14590
+ const imagePath = Path.join(__dirname, filePath);
14571
14591
  await fileUploader.setFiles(imagePath);
14572
14592
  await expect(this.imageWrapper).toBeVisible({ timeout: 15000 });
14573
14593
  await this.neetoPlaywrightUtilities.verifySuccessToast();
@@ -14648,16 +14668,11 @@ class EditorPage {
14648
14668
  this.attachmentPreview = this.page.getByTestId(NEETO_EDITOR_SELECTORS.attachmentPreview);
14649
14669
  this.editorAttachmentsButton = this.page.getByTestId(NEETO_EDITOR_SELECTORS.editorAttachmentsButton);
14650
14670
  this.imageWrapper = this.page.getByTestId(NEETO_EDITOR_SELECTORS.imageWrapper);
14651
- // TODO: Fix the selector after the issue is resolved: https://github.com/bigbinary/neeto-editor/issues/1047
14652
- this.imageUploadDeleteButton = this.page
14653
- .getByTestId(COMMON_SELECTORS.dropdownContainer)
14654
- .getByRole("button")
14655
- .nth(3);
14671
+ this.imageUploadDeleteButton = this.page.getByTestId(NEETO_EDITOR_SELECTORS.imageUploadDeleteButton);
14656
14672
  this.imageUploadOption = this.page.getByTestId(NEETO_EDITOR_SELECTORS.imageUploadOption);
14657
14673
  this.cannedResponseOption = this.page.getByTestId(NEETO_EDITOR_SELECTORS.cannedResponseOption);
14658
14674
  this.videoEmbedOption = this.page.getByTestId(NEETO_EDITOR_SELECTORS.videoEmbedOption);
14659
- // TODO: Fix the selector after the issue is resolved: https://github.com/bigbinary/neeto-editor/issues/1047
14660
- this.videoWrapperSelector = this.page.locator(NEETO_EDITOR_SELECTORS.videoWrapper);
14675
+ this.videoWrapperSelector = this.page.getByTestId(NEETO_EDITOR_SELECTORS.videoWrapper);
14661
14676
  this.emojiDropdownIcon = this.page
14662
14677
  .getByTestId(NEETO_EDITOR_SELECTORS.fixedMenuWrapper)
14663
14678
  .getByTestId(COMMON_SELECTORS.dropdownIcon);