@bigbinary/neeto-playwright-commons 6.1.3-beta1 → 6.1.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 +10 -0
- package/index.js +10 -6
- package/package.json +2 -2
package/index.d.ts
CHANGED
|
@@ -100,6 +100,7 @@ interface FieldValue {
|
|
|
100
100
|
type VerifyFieldValue = (values: FieldValue | FieldValue[]) => Promise<void> | Promise<void[]>;
|
|
101
101
|
interface SelectOptionFromDropdownParams {
|
|
102
102
|
label?: string;
|
|
103
|
+
dataTestId?: string;
|
|
103
104
|
value: string;
|
|
104
105
|
page?: Page;
|
|
105
106
|
options?: Partial<{
|
|
@@ -287,6 +288,8 @@ declare class CustomCommands {
|
|
|
287
288
|
*
|
|
288
289
|
* label (optional): is the label for the menu and the select input container. Default is nui.
|
|
289
290
|
*
|
|
291
|
+
* dataTestId (optional): is the fixed test ID prefix of the select (for example preferred-time-format). When given, it is used instead of the hyphenated label, so the selector doesn't depend on translated copy.
|
|
292
|
+
*
|
|
290
293
|
* value: is the value to be selected.
|
|
291
294
|
*
|
|
292
295
|
* page (optional): is the custom page context. Default is POM's page.
|
|
@@ -309,6 +312,12 @@ declare class CustomCommands {
|
|
|
309
312
|
* // or
|
|
310
313
|
*
|
|
311
314
|
* await neetoPlaywrightUtilities.selectOptionFromDropdown({
|
|
315
|
+
* dataTestId: "preferred-time-format",
|
|
316
|
+
* value,
|
|
317
|
+
* });
|
|
318
|
+
* // or
|
|
319
|
+
*
|
|
320
|
+
* await neetoPlaywrightUtilities.selectOptionFromDropdown({
|
|
312
321
|
* label,
|
|
313
322
|
* value,
|
|
314
323
|
* options:{
|
|
@@ -321,6 +330,7 @@ declare class CustomCommands {
|
|
|
321
330
|
*/
|
|
322
331
|
selectOptionFromDropdown: ({
|
|
323
332
|
label,
|
|
333
|
+
dataTestId,
|
|
324
334
|
value,
|
|
325
335
|
page,
|
|
326
336
|
options: {
|
package/index.js
CHANGED
|
@@ -2353,10 +2353,14 @@ class CustomCommands {
|
|
|
2353
2353
|
})}`;
|
|
2354
2354
|
return await this.request[method](formattedUrl, requestOptions);
|
|
2355
2355
|
};
|
|
2356
|
-
selectOptionFromDropdown = async ({ label = "nui", value, page = this.page, options: { visibilityTimeout = 5_000, textAssertionTimeout = 5_000, retryTimeout = 60_000, } = {}, }) => {
|
|
2357
|
-
const menu = page.getByTestId(
|
|
2356
|
+
selectOptionFromDropdown = async ({ label = "nui", dataTestId, value, page = this.page, options: { visibilityTimeout = 5_000, textAssertionTimeout = 5_000, retryTimeout = 60_000, } = {}, }) => {
|
|
2357
|
+
const menu = page.getByTestId(dataTestId
|
|
2358
|
+
? `${dataTestId}-select-menu`
|
|
2359
|
+
: COMMON_SELECTORS.customDropDownMenu(label));
|
|
2358
2360
|
const optionByName = menu.getByRole("option", { name: value, exact: true });
|
|
2359
|
-
const container = page.getByTestId(
|
|
2361
|
+
const container = page.getByTestId(dataTestId
|
|
2362
|
+
? `${dataTestId}-select-container`
|
|
2363
|
+
: COMMON_SELECTORS.customSelectContainer(label));
|
|
2360
2364
|
await expect(async () => {
|
|
2361
2365
|
await container.click();
|
|
2362
2366
|
await expect(menu).toBeVisible({ timeout: visibilityTimeout });
|
|
@@ -4718,16 +4722,16 @@ class HelpAndProfilePage {
|
|
|
4718
4722
|
// The country list comes from NeetoAuth, which runs only on staging
|
|
4719
4723
|
IS_STAGING_ENV &&
|
|
4720
4724
|
(await this.neetoPlaywrightUtilities.selectOptionFromDropdown({
|
|
4721
|
-
|
|
4725
|
+
dataTestId: "country",
|
|
4722
4726
|
value: country,
|
|
4723
4727
|
}));
|
|
4724
4728
|
await this.neetoPlaywrightUtilities.selectOptionFromDropdown({
|
|
4725
4729
|
value: timeFormat,
|
|
4726
|
-
|
|
4730
|
+
dataTestId: "preferred-time-format",
|
|
4727
4731
|
});
|
|
4728
4732
|
await this.neetoPlaywrightUtilities.selectOptionFromDropdown({
|
|
4729
4733
|
value: dateFormat,
|
|
4730
|
-
|
|
4734
|
+
dataTestId: "preferred-date-format",
|
|
4731
4735
|
});
|
|
4732
4736
|
};
|
|
4733
4737
|
uploadImage = async (imageName) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bigbinary/neeto-playwright-commons",
|
|
3
|
-
"version": "6.1.
|
|
3
|
+
"version": "6.1.4",
|
|
4
4
|
"description": "A package encapsulating common playwright code across neeto projects.",
|
|
5
5
|
"repository": "git@github.com:bigbinary/neeto-playwright-commons.git",
|
|
6
6
|
"license": "apache-2.0",
|
|
@@ -104,4 +104,4 @@
|
|
|
104
104
|
"proper-lockfile": "4.1.2",
|
|
105
105
|
"puppeteer-extra-plugin-stealth": "2.11.2"
|
|
106
106
|
}
|
|
107
|
-
}
|
|
107
|
+
}
|