@bigbinary/neeto-playwright-commons 1.8.8 → 1.8.10

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
@@ -180,14 +180,14 @@ const COMMON_SELECTORS = {
180
180
  appSwitcherButton: "app-switcher-button",
181
181
  appSwitcherWrapper: "switcher-wrapper",
182
182
  tableSpinner: ".ant-spin",
183
- pageLoader: "neeto-molecules-page-loader",
183
+ pageLoader: "neeto-molecules-pageloader",
184
184
  homeButton: "home-button",
185
185
  neetoUiSwitch: "nui-switch",
186
186
  floatingActionMenuButton: "floating-action-menu-container",
187
187
  };
188
188
 
189
189
  class CustomCommands {
190
- constructor(page, request) {
190
+ constructor(page, request, baseURL = process.env.BASE_URL) {
191
191
  this.interceptMultipleResponses = ({ responseUrl = "", times = 1, baseUrl, customPageContext, timeout = 35000, } = {}) => {
192
192
  const pageContext = customPageContext !== null && customPageContext !== void 0 ? customPageContext : this.page;
193
193
  return Promise.all([...new Array(times)].map(() => pageContext.waitForResponse((response) => {
@@ -195,9 +195,7 @@ class CustomCommands {
195
195
  if (response.request().resourceType() === "xhr" &&
196
196
  response.status() === 200 &&
197
197
  response.url().includes(responseUrl) &&
198
- response
199
- .url()
200
- .startsWith((_a = baseUrl !== null && baseUrl !== void 0 ? baseUrl : process.env.BASE_URL) !== null && _a !== void 0 ? _a : "") &&
198
+ response.url().startsWith((_a = baseUrl !== null && baseUrl !== void 0 ? baseUrl : this.baseURL) !== null && _a !== void 0 ? _a : "") &&
201
199
  !this.responses.includes((_b = response.headers()) === null || _b === void 0 ? void 0 : _b["x-request-id"])) {
202
200
  this.responses.push((_c = response.headers()) === null || _c === void 0 ? void 0 : _c["x-request-id"]);
203
201
  return true;
@@ -229,10 +227,11 @@ class CustomCommands {
229
227
  (await this.page.getByTestId(COMMON_SELECTORS.toastCloseButton).click());
230
228
  await test.expect(this.page.locator(COMMON_SELECTORS.toastIcon)).toBeHidden();
231
229
  };
232
- this.reloadAndWait = async (requestCount, customPageContext) => {
230
+ this.reloadAndWait = async (requestCount, customPageContext, interceptMultipleResponsesProps = {}) => {
233
231
  const pageContext = customPageContext !== null && customPageContext !== void 0 ? customPageContext : this.page;
234
232
  const reloadRequests = this.interceptMultipleResponses({
235
233
  times: requestCount,
234
+ ...interceptMultipleResponsesProps,
236
235
  });
237
236
  await pageContext.reload();
238
237
  await reloadRequests;
@@ -270,6 +269,7 @@ class CustomCommands {
270
269
  this.page = page;
271
270
  this.responses = [];
272
271
  this.request = request;
272
+ this.baseURL = baseURL;
273
273
  }
274
274
  }
275
275
 
@@ -296,8 +296,8 @@ class MailosaurUtils {
296
296
  }
297
297
 
298
298
  const commands = {
299
- neetoPlaywrightUtilities: async ({ page, request }, use) => {
300
- const commands = new CustomCommands(page, request);
299
+ neetoPlaywrightUtilities: async ({ page, request, baseURL }, use) => {
300
+ const commands = new CustomCommands(page, request, baseURL);
301
301
  await use(commands);
302
302
  },
303
303
  mailosaur: async ({}, use) => {
@@ -324,11 +324,11 @@ const commands = {
324
324
 
325
325
  const generateStagingData = (product = "invoice") => {
326
326
  var _a;
327
- const timestamp = `${dayjs__default["default"]().format("YYYYMMDDHH")}${(_a = process.env.JOB_COMPLETION_INDEX) !== null && _a !== void 0 ? _a : ""}`;
327
+ const timestamp = `${dayjs__default["default"]().format("MMDDHHmmssSSS")}${(_a = process.env.JOB_COMPLETION_INDEX) !== null && _a !== void 0 ? _a : ""}`;
328
328
  const firstName = "André";
329
329
  const lastName = "O'Reilly";
330
330
  const otpBypassKey = process.env.OTP_BYPASS_KEY;
331
- const stagingOrganization = `cypresstest-${product}-${timestamp}`;
331
+ const stagingOrganization = `cpt-${product}-${timestamp}`;
332
332
  return {
333
333
  firstName,
334
334
  lastName,
@@ -340,7 +340,7 @@ const generateStagingData = (product = "invoice") => {
340
340
  businessName: stagingOrganization,
341
341
  subdomainName: IS_STAGING_ENV ? stagingOrganization : "spinkart",
342
342
  email: IS_STAGING_ENV
343
- ? `cypresstest${otpBypassKey}+${product}+${timestamp}-playwright@bigbinary.com`
343
+ ? `cpt${otpBypassKey}+${product}+${timestamp}@bigbinary.com`
344
344
  : CREDENTIALS.email,
345
345
  };
346
346
  };
@@ -7465,7 +7465,7 @@ class HelpAndProfilePage {
7465
7465
  .replaceAll(" ", "then")
7466
7466
  .replaceAll("+", "");
7467
7467
  return osPlatform === "mac"
7468
- ? formattedShortcut.replace(/ctrl/g, "⌘")
7468
+ ? formattedShortcut.replace(/ctrl/g, "⌘").replace(/alt/g, "opt")
7469
7469
  : formattedShortcut;
7470
7470
  };
7471
7471
  this.openAndVerifyKeyboardShortcutsPane = async (productShortcuts, osPlatform = "windows") => {
@@ -7740,7 +7740,7 @@ const SIGNUP_SELECTORS = {
7740
7740
  };
7741
7741
 
7742
7742
  const extractSubdomainFromError = (errorString) => {
7743
- const regex = /cypresstest[a-zA-Z0-9-]+/g;
7743
+ const regex = /cpt[a-zA-Z0-9-]+/g;
7744
7744
  const matches = errorString.match(regex);
7745
7745
  return matches[1];
7746
7746
  };