@bigbinary/neeto-playwright-commons 1.1.2 → 1.1.3

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
@@ -6866,12 +6866,13 @@ class CustomCommands {
6866
6866
  params,
6867
6867
  ...otherOptions,
6868
6868
  };
6869
- return await {
6870
- get: this.request.get(url, requestOptions),
6871
- post: this.request.post(url, requestOptions),
6872
- put: this.request.put(url, requestOptions),
6873
- delete: this.request.delete(url, requestOptions),
6874
- }[method.toLowerCase()];
6869
+ const httpMethodsHandlers = {
6870
+ get: () => this.request.get(url, requestOptions),
6871
+ post: () => this.request.post(url, requestOptions),
6872
+ put: () => this.request.put(url, requestOptions),
6873
+ delete: () => this.request.delete(url, requestOptions),
6874
+ };
6875
+ return await httpMethodsHandlers[method.toLowerCase()]();
6875
6876
  };
6876
6877
  this.verifyFieldValue = values => {
6877
6878
  const verifyEachFieldValue = ({ field, value, }) => test.expect(this.page.getByTestId(field)).toHaveValue(value);
@@ -6940,7 +6941,7 @@ const ROUTES = {
6940
6941
  signup: `${BASE_URL}/signups`,
6941
6942
  subdomainAvailability: `${BASE_URL}/subdomain_availability`,
6942
6943
  countries: `${BASE_URL}/countries`,
6943
- neetoAps: `${BASE_URL}/neeto_apps`,
6944
+ neetoApps: `${BASE_URL}/neeto_apps`,
6944
6945
  };
6945
6946
 
6946
6947
  const SIGNUP_SELECTORS = {
@@ -7032,7 +7033,7 @@ class OrganizationPage {
7032
7033
  subdomainName: user.subdomainName,
7033
7034
  appName: "neetoInvoice",
7034
7035
  });
7035
- await this.page.route(`**${ROUTES.neetoAps}`, async (route) => {
7036
+ await this.page.route(`**${ROUTES.neetoApps}`, async (route) => {
7036
7037
  headers = await route.request().allHeaders();
7037
7038
  await route.continue();
7038
7039
  });
@@ -7120,21 +7121,23 @@ const loginWithoutSSO = async ({ page, neetoPlaywrightUtilities, }) => {
7120
7121
  var _a;
7121
7122
  await page.goto((_a = process.env.BASE_URL) !== null && _a !== void 0 ? _a : "");
7122
7123
  let headers = {};
7123
- await page.route(`**${ROUTES.login}`, async (route) => {
7124
- headers = await route.request().allHeaders();
7125
- await route.continue();
7126
- });
7127
7124
  await page.getByTestId("login-email-text-field").fill(CREDENTIALS.email);
7128
7125
  await page
7129
7126
  .getByTestId("login-password-text-field")
7130
7127
  .fill(CREDENTIALS.password);
7131
7128
  const login = neetoPlaywrightUtilities.interceptMultipleResponses({
7132
- times: 2,
7129
+ times: 1,
7133
7130
  });
7134
7131
  await page.getByTestId(LOGIN_SELECTORS.submitButton).click();
7135
7132
  await login;
7133
+ await page.route(`**${BASE_URL}/**`, async (route) => {
7134
+ headers = await route.request().allHeaders();
7135
+ await route.continue();
7136
+ });
7136
7137
  const userCredentials = readFileSyncIfExists();
7137
7138
  await page.context().storageState({ path: STORAGE_STATE });
7139
+ //eslint-disable-next-line
7140
+ await page.waitForTimeout(5000); // There is a delay in headers being set from the route.
7138
7141
  const mergedCredentials = {
7139
7142
  ...readFileSyncIfExists(),
7140
7143
  ...userCredentials,
@@ -7593,6 +7596,7 @@ const definePlaywrightConfig = (overrides) => {
7593
7596
  });
7594
7597
  };
7595
7598
 
7599
+ exports.BASE_URL = BASE_URL;
7596
7600
  exports.COMMON_SELECTORS = COMMON_SELECTORS;
7597
7601
  exports.COMMON_TEXTS = COMMON_TEXTS;
7598
7602
  exports.CREDENTIALS = CREDENTIALS;