@bigbinary/neeto-playwright-commons 1.8.25 → 1.8.27

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
@@ -2539,6 +2539,21 @@ class CustomCommands {
2539
2539
  })}`;
2540
2540
  return await this.request[method](formattedUrl, requestOptions);
2541
2541
  };
2542
+ this.selectOptionFromDropdown = async ({ selectValueContainer, selectMenu, value, options = {}, }) => {
2543
+ Object.assign({
2544
+ visiblityTimeout: 2000,
2545
+ textAssertionTimeout: 1000,
2546
+ retryTimeout: 20000,
2547
+ }, options);
2548
+ await test$1.expect(async () => {
2549
+ await this.page.getByTestId(selectValueContainer).click();
2550
+ await test$1.expect(this.page.getByTestId(selectMenu)).toBeVisible({
2551
+ timeout: options.visiblityTimeout,
2552
+ });
2553
+ await this.page.getByTestId(selectMenu).getByText(value).click();
2554
+ await test$1.expect(this.page.getByTestId(selectValueContainer)).toContainText(value, { timeout: options.textAssertionTimeout });
2555
+ }).toPass({ timeout: options.retryTimeout });
2556
+ };
2542
2557
  this.verifyFieldValue = values => {
2543
2558
  const verifyEachFieldValue = ({ field, value, }) => test$1.expect(this.page.getByTestId(field)).toHaveValue(value);
2544
2559
  return Array.isArray(values)
@@ -12565,7 +12580,7 @@ const INTEGRATION_SELECTORS = {
12565
12580
  };
12566
12581
 
12567
12582
  class IntegrationBase {
12568
- constructor({ page, neetoPlaywrightUtilities, integration, integrationRouteIndex, connectHeader, connectedHeader, }) {
12583
+ constructor({ page, neetoPlaywrightUtilities, integration, connectHeader, connectedHeader, pageloaderTimeout, integrationRouteIndex, integrationRouteResponsesParams, }) {
12569
12584
  this.disconnect = async (interceptMultipleResponsesParams = {}) => {
12570
12585
  await this.gotoIntegrationIndex();
12571
12586
  await this.clickOnIntegrationCard();
@@ -12600,18 +12615,27 @@ class IntegrationBase {
12600
12615
  await test$1.expect(this.page.getByTestId(COMMON_SELECTORS.spinner)).toHaveCount(0);
12601
12616
  await this.integrationCard.scrollIntoViewIfNeeded();
12602
12617
  await this.integrationCard.click();
12603
- await test$1.expect(this.page.getByTestId(COMMON_SELECTORS.pageLoader)).toBeHidden();
12618
+ await test$1.expect(this.page.getByTestId(COMMON_SELECTORS.pageLoader)).toBeHidden({ timeout: this.pageloaderTimeout });
12604
12619
  };
12605
12620
  this.gotoIntegrationIndex = async () => {
12606
- neetoCist.isNotEmpty(this.integrationRouteIndex) &&
12607
- (await this.page.goto(this.integrationRouteIndex));
12621
+ if (neetoCist.isNotEmpty(this.integrationRouteIndex)) {
12622
+ const integrationIndexPromise = this.neetoPlaywrightUtilities.interceptMultipleResponses({
12623
+ times: 0,
12624
+ ...this.integrationRouteResponsesParams,
12625
+ });
12626
+ await this.page.goto(this.integrationRouteIndex);
12627
+ await integrationIndexPromise;
12628
+ }
12608
12629
  };
12609
12630
  this.page = page;
12610
12631
  this.neetoPlaywrightUtilities = neetoPlaywrightUtilities;
12611
12632
  this.t = playwrightI18nextFixture.getI18nInstance().t;
12612
12633
  this.integration = integration;
12613
12634
  this.integrationCard = this.page.getByTestId(INTEGRATION_SELECTORS.integrationCard(integration));
12635
+ this.pageloaderTimeout = pageloaderTimeout || 10000;
12614
12636
  this.integrationRouteIndex = integrationRouteIndex || "";
12637
+ this.integrationRouteResponsesParams =
12638
+ integrationRouteResponsesParams || {};
12615
12639
  this.connectHeader =
12616
12640
  connectHeader ||
12617
12641
  INTEGRATIONS_TEXTS.connectHeader(neetoCist.humanize(this.integration));