@bigbinary/neeto-playwright-commons 1.23.5 → 1.23.7

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
@@ -120,7 +120,7 @@ interface UploadFileViaDispatchProps {
120
120
  }
121
121
  interface VerifyTooltipProps {
122
122
  triggerElement: Locator;
123
- content: string | RegExp;
123
+ content: string | RegExp | (() => string | RegExp | Promise<string | RegExp>);
124
124
  customPageContext?: Page;
125
125
  }
126
126
  declare class CustomCommands {
@@ -427,14 +427,30 @@ declare class CustomCommands {
427
427
  *
428
428
  * triggerElement: The element hovering which the tooltip will be shown.
429
429
  *
430
- * content: The content of the tooltip container.
430
+ * content: The content of the tooltip container. Can be a string, RegExp, or a callback function that returns a string, RegExp, or Promise resolving to either.
431
431
  *
432
432
  * @example
433
433
  *
434
+ * // Using a static string
434
435
  * await verifyTooltip({
435
436
  * triggerElement: page.getByTestId("tooltip"),
436
437
  * content: "content of tooltip container",
437
438
  * });
439
+ *
440
+ * // Using a callback to dynamically generate content
441
+ * await verifyTooltip({
442
+ * triggerElement: page.getByTestId("tooltip"),
443
+ * content: () => `Dynamic content: ${someValue}`,
444
+ * });
445
+ *
446
+ * // Using an async callback
447
+ * await verifyTooltip({
448
+ * triggerElement: page.getByTestId("tooltip"),
449
+ * content: async () => {
450
+ * const value = await someAsyncOperation();
451
+ * return `Content with ${value}`;
452
+ * },
453
+ * });
438
454
  * @endexample
439
455
  */
440
456
  verifyTooltip: ({
@@ -4730,6 +4746,7 @@ declare const SLACK_WEB_TEXTS: {
4730
4746
  *
4731
4747
  */
4732
4748
  declare const ZAPIER_WEB_TEXTS: {
4749
+ create: string;
4733
4750
  account: string;
4734
4751
  email: string;
4735
4752
  continue: string;
package/index.js CHANGED
@@ -5377,9 +5377,7 @@ class CustomCommands {
5377
5377
  const toastrLocator = isEmpty(message)
5378
5378
  ? customPageContext.locator(COMMON_SELECTORS.toastIcon)
5379
5379
  : customPageContext.getByTestId(COMMON_SELECTORS.toastMessage(toastType));
5380
- await expect(toastrLocator).toContainText(isEmpty(message) ? "👍" : message, {
5381
- timeout,
5382
- });
5380
+ await expect(toastrLocator).toContainText(isEmpty(message) ? "👍" : message, { timeout });
5383
5381
  if (!closeAfterVerification && (await toastrCloseButton.isHidden()))
5384
5382
  return;
5385
5383
  const buttonHandle = await toastrCloseButton.elementHandle();
@@ -5431,9 +5429,7 @@ class CustomCommands {
5431
5429
  };
5432
5430
  const formattedUrl = isEmpty(params)
5433
5431
  ? url
5434
- : `${url}?${qs.stringify(params, {
5435
- arrayFormat: "brackets",
5436
- })}`;
5432
+ : `${url}?${qs.stringify(params, { arrayFormat: "brackets" })}`;
5437
5433
  return await this.request[method](formattedUrl, requestOptions);
5438
5434
  };
5439
5435
  this.selectOptionFromDropdown = async ({ label = "nui", value, page = this.page, options = {}, }) => {
@@ -5506,16 +5502,15 @@ class CustomCommands {
5506
5502
  }).toPass({ timeout: 10000 });
5507
5503
  this.verifyTooltip = async ({ triggerElement, content, customPageContext = this.page, }) => {
5508
5504
  await this.hoverOnElement(triggerElement, customPageContext);
5509
- await expect(customPageContext.getByTestId(COMMON_SELECTORS.tooltip)).toContainText(content);
5505
+ const resolvedContent = typeof content === "function" ? await content() : content;
5506
+ await expect(customPageContext.getByTestId(COMMON_SELECTORS.tooltip)).toContainText(resolvedContent);
5510
5507
  await this.hideTooltip(triggerElement, customPageContext);
5511
5508
  };
5512
5509
  this.verifyHelpPopover = async ({ triggerElement = this.page.getByTestId(COMMON_SELECTORS.helpPopoverButton), title, content, helpURL, customPageContext = this.page, }) => {
5513
5510
  const tooltipBox = customPageContext.getByTestId(COMMON_SELECTORS.tooltip);
5514
5511
  await triggerElement.hover();
5515
5512
  title &&
5516
- (await expect(tooltipBox.getByRole("heading", {
5517
- name: title,
5518
- })).toBeVisible());
5513
+ (await expect(tooltipBox.getByRole("heading", { name: title })).toBeVisible());
5519
5514
  content && (await expect(tooltipBox).toContainText(content));
5520
5515
  helpURL &&
5521
5516
  (await expect(tooltipBox.getByTestId(COMMON_SELECTORS.helpPopoverLinkButton)).toHaveAttribute("href", new RegExp(helpURL, "i")));
@@ -5588,10 +5583,7 @@ class CustomCommands {
5588
5583
  this.verifyBreadcrumbs = async (titlesAndRoutes) => {
5589
5584
  const breadcrumbHeader = this.page.getByTestId(COMMON_SELECTORS.breadcrumbHeader);
5590
5585
  await expect(breadcrumbHeader).toHaveCount(titlesAndRoutes.length);
5591
- await Promise.all(titlesAndRoutes.map(({ title, route }) => expect(breadcrumbHeader.getByRole("link", {
5592
- name: title,
5593
- exact: true,
5594
- })).toHaveAttribute("href", route)));
5586
+ await Promise.all(titlesAndRoutes.map(({ title, route }) => expect(breadcrumbHeader.getByRole("link", { name: title, exact: true })).toHaveAttribute("href", route)));
5595
5587
  };
5596
5588
  this.uploadFileViaDispatchV2 = async ({ droppableZone = this.page.getByTestId(COMMON_SELECTORS.fileUploadBody), dispatchEvent = "drop", file, }) => {
5597
5589
  const serializedFile = await serializeFileForBrowser(file);
@@ -117874,6 +117866,7 @@ const SLACK_WEB_TEXTS = {
117874
117866
  deleteChannel: "Delete channel",
117875
117867
  };
117876
117868
  const ZAPIER_WEB_TEXTS = {
117869
+ create: "Create",
117877
117870
  account: "Account",
117878
117871
  email: "Email",
117879
117872
  continue: "Continue",
@@ -120891,9 +120884,7 @@ class ZapierPage extends IntegrationBase {
120891
120884
  await apiKeyBox.click();
120892
120885
  await apiKeyBox.pressSequentially(zapierApiKey, { delay: 100 });
120893
120886
  await signInPage
120894
- .getByRole("button", {
120895
- name: RegExp(ZAPIER_WEB_TEXTS.yesContinueTo),
120896
- })
120887
+ .getByRole("button", { name: RegExp(ZAPIER_WEB_TEXTS.yesContinueTo) })
120897
120888
  .click();
120898
120889
  await this.continueButton.click({ timeout: 30000 });
120899
120890
  await expect(this.zapierWebPage
@@ -120903,17 +120894,20 @@ class ZapierPage extends IntegrationBase {
120903
120894
  const testTriggerButton = this.zapierWebPage.getByRole("button", {
120904
120895
  name: ZAPIER_WEB_TEXTS.testTrigger,
120905
120896
  });
120906
- await expect(this.zapierWebPage.locator(ZAPIER_SELECTORS.spinner)).toBeHidden({
120907
- timeout: 25000,
120908
- });
120909
- await testTriggerButton.click();
120910
- await expect(this.zapierWebPage.getByText(ZAPIER_WEB_TEXTS.testCurrentlyInQueue)).toBeHidden({ timeout: 20000 });
120911
- await expect(this.zapierWebPage.getByLabel(ZAPIER_WEB_TEXTS.statusLabel, {
120912
- exact: true,
120913
- })).toBeVisible({ timeout: 10000 });
120897
+ await expect(this.zapierWebPage.locator(ZAPIER_SELECTORS.spinner)).toHaveCount(0, { timeout: 30000 });
120914
120898
  const continueWithRecordBtn = this.zapierWebPage.getByRole("button", {
120915
120899
  name: ZAPIER_WEB_TEXTS.continueWithSelectedRecord,
120916
120900
  });
120901
+ await expect(testTriggerButton.or(continueWithRecordBtn)).toBeVisible({
120902
+ timeout: 30000,
120903
+ });
120904
+ if (await testTriggerButton.isVisible()) {
120905
+ await testTriggerButton.click();
120906
+ await expect(this.zapierWebPage.getByText(ZAPIER_WEB_TEXTS.testCurrentlyInQueue)).toBeHidden({ timeout: 20000 });
120907
+ await expect(this.zapierWebPage.getByLabel(ZAPIER_WEB_TEXTS.statusLabel, {
120908
+ exact: true,
120909
+ })).toBeVisible({ timeout: 10000 });
120910
+ }
120917
120911
  await continueWithRecordBtn.click({ timeout: 30000 });
120918
120912
  await expect(continueWithRecordBtn).toBeHidden({ timeout: 15000 });
120919
120913
  await this.continueButton.click({ timeout: 20000 });
@@ -120957,18 +120951,20 @@ class ZapierPage extends IntegrationBase {
120957
120951
  .click();
120958
120952
  }).toPass({ timeout: 40000 });
120959
120953
  }
120960
- await expect(connectionLocator).toHaveCount(0, {
120961
- timeout: 10000,
120962
- });
120954
+ await expect(connectionLocator).toHaveCount(0, { timeout: 10000 });
120963
120955
  };
120964
120956
  this.verifyZapIsTriggered = ({ productName, submittedEmail, zapTriggeredAfter, timeout = 2 * 60000, }) => this.mailerUtils.findMessage({ to: ZAPIER_TEST_EMAIL(productName), body: submittedEmail }, { timeout, receivedAfter: zapTriggeredAfter });
120965
120957
  this.skipIfTaskLimitIsExhausted = async () => {
120966
- var _a;
120967
120958
  // Zapier provides 100 free task limit for free account; skip test if it's exhausted
120968
- await this.zapierWebPage.locator(ZAPIER_SELECTORS.universalSidebar).hover({
120969
- timeout: 30000,
120970
- });
120971
- await expect(this.zapierWebPage.locator(ZAPIER_SELECTORS.sidebarFooter)).toBeVisible({ timeout: 10000 });
120959
+ var _a;
120960
+ const universalSidebar = this.zapierWebPage.locator(ZAPIER_SELECTORS.universalSidebar);
120961
+ await expect(universalSidebar).toBeVisible({ timeout: 30000 });
120962
+ await expect(async () => {
120963
+ await universalSidebar
120964
+ .getByRole("button", { name: ZAPIER_WEB_TEXTS.create })
120965
+ .hover();
120966
+ await expect(this.zapierWebPage.locator(ZAPIER_SELECTORS.sidebarFooter)).toBeVisible();
120967
+ }).toPass({ timeout: 30000 });
120972
120968
  if (await this.zapierWebPage
120973
120969
  .getByText(RegExp(ZAPIER_WEB_TEXTS.trialEndsRegExp))
120974
120970
  .isVisible()) {
@@ -121011,9 +121007,7 @@ class ZapierPage extends IntegrationBase {
121011
121007
  await this.page
121012
121008
  .getByTestId(COMMON_SELECTORS.alertModalSubmitButton)
121013
121009
  .click();
121014
- await this.neetoPlaywrightUtilities.verifyToast({
121015
- message: toastMessage,
121016
- });
121010
+ await this.neetoPlaywrightUtilities.verifyToast({ message: toastMessage });
121017
121011
  await this.verifyIntegrationStatus("disconnected");
121018
121012
  };
121019
121013
  this.generateAPIKey = async (apiKeyLabel) => {