@bigbinary/neeto-playwright-commons 1.14.0 → 1.14.2

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
@@ -91,7 +91,7 @@ interface UploadFileViaDispatchProps {
91
91
  }
92
92
  interface VerifyTooltipProps {
93
93
  triggerElement: Locator;
94
- content: string;
94
+ content: string | RegExp;
95
95
  customPageContext?: Page;
96
96
  }
97
97
  declare class CustomCommands {
@@ -443,6 +443,18 @@ declare class CustomCommands {
443
443
  helpURL,
444
444
  customPageContext
445
445
  }: VerifyHelpPopoverProps) => Promise<void>;
446
+ /**
447
+ *
448
+ * Method to verify the term in the search term block.
449
+ *
450
+ * searchTerm (optional): The term need to be asserted in search term block. If not passed then it will assert the search term block to be hidden.
451
+ *
452
+ * @example
453
+ *
454
+ * await verifySearchTermBlock("search term");
455
+ * @endexample
456
+ */
457
+ verifySearchTermBlock: (searchTerm?: string) => Promise<void>;
446
458
  }
447
459
  type Range<N extends number, Acc extends number[] = []> = Acc["length"] extends N ? Exclude<Acc[number], 0 | Acc["length"]> | N : Range<N, [...Acc, Acc["length"]]>;
448
460
  interface MessageSearchCriteria {
@@ -4361,6 +4373,8 @@ declare const EMBED_SELECTORS: {
4361
4373
  *
4362
4374
  * searchTermBlock: Selector for the Neeto filters search term block.
4363
4375
  *
4376
+ * filtersTermBlock: Custom selector for filters term block.
4377
+ *
4364
4378
  */
4365
4379
  declare const NEETO_FILTERS_SELECTORS: {
4366
4380
  emailSelectContainer: string;
@@ -4380,6 +4394,7 @@ declare const NEETO_FILTERS_SELECTORS: {
4380
4394
  paneModalCrossIcon: string;
4381
4395
  searchTermBlock: string;
4382
4396
  neetoFiltersFilter: (filterName: string) => string;
4397
+ filtersTermBlock: (filterType?: string) => string;
4383
4398
  };
4384
4399
  /**
4385
4400
  *
package/index.js CHANGED
@@ -452,6 +452,7 @@ const NEETO_FILTERS_SELECTORS = {
452
452
  paneModalCrossIcon: "neeto-filters-close-button",
453
453
  searchTermBlock: "neeto-filters-search-term-block",
454
454
  neetoFiltersFilter: (filterName) => `neeto-filters-${hyphenize(filterName)}-filter`,
455
+ filtersTermBlock: (filterType = "search-term") => `neeto-filters-${hyphenize(filterType)}-block`,
455
456
  };
456
457
 
457
458
  const HELP_CENTER_SELECTORS = {
@@ -4023,6 +4024,21 @@ class CustomCommands {
4023
4024
  await customPageContext.mouse.move(0, 0);
4024
4025
  await expect(tooltipBox).toBeHidden();
4025
4026
  };
4027
+ this.verifySearchTermBlock = async (searchTerm) => {
4028
+ const filtersSearchTermBlock = this.page.getByTestId(NEETO_FILTERS_SELECTORS.filtersTermBlock());
4029
+ if (searchTerm) {
4030
+ const textContent = await (filtersSearchTermBlock === null || filtersSearchTermBlock === void 0 ? void 0 : filtersSearchTermBlock.textContent());
4031
+ (textContent === null || textContent === void 0 ? void 0 : textContent.includes(".."))
4032
+ ? await this.verifyTooltip({
4033
+ triggerElement: filtersSearchTermBlock,
4034
+ content: searchTerm,
4035
+ })
4036
+ : await expect(filtersSearchTermBlock).toContainText(searchTerm);
4037
+ }
4038
+ else {
4039
+ await expect(filtersSearchTermBlock).toBeHidden();
4040
+ }
4041
+ };
4026
4042
  this.page = page;
4027
4043
  this.responses = [];
4028
4044
  this.request = request;
@@ -21293,7 +21309,7 @@ class EmbedBase {
21293
21309
  `width: "${embedWidthPercentage}"`,
21294
21310
  ]);
21295
21311
  const inlineEmbedPromise = this.neetoPlaywrightUtilities.interceptMultipleResponses(inlineEmbedInterceptParams);
21296
- await this.previewTab.click();
21312
+ (await this.previewTab.isVisible()) && (await this.previewTab.click());
21297
21313
  await inlineEmbedPromise;
21298
21314
  const iframe = this.page.locator("iframe");
21299
21315
  await iframe.waitFor({ state: "visible" });
@@ -21352,7 +21368,7 @@ class EmbedBase {
21352
21368
  `btnPosition: "${toCamelCase(customizationOptions.buttonPosition)}"`,
21353
21369
  `btnText: "${customizationOptions.buttonText}"`,
21354
21370
  ]);
21355
- await this.previewTab.click();
21371
+ (await this.previewTab.isVisible()) && (await this.previewTab.click());
21356
21372
  const floatingButton = this.page.getByRole("button", {
21357
21373
  name: customizationOptions.buttonText,
21358
21374
  });
@@ -21375,7 +21391,7 @@ class EmbedBase {
21375
21391
  .getByTestId(EMBED_SELECTORS.elementIdInput)
21376
21392
  .fill(customizationOptions.customId);
21377
21393
  await expect(this.codeBlock).toContainText(`elementSelector: "#${customizationOptions.customId}"`);
21378
- await this.previewTab.click();
21394
+ (await this.previewTab.isVisible()) && (await this.previewTab.click());
21379
21395
  await expect(this.page.getByTestId(EMBED_SELECTORS.previewElementPopupButton)).toBeVisible();
21380
21396
  await expect(this.page.locator(`#${customizationOptions.customId}`)).toBeVisible();
21381
21397
  };