@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 +41 -4
- package/index.cjs.js.map +1 -1
- package/index.d.ts +33 -0
- package/index.js +41 -4
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -41,6 +41,11 @@ interface VerifyHelpPopoverProps {
|
|
|
41
41
|
helpURL?: string;
|
|
42
42
|
customPageContext?: Page;
|
|
43
43
|
}
|
|
44
|
+
interface SaveChangesProps {
|
|
45
|
+
closeAfterVerification?: boolean;
|
|
46
|
+
isPane?: boolean;
|
|
47
|
+
customPageContext?: Page;
|
|
48
|
+
}
|
|
44
49
|
type ConditionProps = Record<string, string>[];
|
|
45
50
|
type FilterProps = Record<string, ConditionProps>;
|
|
46
51
|
type ParamFilters = FilterProps[];
|
|
@@ -453,6 +458,34 @@ declare class CustomCommands {
|
|
|
453
458
|
* @endexample
|
|
454
459
|
*/
|
|
455
460
|
verifySearchTermBlock: (searchTerm?: string) => Promise<void>;
|
|
461
|
+
/**
|
|
462
|
+
*
|
|
463
|
+
* Used to save the changes made on the thank you page.
|
|
464
|
+
*
|
|
465
|
+
* @example
|
|
466
|
+
*
|
|
467
|
+
* await thankYouPage.saveChanges();
|
|
468
|
+
* @endexample
|
|
469
|
+
*/
|
|
470
|
+
saveChanges: ({
|
|
471
|
+
isPane,
|
|
472
|
+
customPageContext,
|
|
473
|
+
closeAfterVerification
|
|
474
|
+
}?: SaveChangesProps) => Promise<[void, false | void, void]>;
|
|
475
|
+
/**
|
|
476
|
+
*
|
|
477
|
+
* Method to hide the tooltip.
|
|
478
|
+
*
|
|
479
|
+
* triggerElement: Locator hovering on which tooltip was shown.
|
|
480
|
+
*
|
|
481
|
+
* customPageContext(optional): Custom page context on which tooltip is shown. Default to this.page.
|
|
482
|
+
*
|
|
483
|
+
* @example
|
|
484
|
+
*
|
|
485
|
+
* await hideTooltip();
|
|
486
|
+
* @endexample
|
|
487
|
+
*/
|
|
488
|
+
hideTooltip: (triggerElement: Locator, customPageContext?: Page) => Promise<void>;
|
|
456
489
|
}
|
|
457
490
|
type Range<N extends number, Acc extends number[] = []> = Acc["length"] extends N ? Exclude<Acc[number], 0 | Acc["length"]> | N : Range<N, [...Acc, Acc["length"]]>;
|
|
458
491
|
interface MessageSearchCriteria {
|
package/index.js
CHANGED
|
@@ -4009,8 +4009,7 @@ class CustomCommands {
|
|
|
4009
4009
|
this.verifyTooltip = async ({ triggerElement, content, customPageContext = this.page, }) => {
|
|
4010
4010
|
await triggerElement.hover();
|
|
4011
4011
|
await expect(customPageContext.getByTestId(COMMON_SELECTORS.tooltip)).toContainText(content);
|
|
4012
|
-
await
|
|
4013
|
-
await expect(customPageContext.getByTestId(COMMON_SELECTORS.tooltip)).toBeHidden();
|
|
4012
|
+
await this.hideTooltip(triggerElement, customPageContext);
|
|
4014
4013
|
};
|
|
4015
4014
|
this.verifyHelpPopover = async ({ triggerElement = this.page.getByTestId(COMMON_SELECTORS.helpPopoverButton), title, content, helpURL, customPageContext = this.page, }) => {
|
|
4016
4015
|
const tooltipBox = customPageContext.getByTestId(COMMON_SELECTORS.tooltip);
|
|
@@ -4022,8 +4021,7 @@ class CustomCommands {
|
|
|
4022
4021
|
content && (await expect(tooltipBox).toContainText(content));
|
|
4023
4022
|
helpURL &&
|
|
4024
4023
|
(await expect(tooltipBox.getByTestId(COMMON_SELECTORS.helpPopoverLinkButton)).toHaveAttribute("href", new RegExp(helpURL, "i")));
|
|
4025
|
-
await
|
|
4026
|
-
await expect(tooltipBox).toBeHidden();
|
|
4024
|
+
await this.hideTooltip(triggerElement, customPageContext);
|
|
4027
4025
|
};
|
|
4028
4026
|
this.verifySearchTermBlock = async (searchTerm) => {
|
|
4029
4027
|
const filtersSearchTermBlock = this.page.getByTestId(NEETO_FILTERS_SELECTORS.filtersTermBlock());
|
|
@@ -4040,6 +4038,45 @@ class CustomCommands {
|
|
|
4040
4038
|
await expect(filtersSearchTermBlock).toBeHidden();
|
|
4041
4039
|
}
|
|
4042
4040
|
};
|
|
4041
|
+
this.saveChanges = ({ isPane = false, customPageContext = this.page, closeAfterVerification = true, } = {}) => {
|
|
4042
|
+
const pane = customPageContext.getByTestId(COMMON_SELECTORS.backdrop);
|
|
4043
|
+
const baseLocator = isPane ? pane : customPageContext;
|
|
4044
|
+
return Promise.all([
|
|
4045
|
+
baseLocator
|
|
4046
|
+
.getByTestId(COMMON_SELECTORS.saveChangesButton)
|
|
4047
|
+
.click({ timeout: 10000 }),
|
|
4048
|
+
// eslint-disable-next-line playwright/missing-playwright-await
|
|
4049
|
+
isPane && expect(pane).toBeHidden({ timeout: 10000 }),
|
|
4050
|
+
this.verifyToast({
|
|
4051
|
+
closeAfterVerification,
|
|
4052
|
+
customPageContext,
|
|
4053
|
+
timeout: 20000,
|
|
4054
|
+
}),
|
|
4055
|
+
]);
|
|
4056
|
+
};
|
|
4057
|
+
this.hideTooltip = async (triggerElement, customPageContext = this.page) => {
|
|
4058
|
+
const boundingBox = await triggerElement.boundingBox();
|
|
4059
|
+
if (!boundingBox) {
|
|
4060
|
+
throw new Error("Trigger element bounding box not found");
|
|
4061
|
+
}
|
|
4062
|
+
const { x, y, width, height } = boundingBox;
|
|
4063
|
+
const moves = [
|
|
4064
|
+
[x + width + 10, y],
|
|
4065
|
+
[x, y + height + 10],
|
|
4066
|
+
[x - 10, y],
|
|
4067
|
+
[x, y - 10],
|
|
4068
|
+
];
|
|
4069
|
+
const tooltip = customPageContext.getByTestId(COMMON_SELECTORS.tooltip);
|
|
4070
|
+
await expect(async () => {
|
|
4071
|
+
for (const [moveX, moveY] of moves) {
|
|
4072
|
+
await customPageContext.mouse.move(moveX, moveY);
|
|
4073
|
+
const tooltipCount = await tooltip.count();
|
|
4074
|
+
if (tooltipCount === 0)
|
|
4075
|
+
break;
|
|
4076
|
+
}
|
|
4077
|
+
await expect(tooltip).toHaveCount(0);
|
|
4078
|
+
}).toPass({ timeout: 30000 });
|
|
4079
|
+
};
|
|
4043
4080
|
this.page = page;
|
|
4044
4081
|
this.responses = [];
|
|
4045
4082
|
this.request = request;
|