@bigbinary/neeto-playwright-commons 4.8.10 → 4.8.12

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.
Files changed (3) hide show
  1. package/index.d.ts +2 -0
  2. package/index.js +19 -35
  3. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -5505,6 +5505,7 @@ declare class OrganizationPage {
5505
5505
  * @endexample
5506
5506
  */
5507
5507
  fillOTP: (otp?: string) => Promise<void>;
5508
+ waitForOrganizationSync: () => Promise<void>;
5508
5509
  /**
5509
5510
  *
5510
5511
  * Waits for the page to load, fills the signup email field, clicks submit, and waits until the submit button is hidden (up to 35s). Use this as the first step when driving the email-based signup flow before entering an OTP.
@@ -9053,6 +9054,7 @@ declare const SIGNUP_SELECTORS: {
9053
9054
  lastNameTextField: string;
9054
9055
  organizationNameTextField: string;
9055
9056
  organizationSubmitButton: string;
9057
+ organizationSyncContainer: string;
9056
9058
  otpTextBox: string;
9057
9059
  profileSubmitButton: string;
9058
9060
  signupViaEmailButton: string;
package/index.js CHANGED
@@ -1950,6 +1950,7 @@ const SIGNUP_SELECTORS = {
1950
1950
  lastNameTextField: "signup-profile-last-name-text-field",
1951
1951
  organizationNameTextField: "signup-organization-name-text-field",
1952
1952
  organizationSubmitButton: "signup-organization-submit-button",
1953
+ organizationSyncContainer: "organization-sync-container",
1953
1954
  otpTextBox: "otpinput-otp-number",
1954
1955
  profileSubmitButton: "signup-profile-submit-button",
1955
1956
  signupViaEmailButton: "signup-via-email-button",
@@ -18107,6 +18108,7 @@ class OrganizationPage {
18107
18108
  await otpTextBox.fill(otp);
18108
18109
  await expect(otpTextBox).toBeHidden({ timeout: 35_000 });
18109
18110
  };
18111
+ waitForOrganizationSync = () => expect(this.page.getByTestId(SIGNUP_SELECTORS.organizationSyncContainer)).toBeHidden({ timeout: 60_000 });
18110
18112
  submitEmail = async (email) => {
18111
18113
  await this.neetoPlaywrightUtilities.waitForPageLoad();
18112
18114
  await this.page.getByTestId(SIGNUP_SELECTORS.emailTextField).fill(email);
@@ -18178,6 +18180,7 @@ class OrganizationPage {
18178
18180
  await this.page.waitForURL(new RegExp(getGlobalUserState().domain), {
18179
18181
  waitUntil: "load",
18180
18182
  });
18183
+ await this.waitForOrganizationSync();
18181
18184
  };
18182
18185
  createOrganization = async (params) => {
18183
18186
  if (shouldSkipSetupAndTeardown())
@@ -18405,6 +18408,7 @@ class OrganizationPage {
18405
18408
  appName,
18406
18409
  });
18407
18410
  await this.page.waitForURL(new RegExp(credentials.domain));
18411
+ await this.waitForOrganizationSync();
18408
18412
  }
18409
18413
  else {
18410
18414
  await createOrganizationViaApi({
@@ -18417,6 +18421,7 @@ class OrganizationPage {
18417
18421
  redirectUri: credentials.domain,
18418
18422
  });
18419
18423
  await this.page.waitForURL(new RegExp(credentials.domain));
18424
+ await this.waitForOrganizationSync();
18420
18425
  }
18421
18426
  };
18422
18427
  signUp = async (params) => {
@@ -117428,38 +117433,22 @@ const readTranslations = () => {
117428
117433
  return translations;
117429
117434
  };
117430
117435
  const getter = (key) => () => getI18nInstance().t(`taxonomyDefaultLabels.${key}`);
117431
- const replaceNullValuesWithGetter = (inputObject, parentKey = "") => {
117432
- const result = {};
117433
- for (const [key, value] of Object.entries(inputObject)) {
117434
- const transKey = parentKey ? `${parentKey}.${key}` : key;
117435
- if (value === null) {
117436
- Object.defineProperty(result, key, {
117437
- get: getter(transKey),
117438
- });
117439
- }
117440
- else if (typeof value === "object") {
117441
- result[key] = replaceNullValuesWithGetter(value, transKey);
117442
- }
117443
- else {
117444
- result[key] = value;
117445
- }
117446
- }
117447
- return result;
117448
- };
117449
- const mergeTaxonomies = async (translations, page) => {
117450
- const defaultTaxonomyKeys = Object.keys(translations.taxonomyDefaultLabels || {});
117451
- const defaultTaxonomies = Object.fromEntries(defaultTaxonomyKeys.map(key => [key, { singular: null, plural: null }]));
117452
- const hostTaxonomies = (await page.evaluate(() => window.globalProps?.taxonomies));
117453
- return replaceNullValuesWithGetter(mergeDeepLeft(hostTaxonomies, defaultTaxonomies));
117436
+ const buildTaxonomies = (translations) => {
117437
+ const taxonomyKeys = Object.keys(translations.taxonomyDefaultLabels || {});
117438
+ return taxonomyKeys.reduce((taxonomies, key) => {
117439
+ taxonomies[key] = Object.defineProperties({}, {
117440
+ singular: { get: getter(`${key}.singular`) },
117441
+ plural: { get: getter(`${key}.plural`) },
117442
+ });
117443
+ return taxonomies;
117444
+ }, {});
117454
117445
  };
117455
117446
 
117456
117447
  const i18nFixture = {
117457
117448
  i18n: [
117458
117449
  async ({}, use) => {
117459
117450
  const translation = readTranslations();
117460
- const browser = await chromium.launch();
117461
- const page = await browser.newPage();
117462
- const taxonomies = await mergeTaxonomies(translation, page);
117451
+ const taxonomies = buildTaxonomies(translation);
117463
117452
  const options = {
117464
117453
  debug: false,
117465
117454
  fallbackLng: "en",
@@ -117485,18 +117474,13 @@ const i18nFixture = {
117485
117474
  },
117486
117475
  postProcess: ["removeTagsProcessor", "sentenceCaseProcessor"],
117487
117476
  };
117488
- const i18nInitialized = await initI18n({
117489
- plugins: [removeTagsProcessor, sentenceCaseProcessor],
117490
- options,
117491
- cache: true,
117492
- });
117493
- await page.close();
117494
- await browser.close();
117477
+ const plugins = [removeTagsProcessor, sentenceCaseProcessor];
117478
+ const i18nInitialized = await initI18n({ plugins, options, cache: true });
117495
117479
  await use(i18nInitialized);
117496
117480
  },
117497
- { auto: true, scope: "worker" },
117481
+ { auto: true, scope: "worker", box: true },
117498
117482
  ],
117499
- t: [({ i18n }, use) => use(i18n.t), { scope: "worker" }],
117483
+ t: [({ i18n }, use) => use(i18n.t), { scope: "worker", box: true }],
117500
117484
  };
117501
117485
 
117502
117486
  class ThankYouPage {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bigbinary/neeto-playwright-commons",
3
- "version": "4.8.10",
3
+ "version": "4.8.12",
4
4
  "description": "A package encapsulating common playwright code across neeto projects.",
5
5
  "repository": "git@github.com:bigbinary/neeto-playwright-commons.git",
6
6
  "license": "apache-2.0",