@bigbinary/neeto-playwright-commons 1.8.37 → 1.8.39

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
@@ -236,6 +236,7 @@ const COMMON_SELECTORS = {
236
236
  columnsDropdownContainer: "show/hide-columns-dropdown-container",
237
237
  columnsDropdownButton: "columns-dropdown-button",
238
238
  breadcrumbHeader: "header-breadcrumb",
239
+ header: "neeto-molecules-header",
239
240
  };
240
241
 
241
242
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
@@ -2563,6 +2564,18 @@ class CustomCommands {
2563
2564
  await pageContext.reload();
2564
2565
  await reloadRequests;
2565
2566
  };
2567
+ this.waitForPageLoad = async ({ visiblityTimeout = 35000, customPageContext, }) => {
2568
+ const pageContext = customPageContext !== null && customPageContext !== void 0 ? customPageContext : this.page;
2569
+ await pageContext.waitForLoadState("load");
2570
+ await Promise.all([
2571
+ test$1.expect(pageContext.getByTestId(COMMON_SELECTORS.pageLoader)).toBeHidden({
2572
+ timeout: visiblityTimeout,
2573
+ }),
2574
+ test$1.expect(pageContext.getByTestId(COMMON_SELECTORS.spinner)).toBeHidden({
2575
+ timeout: visiblityTimeout,
2576
+ }),
2577
+ ]);
2578
+ };
2566
2579
  this.apiRequest = async ({ url, failOnStatusCode = true, headers: additionalHeaders, body: data, method = "get", params = {}, ...otherOptions }) => {
2567
2580
  const csrfToken = await this.page
2568
2581
  .locator("[name='csrf-token']")
@@ -2614,12 +2627,18 @@ class CustomCommands {
2614
2627
 
2615
2628
  class MailosaurUtils {
2616
2629
  constructor(mailosaur) {
2630
+ this.getEmailContent = ({ email, subjectSubstring = "", timeout = 2 * 60 * 1000, receivedAfter = new Date(), }) => this.mailosaur.messages.get(this.serverId, { sentTo: email, subject: subjectSubstring }, { timeout, receivedAfter });
2617
2631
  this.fetchOtpFromEmail = async ({ email, subjectSubstring = OTP_EMAIL_PATTERN, timeout = 2 * 60 * 1000, receivedAfter = new Date(), }) => {
2618
2632
  var _a, _b, _c;
2619
- const receivedEmail = await this.mailosaur.messages.get(this.serverId, { sentTo: email, subject: subjectSubstring }, { timeout, receivedAfter });
2633
+ const receivedEmail = await this.getEmailContent({
2634
+ email,
2635
+ subjectSubstring,
2636
+ timeout,
2637
+ receivedAfter,
2638
+ });
2620
2639
  const otp = (_c = (_b = (_a = receivedEmail === null || receivedEmail === void 0 ? void 0 : receivedEmail.text) === null || _a === void 0 ? void 0 : _a.codes) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.value;
2621
2640
  if (ramda.isNil(otp)) {
2622
- throw new Error(`No codes found in the email with subject: ${receivedEmail.subject}. Please re-evaluate the filtering parameters.`);
2641
+ throw new Error(`No codes found in the email with subject: ${receivedEmail === null || receivedEmail === void 0 ? void 0 : receivedEmail.subject}. Please re-evaluate the filtering parameters.`);
2623
2642
  }
2624
2643
  return otp;
2625
2644
  };