@bigbinary/neeto-playwright-commons 1.3.2 → 1.4.1

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.
@@ -18,6 +18,7 @@ const commonEslintConfig = ({
18
18
  env: { node: true },
19
19
  files: [".eslintrc.{js,cjs}"],
20
20
  parserOptions: { sourceType: "script" },
21
+ rules: { "@typescript-eslint/no-var-requires": "off" },
21
22
  },
22
23
  {
23
24
  env: { node: true },
package/index.cjs.js CHANGED
@@ -3,47 +3,278 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var test = require('@playwright/test');
6
- var require$$0$3 = require('fs');
6
+ var require$$0 = require('fs');
7
+ var dayjs = require('dayjs');
8
+ var playwrightI18nextFixture = require('playwright-i18next-fixture');
7
9
  var require$$2 = require('os');
8
- var require$$0 = require('path');
9
- var require$$0$1 = require('util');
10
- var require$$0$2 = require('stream');
10
+ var require$$0$1 = require('path');
11
+ var require$$0$2 = require('util');
12
+ var require$$0$3 = require('stream');
11
13
  var require$$0$4 = require('events');
12
14
  var ramda = require('ramda');
13
- var dayjs = require('dayjs');
14
- var playwrightI18nextFixture = require('playwright-i18next-fixture');
15
15
  var require$$3 = require('crypto');
16
16
 
17
17
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
18
18
 
19
19
  function _interopNamespace(e) {
20
- if (e && e.__esModule) return e;
21
- var n = Object.create(null);
22
- if (e) {
23
- Object.keys(e).forEach(function (k) {
24
- if (k !== 'default') {
25
- var d = Object.getOwnPropertyDescriptor(e, k);
26
- Object.defineProperty(n, k, d.get ? d : {
27
- enumerable: true,
28
- get: function () { return e[k]; }
29
- });
30
- }
31
- });
32
- }
33
- n["default"] = e;
34
- return Object.freeze(n);
20
+ if (e && e.__esModule) return e;
21
+ var n = Object.create(null);
22
+ if (e) {
23
+ Object.keys(e).forEach(function (k) {
24
+ if (k !== 'default') {
25
+ var d = Object.getOwnPropertyDescriptor(e, k);
26
+ Object.defineProperty(n, k, d.get ? d : {
27
+ enumerable: true,
28
+ get: function () { return e[k]; }
29
+ });
30
+ }
31
+ });
32
+ }
33
+ n["default"] = e;
34
+ return Object.freeze(n);
35
35
  }
36
36
 
37
- var require$$0__default$3 = /*#__PURE__*/_interopDefaultLegacy(require$$0$3);
38
- var require$$0__namespace = /*#__PURE__*/_interopNamespace(require$$0$3);
37
+ var require$$0__namespace = /*#__PURE__*/_interopNamespace(require$$0);
38
+ var require$$0__default$3 = /*#__PURE__*/_interopDefaultLegacy(require$$0);
39
+ var dayjs__default = /*#__PURE__*/_interopDefaultLegacy(dayjs);
39
40
  var require$$2__default = /*#__PURE__*/_interopDefaultLegacy(require$$2);
40
- var require$$0__default = /*#__PURE__*/_interopDefaultLegacy(require$$0);
41
- var require$$0__default$1 = /*#__PURE__*/_interopDefaultLegacy(require$$0$1);
42
- var require$$0__default$2 = /*#__PURE__*/_interopDefaultLegacy(require$$0$2);
41
+ var require$$0__default = /*#__PURE__*/_interopDefaultLegacy(require$$0$1);
42
+ var require$$0__default$1 = /*#__PURE__*/_interopDefaultLegacy(require$$0$2);
43
+ var require$$0__default$2 = /*#__PURE__*/_interopDefaultLegacy(require$$0$3);
43
44
  var require$$0__default$4 = /*#__PURE__*/_interopDefaultLegacy(require$$0$4);
44
- var dayjs__default = /*#__PURE__*/_interopDefaultLegacy(dayjs);
45
45
  var require$$3__default = /*#__PURE__*/_interopDefaultLegacy(require$$3);
46
46
 
47
+ const ENVIRONMENT = {
48
+ development: "development",
49
+ staging: "staging",
50
+ review: "review",
51
+ };
52
+ const IS_STAGING_ENV = process.env.TEST_ENV === "staging";
53
+ const STORAGE_STATE = "./e2e/auth/user.json";
54
+ const GLOBAL_TRANSLATIONS_PATTERN = "../node_modules/@bigbinary/**/translations/en.json";
55
+ const PROJECT_TRANSLATIONS_PATH = "../app/javascript/src/translations/en.json";
56
+ const CREDENTIALS = {
57
+ name: "Oliver Smith",
58
+ email: "oliver@example.com",
59
+ password: "welcome",
60
+ };
61
+
62
+ const joinString = (string1, string2, string3 = "", separator = " ") => {
63
+ if (string3 === "") {
64
+ return string1 + separator + string2;
65
+ }
66
+ return string1 + separator + string2 + separator + string3;
67
+ };
68
+ const readFileSyncIfExists = (path = STORAGE_STATE) => {
69
+ try {
70
+ return JSON.parse(require$$0__namespace.readFileSync(path, "utf8"));
71
+ }
72
+ catch (error) {
73
+ return {};
74
+ }
75
+ };
76
+ const writeDataToFile = data => {
77
+ try {
78
+ require$$0__namespace.writeFileSync(STORAGE_STATE, data, "utf8");
79
+ }
80
+ catch (error) {
81
+ console.log(error); // eslint-disable-line
82
+ }
83
+ return true;
84
+ };
85
+ const updateCredentials = ({ key, value }) => {
86
+ const data = readFileSyncIfExists();
87
+ data["user"][key] = value;
88
+ return writeDataToFile(JSON.stringify(data));
89
+ };
90
+ const clearCredentials = () => {
91
+ require$$0__namespace.unlink(STORAGE_STATE, error => {
92
+ if (!error)
93
+ return;
94
+ console.log(error); // eslint-disable-line
95
+ });
96
+ };
97
+ const hyphenize = input => {
98
+ const fallbackString = "";
99
+ if (typeof input === "number")
100
+ return String(input);
101
+ if (input && typeof input === "string" && input.replace) {
102
+ return input
103
+ .replace(/[\s_]/g, "-")
104
+ .replace(/([a-z])([A-Z])/g, "$1-$2")
105
+ .replace(/-+/g, "-")
106
+ .toLowerCase();
107
+ }
108
+ return fallbackString;
109
+ };
110
+ const joinHyphenCase = (...args) => args.join(" ").replace(/\s+/g, "-").toLowerCase();
111
+
112
+ const COMMON_SELECTORS = {
113
+ spinner: ".neeto-ui-spinner",
114
+ subheaderText: "subheader-left",
115
+ alertTitle: "alert-title",
116
+ alertModalMessage: "alert-message",
117
+ alertModalSubmitButton: "alert-submit-button",
118
+ checkbox: "nui-checkbox-input",
119
+ checkboxLabel: "nui-checkbox-label",
120
+ dropdownContainer: "nui-dropdown-container",
121
+ dropdownIcon: "nui-dropdown-icon",
122
+ heading: "main-header",
123
+ paneBody: "pane-body",
124
+ paneHeader: "pane-header",
125
+ profileSidebar: "profile-section",
126
+ selectOption: (label) => `${hyphenize(label)}-select-option`,
127
+ toastMessage: "toastr-message-container",
128
+ toastCloseButton: "toastr-close-button",
129
+ windowAlert: "#alert-box",
130
+ body: "body",
131
+ toastIcon: ".Toastify__toast-icon",
132
+ paneModalCrossIcon: "pane-close-button",
133
+ inputField: "nui-input-field",
134
+ alertConfirmationText: "alert-confirmation-text",
135
+ alertCancelButton: "alert-cancel-button",
136
+ alertModalCrossIcon: "modal-close-button",
137
+ saveChangesButton: "save-changes-button",
138
+ cancelButton: "cancel-button",
139
+ inputFieldError: "nui-input-error",
140
+ selectDropDownError: "nui-select-error",
141
+ subTitleHeading: "menubar-subtitle-heading",
142
+ noDataTitle: "no-data-title",
143
+ noDataDescription: "no-data-description",
144
+ backdrop: "neeto-backdrop",
145
+ menuBarHeading: "menubar-heading",
146
+ dropdownWrapper: "nui-select-container-wrapper",
147
+ toggleButton: "menubar-toggle-button",
148
+ tooltip: "tooltip-box",
149
+ articlePageTitle: ".serene-article__title",
150
+ tabItem: "tab-item",
151
+ labelInputError: "label-input-error",
152
+ urlInputError: "url-input-error",
153
+ noDataPrimaryButton: "no-data-primary-button",
154
+ modalHeader: "modal-header",
155
+ nameInputError: "name-input-error",
156
+ selectContainer: "nui-select-container",
157
+ dropdownMenu: "nui-select-menu",
158
+ sidebarToggle: "neeto-molecules-sidebar-toggler",
159
+ subheader: "subheader",
160
+ settingsLink: "Settings",
161
+ ticketFieldTextInput: (label) => `${hyphenize(label)}-text-input`,
162
+ };
163
+
164
+ class CustomCommands {
165
+ constructor(page, request) {
166
+ this.interceptMultipleResponses = ({ responseUrl = "", times = 1, baseUrl, }) => Promise.all([...new Array(times)].map(() => this.page.waitForResponse((response) => {
167
+ var _a, _b, _c;
168
+ if (response.request().resourceType() === "xhr" &&
169
+ response.status() === 200 &&
170
+ response.url().includes(responseUrl) &&
171
+ response
172
+ .url()
173
+ .startsWith((_a = baseUrl !== null && baseUrl !== void 0 ? baseUrl : process.env.BASE_URL) !== null && _a !== void 0 ? _a : "") &&
174
+ !this.responses.includes((_b = response.headers()) === null || _b === void 0 ? void 0 : _b["x-request-id"])) {
175
+ this.responses.push((_c = response.headers()) === null || _c === void 0 ? void 0 : _c["x-request-id"]);
176
+ return true;
177
+ }
178
+ return false;
179
+ }, { timeout: 10000 })));
180
+ this.recursiveMethod = async (callback, condition, timeout, startTime) => {
181
+ if (Date.now() - timeout >= startTime) {
182
+ return false;
183
+ }
184
+ else if (await condition()) {
185
+ return await callback();
186
+ }
187
+ return await this.recursiveMethod(callback, condition, timeout, startTime);
188
+ };
189
+ this.executeRecursively = async ({ callback, condition, timeout = 5000, }) => {
190
+ const startTime = Date.now();
191
+ await this.recursiveMethod(callback, condition, timeout, startTime);
192
+ };
193
+ this.verifySuccessToast = async ({ message, closeAfterVerification = true, }) => {
194
+ if (message) {
195
+ await test.expect(this.page.getByTestId(COMMON_SELECTORS.toastMessage)).toContainText(message);
196
+ }
197
+ else {
198
+ await test.expect(this.page.locator(COMMON_SELECTORS.toastIcon)).toContainText("👍");
199
+ }
200
+ closeAfterVerification &&
201
+ (await this.page.getByTestId(COMMON_SELECTORS.toastCloseButton).click());
202
+ };
203
+ this.reloadAndWait = async (requestCount) => {
204
+ const reloadRequests = this.interceptMultipleResponses({
205
+ times: requestCount,
206
+ });
207
+ await this.page.reload();
208
+ await reloadRequests;
209
+ };
210
+ this.apiRequest = async ({ url, headers: additionalHeaders, body: data, method = "get", params = {}, ...otherOptions }) => {
211
+ const csrfToken = await this.page
212
+ .locator("[name='csrf-token']")
213
+ .getAttribute("content");
214
+ const requestOptions = {
215
+ headers: {
216
+ ...additionalHeaders,
217
+ "accept-encoding": "gzip",
218
+ "x-csrf-token": csrfToken !== null && csrfToken !== void 0 ? csrfToken : "",
219
+ },
220
+ data,
221
+ params,
222
+ ...otherOptions,
223
+ };
224
+ const httpMethodsHandlers = {
225
+ get: () => this.request.get(url, requestOptions),
226
+ post: () => this.request.post(url, requestOptions),
227
+ put: () => this.request.put(url, requestOptions),
228
+ delete: () => this.request.delete(url, requestOptions),
229
+ };
230
+ return await httpMethodsHandlers[method]();
231
+ };
232
+ this.verifyFieldValue = values => {
233
+ const verifyEachFieldValue = ({ field, value, }) => test.expect(this.page.getByTestId(field)).toHaveValue(value);
234
+ return Array.isArray(values)
235
+ ? Promise.all(values.map(value => verifyEachFieldValue(value)))
236
+ : verifyEachFieldValue(values);
237
+ };
238
+ this.page = page;
239
+ this.responses = [];
240
+ this.request = request;
241
+ }
242
+ }
243
+
244
+ const commands = {
245
+ neetoPlaywrightUtilities: async ({ page, request }, use) => {
246
+ const commands = new CustomCommands(page, request);
247
+ await use(commands);
248
+ },
249
+ page: async ({ page }, use) => {
250
+ await page.goto("/");
251
+ await page.waitForLoadState();
252
+ await use(page);
253
+ },
254
+ };
255
+
256
+ const generateStagingData = (product = "invoice") => {
257
+ const timestamp = dayjs__default["default"]().format("YYYYMMDDHH");
258
+ const firstName = "André";
259
+ const lastName = "O'Reilly";
260
+ const otpBypassKey = process.env.OTP_BYPASS_KEY;
261
+ const stagingOrganization = `cypresstest-${product}-${timestamp}`;
262
+ return {
263
+ firstName,
264
+ lastName,
265
+ otp: 111111,
266
+ domain: `neeto${product}.net`,
267
+ currentUserName: IS_STAGING_ENV
268
+ ? joinString(firstName, lastName)
269
+ : CREDENTIALS.name,
270
+ businessName: stagingOrganization,
271
+ subdomainName: IS_STAGING_ENV ? stagingOrganization : "spinkart",
272
+ email: IS_STAGING_ENV
273
+ ? `cypresstest${otpBypassKey}+${product}+${timestamp}-playwright@bigbinary.com`
274
+ : "oliver@example.com",
275
+ };
276
+ };
277
+
47
278
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
48
279
 
49
280
  var tasks = {};
@@ -6742,56 +6973,6 @@ function assertPatternsInput(input) {
6742
6973
  }
6743
6974
  var out = FastGlob;
6744
6975
 
6745
- const ENVIRONMENT = {
6746
- development: "development",
6747
- staging: "staging",
6748
- review: "review",
6749
- };
6750
- const IS_STAGING_ENV = process.env.TEST_ENV === "staging";
6751
- const STORAGE_STATE = "./e2e/auth/user.json";
6752
- const GLOBAL_TRANSLATIONS_PATTERN = "../node_modules/@bigbinary/**/translations/en.json";
6753
- const PROJECT_TRANSLATIONS_PATH = "../app/javascript/src/translations/en.json";
6754
- const CREDENTIALS = {
6755
- name: "Oliver Smith",
6756
- email: "oliver@example.com",
6757
- password: "welcome",
6758
- };
6759
-
6760
- const joinString = (string1, string2, string3 = "", separator = " ") => {
6761
- if (string3 === "") {
6762
- return string1 + separator + string2;
6763
- }
6764
- return string1 + separator + string2 + separator + string3;
6765
- };
6766
- const readFileSyncIfExists = (path = STORAGE_STATE) => {
6767
- try {
6768
- return JSON.parse(require$$0__namespace.readFileSync(path, "utf8"));
6769
- }
6770
- catch (error) {
6771
- return {};
6772
- }
6773
- };
6774
- const writeDataToFile = data => {
6775
- try {
6776
- require$$0__namespace.writeFileSync(STORAGE_STATE, data, "utf8");
6777
- }
6778
- catch (error) {
6779
- console.log(error); // eslint-disable-line
6780
- }
6781
- return true;
6782
- };
6783
- const updateCredentials = ({ key, value }) => {
6784
- const data = readFileSyncIfExists();
6785
- data["user"][key] = value;
6786
- return writeDataToFile(JSON.stringify(data));
6787
- };
6788
- const clearCredentials = () => {
6789
- require$$0__namespace.unlink(STORAGE_STATE, error => {
6790
- if (!error)
6791
- return;
6792
- console.log(error); // eslint-disable-line
6793
- });
6794
- };
6795
6976
  const readTranslations = () => {
6796
6977
  let translations = readFileSyncIfExists(PROJECT_TRANSLATIONS_PATH);
6797
6978
  const paths = out.sync(GLOBAL_TRANSLATIONS_PATTERN);
@@ -6801,204 +6982,70 @@ const readTranslations = () => {
6801
6982
  });
6802
6983
  return translations;
6803
6984
  };
6804
- const hyphenize = input => {
6805
- const fallbackString = "";
6806
- if (typeof input === "number")
6807
- return String(input);
6808
- if (input && typeof input === "string" && input.replace) {
6809
- return input
6810
- .replace(/[\s_]/g, "-")
6811
- .replace(/([a-z])([A-Z])/g, "$1-$2")
6812
- .replace(/-+/g, "-")
6813
- .toLowerCase();
6985
+ const getter = (key) => () => playwrightI18nextFixture.getI18nInstance().t(`taxonomyDefaultLabels.${key}`);
6986
+ const replaceNullValuesWithGetter = (inputObject, parentKey = "") => {
6987
+ const result = {};
6988
+ for (const [key, value] of Object.entries(inputObject)) {
6989
+ const transKey = parentKey ? `${parentKey}.${key}` : key;
6990
+ if (value === null) {
6991
+ Object.defineProperty(result, key, {
6992
+ get: getter(transKey),
6993
+ });
6994
+ }
6995
+ else if (typeof value === "object") {
6996
+ result[key] = replaceNullValuesWithGetter(value, transKey);
6997
+ }
6998
+ else {
6999
+ result[key] = value;
7000
+ }
6814
7001
  }
6815
- return fallbackString;
7002
+ return result;
6816
7003
  };
6817
- const joinHyphenCase = (...args) => args.join(" ").replace(/\s+/g, "-").toLowerCase();
6818
-
6819
- const COMMON_SELECTORS = {
6820
- spinner: ".neeto-ui-spinner",
6821
- subheaderText: "subheader-left",
6822
- alertTitle: "alert-title",
6823
- alertModalMessage: "alert-message",
6824
- alertModalSubmitButton: "alert-submit-button",
6825
- checkbox: "nui-checkbox-input",
6826
- checkboxLabel: "nui-checkbox-label",
6827
- dropdownContainer: "nui-dropdown-container",
6828
- dropdownIcon: "nui-dropdown-icon",
6829
- heading: "main-header",
6830
- paneBody: "pane-body",
6831
- paneHeader: "pane-header",
6832
- profileSidebar: "profile-section",
6833
- selectOption: (label) => `${hyphenize(label)}-select-option`,
6834
- toastMessage: "toastr-message-container",
6835
- toastCloseButton: "toastr-close-button",
6836
- windowAlert: "#alert-box",
6837
- body: "body",
6838
- toastIcon: ".Toastify__toast-icon",
6839
- paneModalCrossIcon: "pane-close-button",
6840
- inputField: "nui-input-field",
6841
- alertConfirmationText: "alert-confirmation-text",
6842
- alertCancelButton: "alert-cancel-button",
6843
- alertModalCrossIcon: "modal-close-button",
6844
- saveChangesButton: "save-changes-button",
6845
- cancelButton: "cancel-button",
6846
- inputFieldError: "nui-input-error",
6847
- selectDropDownError: "nui-select-error",
6848
- subTitleHeading: "menubar-subtitle-heading",
6849
- noDataTitle: "no-data-title",
6850
- noDataDescription: "no-data-description",
6851
- backdrop: "neeto-backdrop",
6852
- menuBarHeading: "menubar-heading",
6853
- dropdownWrapper: "nui-select-container-wrapper",
6854
- toggleButton: "menubar-toggle-button",
6855
- tooltip: "tooltip-box",
6856
- articlePageTitle: ".serene-article__title",
6857
- tabItem: "tab-item",
6858
- labelInputError: "label-input-error",
6859
- urlInputError: "url-input-error",
6860
- noDataPrimaryButton: "no-data-primary-button",
6861
- modalHeader: "modal-header",
6862
- nameInputError: "name-input-error",
6863
- selectContainer: "nui-select-container",
6864
- dropdownMenu: "nui-select-menu",
6865
- sidebarToggle: "neeto-molecules-sidebar-toggler",
6866
- subheader: "subheader",
6867
- settingsLink: "Settings",
6868
- ticketFieldTextInput: (label) => `${hyphenize(label)}-text-input`,
7004
+ const mergeTaxonomies = async (translations, page) => {
7005
+ const defaultTaxonomyKeys = Object.keys(translations.taxonomyDefaultLabels || {});
7006
+ const defaultTaxonomies = Object.fromEntries(defaultTaxonomyKeys.map(key => [key, { singular: null, plural: null }]));
7007
+ const hostTaxonomies = (await page.evaluate(() => { var _a; return (_a = window.globalProps) === null || _a === void 0 ? void 0 : _a.taxonomies; }));
7008
+ return replaceNullValuesWithGetter(ramda.mergeDeepLeft(hostTaxonomies, defaultTaxonomies));
6869
7009
  };
6870
7010
 
6871
- class CustomCommands {
6872
- constructor(page, request) {
6873
- this.interceptMultipleResponses = ({ responseUrl = "", times = 1, baseUrl, }) => Promise.all([...new Array(times)].map(() => this.page.waitForResponse((response) => {
6874
- var _a, _b, _c;
6875
- if (response.request().resourceType() === "xhr" &&
6876
- response.status() === 200 &&
6877
- response.url().includes(responseUrl) &&
6878
- response
6879
- .url()
6880
- .startsWith((_a = baseUrl !== null && baseUrl !== void 0 ? baseUrl : process.env.BASE_URL) !== null && _a !== void 0 ? _a : "") &&
6881
- !this.responses.includes((_b = response.headers()) === null || _b === void 0 ? void 0 : _b["x-request-id"])) {
6882
- this.responses.push((_c = response.headers()) === null || _c === void 0 ? void 0 : _c["x-request-id"]);
6883
- return true;
6884
- }
6885
- return false;
6886
- }, { timeout: 10000 })));
6887
- this.recursiveMethod = async (callback, condition, timeout, startTime) => {
6888
- if (Date.now() - timeout >= startTime) {
6889
- return false;
6890
- }
6891
- else if (await condition()) {
6892
- return await callback();
6893
- }
6894
- return await this.recursiveMethod(callback, condition, timeout, startTime);
6895
- };
6896
- this.executeRecursively = async ({ callback, condition, timeout = 5000, }) => {
6897
- const startTime = Date.now();
6898
- await this.recursiveMethod(callback, condition, timeout, startTime);
6899
- };
6900
- this.verifySuccessToast = async ({ message, closeAfterVerification = true, }) => {
6901
- if (message) {
6902
- await test.expect(this.page.getByTestId(COMMON_SELECTORS.toastMessage)).toHaveValue(message);
6903
- }
6904
- else {
6905
- await test.expect(this.page.locator(COMMON_SELECTORS.toastIcon)).toHaveValue("👍");
6906
- closeAfterVerification &&
6907
- (await this.page
6908
- .getByTestId(COMMON_SELECTORS.toastCloseButton)
6909
- .click());
6910
- }
6911
- };
6912
- this.reloadAndWait = async (requestCount) => {
6913
- const reloadRequests = this.interceptMultipleResponses({
6914
- times: requestCount,
6915
- });
6916
- await this.page.reload();
6917
- await reloadRequests;
6918
- };
6919
- this.apiRequest = async ({ url, headers: additionalHeaders, body: data, method = "get", params = {}, ...otherOptions }) => {
6920
- const csrfToken = await this.page
6921
- .locator("[name='csrf-token']")
6922
- .getAttribute("content");
6923
- const requestOptions = {
6924
- headers: {
6925
- ...additionalHeaders,
6926
- "accept-encoding": "gzip",
6927
- "x-csrf-token": csrfToken !== null && csrfToken !== void 0 ? csrfToken : "",
7011
+ const i18nFixture = {
7012
+ i18n: [
7013
+ async ({ page }, use) => {
7014
+ const translation = readTranslations();
7015
+ const taxonomies = await mergeTaxonomies(translation, page);
7016
+ const options = {
7017
+ debug: false,
7018
+ fallbackLng: "en",
7019
+ resources: { en: { translation } },
7020
+ interpolation: {
7021
+ defaultVariables: { taxonomies },
6928
7022
  },
6929
- data,
6930
- params,
6931
- ...otherOptions,
6932
- };
6933
- const httpMethodsHandlers = {
6934
- get: () => this.request.get(url, requestOptions),
6935
- post: () => this.request.post(url, requestOptions),
6936
- put: () => this.request.put(url, requestOptions),
6937
- delete: () => this.request.delete(url, requestOptions),
7023
+ postProcess: "removeTags",
6938
7024
  };
6939
- return await httpMethodsHandlers[method]();
6940
- };
6941
- this.verifyFieldValue = values => {
6942
- const verifyEachFieldValue = ({ field, value, }) => test.expect(this.page.getByTestId(field)).toHaveValue(value);
6943
- return Array.isArray(values)
6944
- ? Promise.all(values.map(value => verifyEachFieldValue(value)))
6945
- : verifyEachFieldValue(values);
6946
- };
6947
- this.page = page;
6948
- this.responses = [];
6949
- this.request = request;
6950
- }
6951
- }
6952
-
6953
- const commands = {
6954
- neetoPlaywrightUtilities: async ({ page, request }, use) => {
6955
- const commands = new CustomCommands(page, request);
6956
- await use(commands);
6957
- },
6958
- page: async ({ page }, use) => {
6959
- await page.goto("/");
6960
- await page.waitForLoadState();
6961
- await use(page);
7025
+ 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
+ ],
7035
+ options,
7036
+ // Fetch translations in every test or fetch once
7037
+ cache: true,
7038
+ });
7039
+ await use(i18nInitialized);
7040
+ },
7041
+ // Run as auto fixture to be available through all tests by getI18nInstance()
7042
+ { auto: true },
7043
+ ],
7044
+ t: async ({ i18n }, use) => {
7045
+ await use(i18n.t);
6962
7046
  },
6963
7047
  };
6964
7048
 
6965
- const generateStagingData = (product = "invoice") => {
6966
- const timestamp = dayjs__default["default"]().format("YYYYMMDDHH");
6967
- const firstName = "André";
6968
- const lastName = "O'Reilly";
6969
- const otpBypassKey = process.env.OTP_BYPASS_KEY;
6970
- const stagingOrganization = `cypresstest-${product}-${timestamp}`;
6971
- return {
6972
- firstName,
6973
- lastName,
6974
- otp: 111111,
6975
- domain: `neeto${product}.net`,
6976
- currentUserName: IS_STAGING_ENV
6977
- ? joinString(firstName, lastName)
6978
- : CREDENTIALS.name,
6979
- businessName: stagingOrganization,
6980
- subdomainName: IS_STAGING_ENV ? stagingOrganization : "spinkart",
6981
- email: IS_STAGING_ENV
6982
- ? `cypresstest${otpBypassKey}+${product}+${timestamp}-playwright@bigbinary.com`
6983
- : "oliver@example.com",
6984
- };
6985
- };
6986
-
6987
- const i18nFixture = playwrightI18nextFixture.createI18nFixture({
6988
- // i18n configuration options
6989
- options: {
6990
- debug: false,
6991
- fallbackLng: "en",
6992
- resources: { en: { translation: readTranslations() } },
6993
- },
6994
- // Fetch translations in every test or fetch once
6995
- // Default: true
6996
- cache: true,
6997
- // Run as auto fixture to be available through all tests by getI18nInstance()
6998
- // Default: true
6999
- auto: true,
7000
- });
7001
-
7002
7049
  const BASE_URL = "/api/v1";
7003
7050
  const ROUTES = {
7004
7051
  neetoAuth: "https://app.neetoauth.net",
@@ -7311,8 +7358,7 @@ const initializeCredentials = (product) => {
7311
7358
  };
7312
7359
 
7313
7360
  const loginWithoutSSO = async ({ page, neetoPlaywrightUtilities, loginPath = "/", }) => {
7314
- var _a;
7315
- await page.goto((_a = `${process.env.BASE_URL}${loginPath}`) !== null && _a !== void 0 ? _a : "");
7361
+ await page.goto(loginPath);
7316
7362
  await page.getByTestId("login-email-text-field").fill(CREDENTIALS.email);
7317
7363
  await page
7318
7364
  .getByTestId("login-password-text-field")
@@ -7324,10 +7370,7 @@ const loginWithoutSSO = async ({ page, neetoPlaywrightUtilities, loginPath = "/"
7324
7370
  await login;
7325
7371
  const userCredentials = readFileSyncIfExists();
7326
7372
  await page.context().storageState({ path: STORAGE_STATE });
7327
- const mergedCredentials = ramda.mergeAll([
7328
- readFileSyncIfExists(),
7329
- userCredentials,
7330
- ]);
7373
+ const mergedCredentials = ramda.mergeAll([readFileSyncIfExists(), userCredentials]);
7331
7374
  writeDataToFile(JSON.stringify(mergedCredentials, null, 2));
7332
7375
  };
7333
7376
  const login = async ({ page, neetoPlaywrightUtilities, loginPath, }) => !IS_STAGING_ENV &&
@@ -7751,7 +7794,6 @@ const definePlaywrightConfig = (overrides) => {
7751
7794
  forbidOnly: isCI,
7752
7795
  retries: isCI ? 1 : 0,
7753
7796
  timeout: 0,
7754
- workers: 1,
7755
7797
  reporter: isCI
7756
7798
  ? [["@currents/playwright", { ...currentsConfig, ...currentsOverrides }]]
7757
7799
  : [["line"]],
@@ -7815,7 +7857,6 @@ exports.joinString = joinString;
7815
7857
  exports.login = login;
7816
7858
  exports.loginWithoutSSO = loginWithoutSSO;
7817
7859
  exports.readFileSyncIfExists = readFileSyncIfExists;
7818
- exports.readTranslations = readTranslations;
7819
7860
  exports.updateCredentials = updateCredentials;
7820
7861
  exports.writeDataToFile = writeDataToFile;
7821
7862
  //# sourceMappingURL=index.cjs.js.map