@bigbinary/neeto-playwright-commons 1.15.3 → 1.15.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.cjs.js CHANGED
@@ -4029,8 +4029,7 @@ class CustomCommands {
4029
4029
  this.verifyTooltip = async ({ triggerElement, content, customPageContext = this.page, }) => {
4030
4030
  await triggerElement.hover();
4031
4031
  await test$1.expect(customPageContext.getByTestId(COMMON_SELECTORS.tooltip)).toContainText(content);
4032
- await customPageContext.mouse.move(0, 0);
4033
- await test$1.expect(customPageContext.getByTestId(COMMON_SELECTORS.tooltip)).toBeHidden();
4032
+ await this.hideTooltip(triggerElement, customPageContext);
4034
4033
  };
4035
4034
  this.verifyHelpPopover = async ({ triggerElement = this.page.getByTestId(COMMON_SELECTORS.helpPopoverButton), title, content, helpURL, customPageContext = this.page, }) => {
4036
4035
  const tooltipBox = customPageContext.getByTestId(COMMON_SELECTORS.tooltip);
@@ -4042,8 +4041,7 @@ class CustomCommands {
4042
4041
  content && (await test$1.expect(tooltipBox).toContainText(content));
4043
4042
  helpURL &&
4044
4043
  (await test$1.expect(tooltipBox.getByTestId(COMMON_SELECTORS.helpPopoverLinkButton)).toHaveAttribute("href", new RegExp(helpURL, "i")));
4045
- await customPageContext.mouse.move(0, 0);
4046
- await test$1.expect(tooltipBox).toBeHidden();
4044
+ await this.hideTooltip(triggerElement, customPageContext);
4047
4045
  };
4048
4046
  this.verifySearchTermBlock = async (searchTerm) => {
4049
4047
  const filtersSearchTermBlock = this.page.getByTestId(NEETO_FILTERS_SELECTORS.filtersTermBlock());
@@ -4060,6 +4058,45 @@ class CustomCommands {
4060
4058
  await test$1.expect(filtersSearchTermBlock).toBeHidden();
4061
4059
  }
4062
4060
  };
4061
+ this.saveChanges = ({ isPane = false, customPageContext = this.page, closeAfterVerification = true, } = {}) => {
4062
+ const pane = customPageContext.getByTestId(COMMON_SELECTORS.backdrop);
4063
+ const baseLocator = isPane ? pane : customPageContext;
4064
+ return Promise.all([
4065
+ baseLocator
4066
+ .getByTestId(COMMON_SELECTORS.saveChangesButton)
4067
+ .click({ timeout: 10000 }),
4068
+ // eslint-disable-next-line playwright/missing-playwright-await
4069
+ isPane && test$1.expect(pane).toBeHidden({ timeout: 10000 }),
4070
+ this.verifyToast({
4071
+ closeAfterVerification,
4072
+ customPageContext,
4073
+ timeout: 20000,
4074
+ }),
4075
+ ]);
4076
+ };
4077
+ this.hideTooltip = async (triggerElement, customPageContext = this.page) => {
4078
+ const boundingBox = await triggerElement.boundingBox();
4079
+ if (!boundingBox) {
4080
+ throw new Error("Trigger element bounding box not found");
4081
+ }
4082
+ const { x, y, width, height } = boundingBox;
4083
+ const moves = [
4084
+ [x + width + 10, y],
4085
+ [x, y + height + 10],
4086
+ [x - 10, y],
4087
+ [x, y - 10],
4088
+ ];
4089
+ const tooltip = customPageContext.getByTestId(COMMON_SELECTORS.tooltip);
4090
+ await test$1.expect(async () => {
4091
+ for (const [moveX, moveY] of moves) {
4092
+ await customPageContext.mouse.move(moveX, moveY);
4093
+ const tooltipCount = await tooltip.count();
4094
+ if (tooltipCount === 0)
4095
+ break;
4096
+ }
4097
+ await test$1.expect(tooltip).toHaveCount(0);
4098
+ }).toPass({ timeout: 30000 });
4099
+ };
4063
4100
  this.page = page;
4064
4101
  this.responses = [];
4065
4102
  this.request = request;