@bigbinary/neeto-playwright-commons 4.8.11 → 4.8.13

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 +1 -0
  2. package/index.js +22 -37
  3. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -8080,6 +8080,7 @@ declare const NEETO_EDITOR_SELECTORS: {
8080
8080
  paragraphOption: string;
8081
8081
  calloutOption: string;
8082
8082
  attachmentPreview: string;
8083
+ attachmentActionsButton: string;
8083
8084
  imageUploadLinkButton: string;
8084
8085
  errorText: string;
8085
8086
  content: string;
package/index.js CHANGED
@@ -1523,6 +1523,7 @@ const NEETO_EDITOR_SELECTORS = {
1523
1523
  paragraphOption: fixedMenuSelector("font-size-option-body2"),
1524
1524
  calloutOption: fixedMenuSelector("callout-option"),
1525
1525
  attachmentPreview: "ne-attachments-wrapper",
1526
+ attachmentActionsButton: "neeto-editor-attachment-actions",
1526
1527
  imageUploadLinkButton: "neeto-editor-media-uploader-link-tab",
1527
1528
  errorText: "neeto-editor-error-text",
1528
1529
  content: "editor-content",
@@ -18466,9 +18467,12 @@ class OrganizationPage {
18466
18467
  const countrySelector = this.page.getByTestId(COMMON_SELECTORS.customSelectContainer("country"));
18467
18468
  await countrySelector.click();
18468
18469
  await countrySelector.pressSequentially(country);
18470
+ // TODO: Remove the country-select-option fallback once all products use the neeto-atoms version with per-option testids.
18469
18471
  await this.page
18472
+ .getByTestId(COMMON_SELECTORS.selectOption(country))
18473
+ .or(this.page
18470
18474
  .getByTestId(COMMON_SELECTORS.selectOption("country"))
18471
- .filter({ hasText: new RegExp(`^${country}$`) })
18475
+ .filter({ hasText: new RegExp(`^${country}$`) }))
18472
18476
  .click();
18473
18477
  await expect(countrySelector).toContainText(country);
18474
18478
  };
@@ -117433,38 +117437,22 @@ const readTranslations = () => {
117433
117437
  return translations;
117434
117438
  };
117435
117439
  const getter = (key) => () => getI18nInstance().t(`taxonomyDefaultLabels.${key}`);
117436
- const replaceNullValuesWithGetter = (inputObject, parentKey = "") => {
117437
- const result = {};
117438
- for (const [key, value] of Object.entries(inputObject)) {
117439
- const transKey = parentKey ? `${parentKey}.${key}` : key;
117440
- if (value === null) {
117441
- Object.defineProperty(result, key, {
117442
- get: getter(transKey),
117443
- });
117444
- }
117445
- else if (typeof value === "object") {
117446
- result[key] = replaceNullValuesWithGetter(value, transKey);
117447
- }
117448
- else {
117449
- result[key] = value;
117450
- }
117451
- }
117452
- return result;
117453
- };
117454
- const mergeTaxonomies = async (translations, page) => {
117455
- const defaultTaxonomyKeys = Object.keys(translations.taxonomyDefaultLabels || {});
117456
- const defaultTaxonomies = Object.fromEntries(defaultTaxonomyKeys.map(key => [key, { singular: null, plural: null }]));
117457
- const hostTaxonomies = (await page.evaluate(() => window.globalProps?.taxonomies));
117458
- return replaceNullValuesWithGetter(mergeDeepLeft(hostTaxonomies, defaultTaxonomies));
117440
+ const buildTaxonomies = (translations) => {
117441
+ const taxonomyKeys = Object.keys(translations.taxonomyDefaultLabels || {});
117442
+ return taxonomyKeys.reduce((taxonomies, key) => {
117443
+ taxonomies[key] = Object.defineProperties({}, {
117444
+ singular: { get: getter(`${key}.singular`) },
117445
+ plural: { get: getter(`${key}.plural`) },
117446
+ });
117447
+ return taxonomies;
117448
+ }, {});
117459
117449
  };
117460
117450
 
117461
117451
  const i18nFixture = {
117462
117452
  i18n: [
117463
117453
  async ({}, use) => {
117464
117454
  const translation = readTranslations();
117465
- const browser = await chromium.launch();
117466
- const page = await browser.newPage();
117467
- const taxonomies = await mergeTaxonomies(translation, page);
117455
+ const taxonomies = buildTaxonomies(translation);
117468
117456
  const options = {
117469
117457
  debug: false,
117470
117458
  fallbackLng: "en",
@@ -117490,18 +117478,13 @@ const i18nFixture = {
117490
117478
  },
117491
117479
  postProcess: ["removeTagsProcessor", "sentenceCaseProcessor"],
117492
117480
  };
117493
- const i18nInitialized = await initI18n({
117494
- plugins: [removeTagsProcessor, sentenceCaseProcessor],
117495
- options,
117496
- cache: true,
117497
- });
117498
- await page.close();
117499
- await browser.close();
117481
+ const plugins = [removeTagsProcessor, sentenceCaseProcessor];
117482
+ const i18nInitialized = await initI18n({ plugins, options, cache: true });
117500
117483
  await use(i18nInitialized);
117501
117484
  },
117502
- { auto: true, scope: "worker" },
117485
+ { auto: true, scope: "worker", box: true },
117503
117486
  ],
117504
- t: [({ i18n }, use) => use(i18n.t), { scope: "worker" }],
117487
+ t: [({ i18n }, use) => use(i18n.t), { scope: "worker", box: true }],
117505
117488
  };
117506
117489
 
117507
117490
  class ThankYouPage {
@@ -120955,8 +120938,10 @@ class EditorPage {
120955
120938
  await fileUploader.setFiles(imagePath);
120956
120939
  await expect(this.attachmentPreview).toBeVisible();
120957
120940
  if (shouldRemoveAttachment) {
120941
+ // TODO: Remove the dropdownIcon fallback once all products use the v2 neeto-editor.
120958
120942
  await this.attachmentPreview
120959
- .getByTestId(COMMON_SELECTORS.dropdownIcon)
120943
+ .getByTestId(NEETO_EDITOR_SELECTORS.attachmentActionsButton)
120944
+ .or(this.attachmentPreview.getByTestId(COMMON_SELECTORS.dropdownIcon))
120960
120945
  .click();
120961
120946
  await this.page
120962
120947
  .getByTestId(NEETO_EDITOR_SELECTORS.attachmentPreviewDeleteButton)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bigbinary/neeto-playwright-commons",
3
- "version": "4.8.11",
3
+ "version": "4.8.13",
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",