@bigbinary/neeto-playwright-commons 1.4.1 → 1.4.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 +91 -25
- package/index.cjs.js.map +1 -1
- package/index.d.ts +1 -0
- package/index.js +91 -25
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.cjs.js
CHANGED
|
@@ -275,6 +275,62 @@ const generateStagingData = (product = "invoice") => {
|
|
|
275
275
|
};
|
|
276
276
|
};
|
|
277
277
|
|
|
278
|
+
const LOWERCASED = "__LOWERCASED__";
|
|
279
|
+
const FORMATS = {
|
|
280
|
+
boldList: "boldList",
|
|
281
|
+
list: "list",
|
|
282
|
+
anyCase: "anyCase",
|
|
283
|
+
};
|
|
284
|
+
const LIST_FORMATS = [FORMATS.boldList, FORMATS.list];
|
|
285
|
+
|
|
286
|
+
const cacheStore = new Map();
|
|
287
|
+
const fetchCachedOrInvoke = (func, lng, options) => {
|
|
288
|
+
var _a;
|
|
289
|
+
let cache = (_a = cacheStore.get(lng)) === null || _a === void 0 ? void 0 : _a.get(options);
|
|
290
|
+
if (cache)
|
|
291
|
+
return cache;
|
|
292
|
+
cache = func(lng, options);
|
|
293
|
+
const lngCache = cacheStore.get(lng);
|
|
294
|
+
if (lngCache)
|
|
295
|
+
lngCache.set(options, cache);
|
|
296
|
+
else
|
|
297
|
+
cacheStore.set(lng, new Map([[options, cache]]));
|
|
298
|
+
return cache;
|
|
299
|
+
};
|
|
300
|
+
const lowerCaseDynamicTextFormatter = (value, format) => {
|
|
301
|
+
if (!value || format === FORMATS.anyCase || typeof value !== "string") {
|
|
302
|
+
return value;
|
|
303
|
+
}
|
|
304
|
+
return LOWERCASED + value.toLocaleLowerCase();
|
|
305
|
+
};
|
|
306
|
+
const listFormatter = ({ value, format, lng, options, }) => {
|
|
307
|
+
const formatter = fetchCachedOrInvoke((lng, options) => new Intl.ListFormat(lng, options), lng, options);
|
|
308
|
+
let newValue = value;
|
|
309
|
+
if (format === FORMATS.boldList) {
|
|
310
|
+
newValue = value.map(item => `<strong>${item}</strong>`);
|
|
311
|
+
}
|
|
312
|
+
const items = newValue.toString().split(",");
|
|
313
|
+
return formatter.format(items);
|
|
314
|
+
};
|
|
315
|
+
|
|
316
|
+
const sentenceCase = (value) => value.charAt(0).toLocaleUpperCase() + value.slice(1);
|
|
317
|
+
const sentenceCaseProcessor = {
|
|
318
|
+
type: "postProcessor",
|
|
319
|
+
name: "sentenceCaseProcessor",
|
|
320
|
+
process: (value) => {
|
|
321
|
+
const shouldSentenceCase = value.startsWith(LOWERCASED);
|
|
322
|
+
value = value.replaceAll(LOWERCASED, "");
|
|
323
|
+
return shouldSentenceCase ? sentenceCase(value) : value;
|
|
324
|
+
},
|
|
325
|
+
};
|
|
326
|
+
const removeTagsProcessor = {
|
|
327
|
+
type: "postProcessor",
|
|
328
|
+
name: "removeTagsProcessor",
|
|
329
|
+
process: function (value) {
|
|
330
|
+
return value.replace(/<\/?[^>]+(>|$)/g, "");
|
|
331
|
+
},
|
|
332
|
+
};
|
|
333
|
+
|
|
278
334
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
279
335
|
|
|
280
336
|
var tasks = {};
|
|
@@ -7019,19 +7075,27 @@ const i18nFixture = {
|
|
|
7019
7075
|
resources: { en: { translation } },
|
|
7020
7076
|
interpolation: {
|
|
7021
7077
|
defaultVariables: { taxonomies },
|
|
7078
|
+
escapeValue: false,
|
|
7079
|
+
skipOnVariables: false,
|
|
7080
|
+
alwaysFormat: true,
|
|
7081
|
+
format: (value, format, lng, options) => {
|
|
7082
|
+
let newValue = value;
|
|
7083
|
+
if (LIST_FORMATS.includes(format !== null && format !== void 0 ? format : "")) {
|
|
7084
|
+
newValue = listFormatter({
|
|
7085
|
+
value: newValue,
|
|
7086
|
+
format,
|
|
7087
|
+
lng,
|
|
7088
|
+
options,
|
|
7089
|
+
});
|
|
7090
|
+
return newValue;
|
|
7091
|
+
}
|
|
7092
|
+
return lowerCaseDynamicTextFormatter(newValue, format);
|
|
7093
|
+
},
|
|
7022
7094
|
},
|
|
7023
|
-
postProcess: "
|
|
7095
|
+
postProcess: ["removeTagsProcessor", "sentenceCaseProcessor"],
|
|
7024
7096
|
};
|
|
7025
7097
|
const i18nInitialized = await playwrightI18nextFixture.initI18n({
|
|
7026
|
-
plugins: [
|
|
7027
|
-
{
|
|
7028
|
-
type: "postProcessor",
|
|
7029
|
-
name: "removeTags",
|
|
7030
|
-
process: function (value) {
|
|
7031
|
-
return value.replace(/<\/?[^>]+(>|$)/g, "");
|
|
7032
|
-
},
|
|
7033
|
-
},
|
|
7034
|
-
],
|
|
7098
|
+
plugins: [removeTagsProcessor, sentenceCaseProcessor],
|
|
7035
7099
|
options,
|
|
7036
7100
|
// Fetch translations in every test or fetch once
|
|
7037
7101
|
cache: true,
|
|
@@ -7787,7 +7851,7 @@ const currentsConfig = {
|
|
|
7787
7851
|
const isCI = ["staging", "review"].includes((_b = process.env.TEST_ENV) !== null && _b !== void 0 ? _b : "development") &&
|
|
7788
7852
|
!!process.env.NEETO_CI_JOB_ID;
|
|
7789
7853
|
const definePlaywrightConfig = (overrides) => {
|
|
7790
|
-
const { globalOverrides = {}, useOverrides = {}, projectOverrides = [], currentsOverrides = {}, } = overrides;
|
|
7854
|
+
const { globalOverrides = {}, useOverrides = {}, useCustomProjects = false, projectOverrides = [], currentsOverrides = {}, } = overrides;
|
|
7791
7855
|
return test.defineConfig({
|
|
7792
7856
|
testDir: "./e2e/tests",
|
|
7793
7857
|
fullyParallel: true,
|
|
@@ -7806,20 +7870,22 @@ const definePlaywrightConfig = (overrides) => {
|
|
|
7806
7870
|
screenshot: "on",
|
|
7807
7871
|
...useOverrides,
|
|
7808
7872
|
},
|
|
7809
|
-
projects:
|
|
7810
|
-
|
|
7811
|
-
|
|
7812
|
-
|
|
7813
|
-
|
|
7814
|
-
|
|
7815
|
-
|
|
7816
|
-
|
|
7817
|
-
|
|
7818
|
-
|
|
7819
|
-
|
|
7820
|
-
|
|
7821
|
-
|
|
7822
|
-
|
|
7873
|
+
projects: useCustomProjects
|
|
7874
|
+
? projectOverrides
|
|
7875
|
+
: [
|
|
7876
|
+
{
|
|
7877
|
+
name: "setup",
|
|
7878
|
+
testMatch: "global.setup.ts",
|
|
7879
|
+
teardown: "cleanup credentials",
|
|
7880
|
+
},
|
|
7881
|
+
{
|
|
7882
|
+
name: "chromium",
|
|
7883
|
+
use: { ...test.devices["Desktop Chrome"], storageState },
|
|
7884
|
+
dependencies: ["setup"],
|
|
7885
|
+
},
|
|
7886
|
+
{ name: "cleanup credentials", testMatch: "global.teardown.ts" },
|
|
7887
|
+
...projectOverrides,
|
|
7888
|
+
],
|
|
7823
7889
|
});
|
|
7824
7890
|
};
|
|
7825
7891
|
|