@bigbinary/neeto-playwright-commons 1.11.13 → 1.11.14
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 +6 -6
- package/index.cjs.js.map +1 -1
- package/index.d.ts +8 -4
- package/index.js +6 -6
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -58,9 +58,10 @@ interface FieldValue {
|
|
|
58
58
|
}
|
|
59
59
|
type VerifyFieldValue = (values: FieldValue | FieldValue[]) => Promise<void> | Promise<void[]>;
|
|
60
60
|
interface SelectOptionFromDropdownParams {
|
|
61
|
-
selectValueContainer
|
|
62
|
-
selectMenu
|
|
61
|
+
selectValueContainer?: string;
|
|
62
|
+
selectMenu?: string;
|
|
63
63
|
value: string;
|
|
64
|
+
page?: Page;
|
|
64
65
|
options?: Partial<{
|
|
65
66
|
visibilityTimeout: number;
|
|
66
67
|
textAssertionTimeout: number;
|
|
@@ -232,12 +233,14 @@ declare class CustomCommands {
|
|
|
232
233
|
*
|
|
233
234
|
* operation is completed. It takes the following parameters:
|
|
234
235
|
*
|
|
235
|
-
* selectValueContainer: is the selector for the select input container.
|
|
236
|
+
* selectValueContainer (optional): is the selector for the select input container. Default is nui-select-value-container.
|
|
236
237
|
*
|
|
237
|
-
* selectMenu: is the selector for the select input menu.
|
|
238
|
+
* selectMenu (optional): is the selector for the select input menu. Default is nui-select-menu.
|
|
238
239
|
*
|
|
239
240
|
* value: is the value to be selected.
|
|
240
241
|
*
|
|
242
|
+
* page (optional): is the custom page context. Default is POM's page.
|
|
243
|
+
*
|
|
241
244
|
* options: is an object with the following optional parameters:
|
|
242
245
|
*
|
|
243
246
|
* visiblityTimeout: is the time to wait for the select input to be visible. Default is 2000ms.
|
|
@@ -272,6 +275,7 @@ declare class CustomCommands {
|
|
|
272
275
|
selectValueContainer,
|
|
273
276
|
selectMenu,
|
|
274
277
|
value,
|
|
278
|
+
page,
|
|
275
279
|
options
|
|
276
280
|
}: SelectOptionFromDropdownParams) => Promise<void>;
|
|
277
281
|
/**
|
package/index.js
CHANGED
|
@@ -3552,23 +3552,23 @@ class CustomCommands {
|
|
|
3552
3552
|
})}`;
|
|
3553
3553
|
return await this.request[method](formattedUrl, requestOptions);
|
|
3554
3554
|
};
|
|
3555
|
-
this.selectOptionFromDropdown = async ({ selectValueContainer, selectMenu, value, options = {}, }) => {
|
|
3555
|
+
this.selectOptionFromDropdown = async ({ selectValueContainer = COMMON_SELECTORS.selectValueContainer, selectMenu = COMMON_SELECTORS.dropdownMenu, value, page = this.page, options = {}, }) => {
|
|
3556
3556
|
Object.assign({
|
|
3557
3557
|
visibilityTimeout: 2000,
|
|
3558
3558
|
textAssertionTimeout: 1000,
|
|
3559
3559
|
retryTimeout: 20000,
|
|
3560
3560
|
}, options);
|
|
3561
3561
|
await expect(async () => {
|
|
3562
|
-
await
|
|
3563
|
-
await expect(
|
|
3562
|
+
await page.getByTestId(selectValueContainer).click();
|
|
3563
|
+
await expect(page.getByTestId(selectMenu)).toBeVisible({
|
|
3564
3564
|
timeout: options.visibilityTimeout,
|
|
3565
3565
|
});
|
|
3566
|
-
await
|
|
3567
|
-
await
|
|
3566
|
+
await page.keyboard.type(value);
|
|
3567
|
+
await page
|
|
3568
3568
|
.getByTestId(selectMenu)
|
|
3569
3569
|
.getByText(value, { exact: true })
|
|
3570
3570
|
.click();
|
|
3571
|
-
await expect(
|
|
3571
|
+
await expect(page.getByTestId(selectValueContainer)).toContainText(value, { timeout: options.textAssertionTimeout });
|
|
3572
3572
|
}).toPass({ timeout: options.retryTimeout });
|
|
3573
3573
|
};
|
|
3574
3574
|
this.verifyFieldValue = values => {
|