@bigbinary/neeto-playwright-commons 1.26.16 → 1.26.17

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
@@ -485,6 +485,18 @@ declare class CustomCommands {
485
485
  helpURL,
486
486
  customPageContext
487
487
  }: VerifyHelpPopoverProps) => Promise<void>;
488
+ /**
489
+ *
490
+ * Method to assert that a help URL is valid by checking that it redirects to a valid location (not a 404 page).
491
+ *
492
+ * helpURL: The help URL to validate.
493
+ *
494
+ * @example
495
+ *
496
+ * await neetoPlaywrightUtilities.assertHelpURLIsValid("https://help.neetoform.com/a-5c45dbdf");
497
+ * @endexample
498
+ */
499
+ assertHelpURLIsValid: (helpURL: string) => Promise<void>;
488
500
  /**
489
501
  *
490
502
  * Method to verify the help link on the page.
package/index.js CHANGED
@@ -5857,16 +5857,26 @@ class CustomCommands {
5857
5857
  (await expect(tooltipBox.getByRole("heading", { name: title })).toBeVisible());
5858
5858
  content && (await expect(tooltipBox).toContainText(content));
5859
5859
  helpURL &&
5860
- (await expect(tooltipBox.getByTestId(COMMON_SELECTORS.helpPopoverLinkButton)).toHaveAttribute("href", new RegExp(helpURL, "i")));
5860
+ (await Promise.all([
5861
+ this.assertHelpURLIsValid(helpURL),
5862
+ expect(tooltipBox.getByTestId(COMMON_SELECTORS.helpPopoverLinkButton)).toHaveAttribute("href", new RegExp(helpURL, "i")),
5863
+ ]));
5861
5864
  await this.hideTooltip(triggerElement, customPageContext);
5862
5865
  };
5866
+ this.assertHelpURLIsValid = async (helpURL) => {
5867
+ const response = await this.request.get(helpURL);
5868
+ await expect(response).toBeOK();
5869
+ };
5863
5870
  this.verifyHelpText = async (helpURL) => {
5864
5871
  const isNoDataTitleHidden = await this.page
5865
5872
  .getByTestId(COMMON_SELECTORS.noDataTitle)
5866
5873
  .isHidden();
5867
5874
  if (isNoDataTitleHidden)
5868
5875
  return;
5869
- await expect(this.page.getByTestId(COMMON_SELECTORS.noDataHelpText).getByRole("link")).toHaveAttribute("href", new RegExp(helpURL, "i"));
5876
+ await Promise.all([
5877
+ this.assertHelpURLIsValid(helpURL),
5878
+ expect(this.page.getByTestId(COMMON_SELECTORS.noDataHelpText).getByRole("link")).toHaveAttribute("href", new RegExp(helpURL, "i")),
5879
+ ]);
5870
5880
  };
5871
5881
  this.verifySearchTermBlock = async (searchTerm) => {
5872
5882
  const filtersSearchTermBlock = this.page.getByTestId(NEETO_FILTERS_SELECTORS.filtersTermBlock());