@bigbinary/neeto-playwright-commons 1.16.2 → 1.16.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.d.ts CHANGED
@@ -393,6 +393,20 @@ declare class CustomCommands {
393
393
  dispatchEvent,
394
394
  droppableZone
395
395
  }: UploadFileViaDispatchProps) => Promise<void>;
396
+ /**
397
+ *
398
+ * Method to hover on an element to show tooltip.
399
+ *
400
+ * triggerElement: Locator hovering on which tooltip should be shown.
401
+ *
402
+ * customPageContext(optional): Custom page context on which tooltip is shown. Default to this.page.
403
+ *
404
+ * @example
405
+ *
406
+ * await hoverOnElement(triggerElement);
407
+ * @endexample
408
+ */
409
+ hoverOnElement: (triggerElement: Locator, customPageContext?: Page) => Promise<void>;
396
410
  /**
397
411
  *
398
412
  * Method to verify content of the tooltip by hovering the trigger element.
@@ -482,7 +496,7 @@ declare class CustomCommands {
482
496
  *
483
497
  * @example
484
498
  *
485
- * await hideTooltip();
499
+ * await hideTooltip(triggerElement);
486
500
  * @endexample
487
501
  */
488
502
  hideTooltip: (triggerElement: Locator, customPageContext?: Page) => Promise<void>;
package/index.js CHANGED
@@ -3894,8 +3894,14 @@ class CustomCommands {
3894
3894
  await expect(customPageContext.locator(COMMON_SELECTORS.toastIcon)).toContainText("👍", { timeout });
3895
3895
  }
3896
3896
  if (closeAfterVerification && (await toastrCloseButton.isVisible())) {
3897
- await toastrCloseButton.click();
3898
- await expect(toastrCloseButton).toBeHidden();
3897
+ const buttonHandle = await toastrCloseButton.elementHandle();
3898
+ if (buttonHandle) {
3899
+ await customPageContext.evaluate(button => {
3900
+ button.dispatchEvent(new Event("click", { bubbles: true }));
3901
+ }, buttonHandle);
3902
+ // eslint-disable-next-line playwright/no-standalone-expect
3903
+ await expect(toastrCloseButton).toBeHidden();
3904
+ }
3899
3905
  }
3900
3906
  };
3901
3907
  this.reloadAndWait = async (requestCount, customPageContext, interceptMultipleResponsesProps = {}) => {
@@ -4007,8 +4013,12 @@ class CustomCommands {
4007
4013
  }, { buffer, fileNameWithType });
4008
4014
  await droppableZone.dispatchEvent(dispatchEvent, { dataTransfer });
4009
4015
  };
4010
- this.verifyTooltip = async ({ triggerElement, content, customPageContext = this.page, }) => {
4016
+ this.hoverOnElement = (triggerElement, customPageContext = this.page) => expect(async () => {
4011
4017
  await triggerElement.hover();
4018
+ await expect(customPageContext.getByTestId(COMMON_SELECTORS.tooltip)).toBeVisible({ timeout: 3000 });
4019
+ }).toPass({ timeout: 10000 });
4020
+ this.verifyTooltip = async ({ triggerElement, content, customPageContext = this.page, }) => {
4021
+ await this.hoverOnElement(triggerElement, customPageContext);
4012
4022
  await expect(customPageContext.getByTestId(COMMON_SELECTORS.tooltip)).toContainText(content);
4013
4023
  await this.hideTooltip(triggerElement, customPageContext);
4014
4024
  };
@@ -21540,25 +21550,9 @@ class HelpAndProfilePage {
21540
21550
  await this.page.getByTestId(CHAT_WIDGET_SELECTORS.closeChat).click();
21541
21551
  await expect(this.neetoChatWidget).toBeHidden({ timeout: 35000 });
21542
21552
  await this.openLiveChatAndVerify();
21543
- });
21544
- await test$2.step("Step 3: Start new conversation", async () => {
21545
- const newConversationButton = this.neetoChatFrame.getByRole("button", {
21553
+ await expect(this.neetoChatFrame.getByRole("button", {
21546
21554
  name: CHAT_WIDGET_TEXTS.newConversation,
21547
- });
21548
- await expect(newConversationButton).toBeVisible({ timeout: 35000 }); // Adding additional toBeVisible to take advantage of the auto-retrying web-first assertion
21549
- await newConversationButton.click();
21550
- await expect(this.neetoChatSpinner).toBeHidden({ timeout: 35000 });
21551
- (await this.neetoChatFrame
21552
- .getByTestId(CHAT_WIDGET_SELECTORS.chatQuestionHeader)
21553
- .getByText(CHAT_WIDGET_TEXTS.preChatQuestions)
21554
- .isVisible()) &&
21555
- (await this.neetoChatFrame
21556
- .getByTestId(CHAT_WIDGET_SELECTORS.preChatSubmitButton)
21557
- .click());
21558
- await expect(this.neetoChatSpinner).toBeHidden({ timeout: 35000 });
21559
- });
21560
- await test$2.step("Step 4: Verify conversation window", async () => {
21561
- await expect(this.neetoChatFrame.getByTestId(CHAT_WIDGET_SELECTORS.chatBubble)).toHaveText(CHAT_WIDGET_TEXTS.welcomeChatBubble);
21555
+ })).toBeVisible({ timeout: 35000 });
21562
21556
  });
21563
21557
  };
21564
21558
  this.openAndVerifyHelpArticlesV2 = async () => {