@bigbinary/neeto-playwright-commons 1.8.26 → 1.8.28

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
@@ -44,6 +44,16 @@ interface FieldValue {
44
44
  value: string;
45
45
  }
46
46
  type VerifyFieldValue = (values: FieldValue | FieldValue[]) => Promise<void> | Promise<void[]>;
47
+ interface SelectOptionFromDropdownParams {
48
+ selectValueContainer: string;
49
+ selectMenu: string;
50
+ value: string;
51
+ options?: Partial<{
52
+ visiblityTimeout: number;
53
+ textAssertionTimeout: number;
54
+ retryTimeout: number;
55
+ }>;
56
+ }
47
57
  declare class CustomCommands {
48
58
  page: Page;
49
59
  responses: string[];
@@ -56,6 +66,7 @@ declare class CustomCommands {
56
66
  verifySuccessToast: ({ message, closeAfterVerification, }?: Partial<VerifySuccessToastParams>) => Promise<void>;
57
67
  reloadAndWait: (requestCount: number, customPageContext?: Page, interceptMultipleResponsesProps?: Partial<Omit<InterceptMultipleResponsesParams, "times">>) => Promise<void>;
58
68
  apiRequest: ApiRequest;
69
+ selectOptionFromDropdown: ({ selectValueContainer, selectMenu, value, options, }: SelectOptionFromDropdownParams) => Promise<void>;
59
70
  verifyFieldValue: VerifyFieldValue;
60
71
  }
61
72
 
package/index.js CHANGED
@@ -2503,6 +2503,21 @@ class CustomCommands {
2503
2503
  })}`;
2504
2504
  return await this.request[method](formattedUrl, requestOptions);
2505
2505
  };
2506
+ this.selectOptionFromDropdown = async ({ selectValueContainer, selectMenu, value, options = {}, }) => {
2507
+ Object.assign({
2508
+ visiblityTimeout: 2000,
2509
+ textAssertionTimeout: 1000,
2510
+ retryTimeout: 20000,
2511
+ }, options);
2512
+ await expect(async () => {
2513
+ await this.page.getByTestId(selectValueContainer).click();
2514
+ await expect(this.page.getByTestId(selectMenu)).toBeVisible({
2515
+ timeout: options.visiblityTimeout,
2516
+ });
2517
+ await this.page.getByTestId(selectMenu).getByText(value).click();
2518
+ await expect(this.page.getByTestId(selectValueContainer)).toContainText(value, { timeout: options.textAssertionTimeout });
2519
+ }).toPass({ timeout: options.retryTimeout });
2520
+ };
2506
2521
  this.verifyFieldValue = values => {
2507
2522
  const verifyEachFieldValue = ({ field, value, }) => expect(this.page.getByTestId(field)).toHaveValue(value);
2508
2523
  return Array.isArray(values)
@@ -12347,18 +12362,7 @@ class HelpAndProfilePage {
12347
12362
  await newConversationButton.click();
12348
12363
  await expect(this.neetoChatSpinner).toBeHidden({ timeout: 35000 });
12349
12364
  });
12350
- await test$2.step("Step 4: Fill and submit email", async () => {
12351
- var _a, _b;
12352
- await this.neetoChatFrame
12353
- .getByTestId(CHAT_WIDGET_SELECTORS.preChatEmailInput)
12354
- .fill((_b = (_a = readFileSyncIfExists()) === null || _a === void 0 ? void 0 : _a.user) === null || _b === void 0 ? void 0 : _b.email);
12355
- await this.neetoChatFrame
12356
- .getByTestId(CHAT_WIDGET_SELECTORS.preChatSubmitButton)
12357
- .getByRole("button")
12358
- .click();
12359
- await expect(this.neetoChatSpinner).toBeHidden({ timeout: 35000 });
12360
- });
12361
- await test$2.step("Step 5: Verify conversation window", async () => {
12365
+ await test$2.step("Step 4: Verify conversation window", async () => {
12362
12366
  await expect(this.neetoChatFrame.getByTestId(CHAT_WIDGET_SELECTORS.chatBubble)).toHaveText(CHAT_WIDGET_TEXTS.welcomeChatBubble);
12363
12367
  });
12364
12368
  };