@bigbinary/neeto-playwright-commons 1.1.0 → 1.1.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.
- package/README.md +16 -0
- package/configs/eslint/common.js +88 -0
- package/configs/eslint/host.js +15 -0
- package/index.cjs.js +823 -233
- package/index.cjs.js.map +1 -1
- package/index.d.ts +134 -30
- package/index.js +806 -225
- package/index.js.map +1 -1
- package/package.json +25 -107
package/index.cjs.js
CHANGED
|
@@ -2,15 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var require$$
|
|
8
|
-
var require$$0
|
|
9
|
-
var require$$0$
|
|
10
|
-
var require$$0$
|
|
5
|
+
var test = require('@playwright/test');
|
|
6
|
+
var fs$9 = require('fs');
|
|
7
|
+
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');
|
|
11
|
+
var require$$0$3 = require('events');
|
|
11
12
|
var ramda = require('ramda');
|
|
12
13
|
var dayjs = require('dayjs');
|
|
13
|
-
var
|
|
14
|
+
var require$$3 = require('crypto');
|
|
14
15
|
|
|
15
16
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
16
17
|
|
|
@@ -32,32 +33,15 @@ function _interopNamespace(e) {
|
|
|
32
33
|
return Object.freeze(n);
|
|
33
34
|
}
|
|
34
35
|
|
|
35
|
-
var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs$
|
|
36
|
-
var fs__namespace = /*#__PURE__*/_interopNamespace(fs$
|
|
36
|
+
var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs$9);
|
|
37
|
+
var fs__namespace = /*#__PURE__*/_interopNamespace(fs$9);
|
|
38
|
+
var require$$2__default = /*#__PURE__*/_interopDefaultLegacy(require$$2);
|
|
37
39
|
var require$$0__default = /*#__PURE__*/_interopDefaultLegacy(require$$0);
|
|
38
40
|
var require$$0__default$1 = /*#__PURE__*/_interopDefaultLegacy(require$$0$1);
|
|
39
41
|
var require$$0__default$2 = /*#__PURE__*/_interopDefaultLegacy(require$$0$2);
|
|
40
42
|
var require$$0__default$3 = /*#__PURE__*/_interopDefaultLegacy(require$$0$3);
|
|
41
|
-
var require$$0__default$4 = /*#__PURE__*/_interopDefaultLegacy(require$$0$4);
|
|
42
43
|
var dayjs__default = /*#__PURE__*/_interopDefaultLegacy(dayjs);
|
|
43
|
-
|
|
44
|
-
const ENVIRONMENT = {
|
|
45
|
-
development: "development",
|
|
46
|
-
staging: "staging",
|
|
47
|
-
review: "review",
|
|
48
|
-
};
|
|
49
|
-
const IS_STAGING_ENV = process.env.TEST_ENV === "staging";
|
|
50
|
-
const STORAGE_STATE$1 = "./e2e/auth/user.json";
|
|
51
|
-
const GLOBAL_TRANSLATIONS_PATTERN = "../node_modules/@bigbinary/**/translations/en.json";
|
|
52
|
-
const PROJECT_TRANSLATIONS_PATH = "../app/javascript/src/translations/en.json";
|
|
53
|
-
|
|
54
|
-
const BASE_URL = "/api/v1";
|
|
55
|
-
const PROFILE_PATH = "/profile";
|
|
56
|
-
const LOGIN_PATH = `${BASE_URL}/login`;
|
|
57
|
-
const SIGNUP_PATH = `${BASE_URL}/signups`;
|
|
58
|
-
const SUBDOMAIN_AVAILABILITY_PATH = `${BASE_URL}/subdomain_availability`;
|
|
59
|
-
const COUNTRIES_PATH = `${BASE_URL}/countries`;
|
|
60
|
-
const NEETO_APPS_PATH = `${BASE_URL}/neeto_apps`;
|
|
44
|
+
var require$$3__default = /*#__PURE__*/_interopDefaultLegacy(require$$3);
|
|
61
45
|
|
|
62
46
|
const COMMON_SELECTORS$1 = {
|
|
63
47
|
toastMessage: "toastr-message-container",
|
|
@@ -72,21 +56,6 @@ const COMMON_SELECTORS$1 = {
|
|
|
72
56
|
subheaderText: "subheader-left",
|
|
73
57
|
};
|
|
74
58
|
|
|
75
|
-
const SIGNUP_SELECTORS = {
|
|
76
|
-
emailField: "signup-email-text-field",
|
|
77
|
-
signupButton: "signup-email-submit-button",
|
|
78
|
-
otpInput: "otpinput-otp-number",
|
|
79
|
-
organizationField: "signup-organization-name-text-field",
|
|
80
|
-
subdomainField: "signup-organization-subdomain-text-field",
|
|
81
|
-
submitButton: "signup-organization-submit-button",
|
|
82
|
-
firstNameField: "signup-profile-first-name-text-field",
|
|
83
|
-
lastNameField: "signup-profile-last-name-text-field",
|
|
84
|
-
profileSubmitButton: "signup-profile-submit-button",
|
|
85
|
-
subdomainInputError: "subdomain-input-error",
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
const COMMON_TEXTS = { edit: "Edit" };
|
|
89
|
-
|
|
90
59
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
91
60
|
|
|
92
61
|
var tasks = {};
|
|
@@ -126,10 +95,10 @@ function isEnoentCodeError(error) {
|
|
|
126
95
|
}
|
|
127
96
|
errno$1.isEnoentCodeError = isEnoentCodeError;
|
|
128
97
|
|
|
129
|
-
var fs$
|
|
98
|
+
var fs$8 = {};
|
|
130
99
|
|
|
131
|
-
Object.defineProperty(fs$
|
|
132
|
-
fs$
|
|
100
|
+
Object.defineProperty(fs$8, "__esModule", { value: true });
|
|
101
|
+
fs$8.createDirentFromStats = void 0;
|
|
133
102
|
class DirentFromStats$1 {
|
|
134
103
|
constructor(name, stats) {
|
|
135
104
|
this.name = name;
|
|
@@ -145,15 +114,15 @@ class DirentFromStats$1 {
|
|
|
145
114
|
function createDirentFromStats$1(name, stats) {
|
|
146
115
|
return new DirentFromStats$1(name, stats);
|
|
147
116
|
}
|
|
148
|
-
fs$
|
|
117
|
+
fs$8.createDirentFromStats = createDirentFromStats$1;
|
|
149
118
|
|
|
150
|
-
var path$
|
|
119
|
+
var path$a = {};
|
|
151
120
|
|
|
152
|
-
Object.defineProperty(path$
|
|
153
|
-
path$
|
|
154
|
-
const os = require$$
|
|
155
|
-
const path$
|
|
156
|
-
const IS_WINDOWS_PLATFORM = os.platform() === 'win32';
|
|
121
|
+
Object.defineProperty(path$a, "__esModule", { value: true });
|
|
122
|
+
path$a.convertPosixPathToPattern = path$a.convertWindowsPathToPattern = path$a.convertPathToPattern = path$a.escapePosixPath = path$a.escapeWindowsPath = path$a.escape = path$a.removeLeadingDotSegment = path$a.makeAbsolute = path$a.unixify = void 0;
|
|
123
|
+
const os$1 = require$$2__default["default"];
|
|
124
|
+
const path$9 = require$$0__default["default"];
|
|
125
|
+
const IS_WINDOWS_PLATFORM = os$1.platform() === 'win32';
|
|
157
126
|
const LEADING_DOT_SEGMENT_CHARACTERS_COUNT = 2; // ./ or .\\
|
|
158
127
|
/**
|
|
159
128
|
* All non-escaped special characters.
|
|
@@ -179,11 +148,11 @@ const WINDOWS_BACKSLASHES_RE = /\\(?![!()+@[\]{}])/g;
|
|
|
179
148
|
function unixify(filepath) {
|
|
180
149
|
return filepath.replace(/\\/g, '/');
|
|
181
150
|
}
|
|
182
|
-
path$
|
|
151
|
+
path$a.unixify = unixify;
|
|
183
152
|
function makeAbsolute(cwd, filepath) {
|
|
184
|
-
return path$
|
|
153
|
+
return path$9.resolve(cwd, filepath);
|
|
185
154
|
}
|
|
186
|
-
path$
|
|
155
|
+
path$a.makeAbsolute = makeAbsolute;
|
|
187
156
|
function removeLeadingDotSegment(entry) {
|
|
188
157
|
// We do not use `startsWith` because this is 10x slower than current implementation for some cases.
|
|
189
158
|
// eslint-disable-next-line @typescript-eslint/prefer-string-starts-ends-with
|
|
@@ -195,27 +164,27 @@ function removeLeadingDotSegment(entry) {
|
|
|
195
164
|
}
|
|
196
165
|
return entry;
|
|
197
166
|
}
|
|
198
|
-
path$
|
|
199
|
-
path$
|
|
167
|
+
path$a.removeLeadingDotSegment = removeLeadingDotSegment;
|
|
168
|
+
path$a.escape = IS_WINDOWS_PLATFORM ? escapeWindowsPath : escapePosixPath;
|
|
200
169
|
function escapeWindowsPath(pattern) {
|
|
201
170
|
return pattern.replace(WINDOWS_UNESCAPED_GLOB_SYMBOLS_RE, '\\$2');
|
|
202
171
|
}
|
|
203
|
-
path$
|
|
172
|
+
path$a.escapeWindowsPath = escapeWindowsPath;
|
|
204
173
|
function escapePosixPath(pattern) {
|
|
205
174
|
return pattern.replace(POSIX_UNESCAPED_GLOB_SYMBOLS_RE, '\\$2');
|
|
206
175
|
}
|
|
207
|
-
path$
|
|
208
|
-
path$
|
|
176
|
+
path$a.escapePosixPath = escapePosixPath;
|
|
177
|
+
path$a.convertPathToPattern = IS_WINDOWS_PLATFORM ? convertWindowsPathToPattern : convertPosixPathToPattern;
|
|
209
178
|
function convertWindowsPathToPattern(filepath) {
|
|
210
179
|
return escapeWindowsPath(filepath)
|
|
211
180
|
.replace(DOS_DEVICE_PATH_RE, '//$1')
|
|
212
181
|
.replace(WINDOWS_BACKSLASHES_RE, '/');
|
|
213
182
|
}
|
|
214
|
-
path$
|
|
183
|
+
path$a.convertWindowsPathToPattern = convertWindowsPathToPattern;
|
|
215
184
|
function convertPosixPathToPattern(filepath) {
|
|
216
185
|
return escapePosixPath(filepath);
|
|
217
186
|
}
|
|
218
|
-
path$
|
|
187
|
+
path$a.convertPosixPathToPattern = convertPosixPathToPattern;
|
|
219
188
|
|
|
220
189
|
var pattern$1 = {};
|
|
221
190
|
|
|
@@ -392,8 +361,8 @@ var isGlob$1 = function isGlob(str, options) {
|
|
|
392
361
|
};
|
|
393
362
|
|
|
394
363
|
var isGlob = isGlob$1;
|
|
395
|
-
var pathPosixDirname = require$$0__default
|
|
396
|
-
var isWin32 = require$$
|
|
364
|
+
var pathPosixDirname = require$$0__default["default"].posix.dirname;
|
|
365
|
+
var isWin32 = require$$2__default["default"].platform() === 'win32';
|
|
397
366
|
|
|
398
367
|
var slash = '/';
|
|
399
368
|
var backslash = /\\/g;
|
|
@@ -889,7 +858,7 @@ var toRegexRange_1 = toRegexRange$1;
|
|
|
889
858
|
* Licensed under the MIT License.
|
|
890
859
|
*/
|
|
891
860
|
|
|
892
|
-
const util$1 = require$$0__default$
|
|
861
|
+
const util$1 = require$$0__default$1["default"];
|
|
893
862
|
const toRegexRange = toRegexRange_1;
|
|
894
863
|
|
|
895
864
|
const isObject$1 = val => val !== null && typeof val === 'object' && !Array.isArray(val);
|
|
@@ -1382,7 +1351,7 @@ const {
|
|
|
1382
1351
|
* parse
|
|
1383
1352
|
*/
|
|
1384
1353
|
|
|
1385
|
-
const parse$
|
|
1354
|
+
const parse$4 = (input, options = {}) => {
|
|
1386
1355
|
if (typeof input !== 'string') {
|
|
1387
1356
|
throw new TypeError('Expected a string');
|
|
1388
1357
|
}
|
|
@@ -1681,12 +1650,12 @@ const parse$3 = (input, options = {}) => {
|
|
|
1681
1650
|
return ast;
|
|
1682
1651
|
};
|
|
1683
1652
|
|
|
1684
|
-
var parse_1$1 = parse$
|
|
1653
|
+
var parse_1$1 = parse$4;
|
|
1685
1654
|
|
|
1686
1655
|
const stringify = stringify$4;
|
|
1687
1656
|
const compile = compile_1;
|
|
1688
1657
|
const expand = expand_1;
|
|
1689
|
-
const parse$
|
|
1658
|
+
const parse$3 = parse_1$1;
|
|
1690
1659
|
|
|
1691
1660
|
/**
|
|
1692
1661
|
* Expand the given pattern or create a regex-compatible string.
|
|
@@ -1738,7 +1707,7 @@ const braces$1 = (input, options = {}) => {
|
|
|
1738
1707
|
* @api public
|
|
1739
1708
|
*/
|
|
1740
1709
|
|
|
1741
|
-
braces$1.parse = (input, options = {}) => parse$
|
|
1710
|
+
braces$1.parse = (input, options = {}) => parse$3(input, options);
|
|
1742
1711
|
|
|
1743
1712
|
/**
|
|
1744
1713
|
* Creates a braces string from an AST, or an AST node.
|
|
@@ -1856,7 +1825,7 @@ var picomatch$2 = {exports: {}};
|
|
|
1856
1825
|
|
|
1857
1826
|
var utils$f = {};
|
|
1858
1827
|
|
|
1859
|
-
const path$
|
|
1828
|
+
const path$8 = require$$0__default["default"];
|
|
1860
1829
|
const WIN_SLASH = '\\\\/';
|
|
1861
1830
|
const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
|
|
1862
1831
|
|
|
@@ -2009,7 +1978,7 @@ var constants$3 = {
|
|
|
2009
1978
|
CHAR_VERTICAL_LINE: 124, /* | */
|
|
2010
1979
|
CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279, /* \uFEFF */
|
|
2011
1980
|
|
|
2012
|
-
SEP: path$
|
|
1981
|
+
SEP: path$8.sep,
|
|
2013
1982
|
|
|
2014
1983
|
/**
|
|
2015
1984
|
* Create EXTGLOB_CHARS
|
|
@@ -2036,7 +2005,7 @@ var constants$3 = {
|
|
|
2036
2005
|
|
|
2037
2006
|
(function (exports) {
|
|
2038
2007
|
|
|
2039
|
-
const path = require$$0__default
|
|
2008
|
+
const path = require$$0__default["default"];
|
|
2040
2009
|
const win32 = process.platform === 'win32';
|
|
2041
2010
|
const {
|
|
2042
2011
|
REGEX_BACKSLASH,
|
|
@@ -2542,7 +2511,7 @@ const syntaxError = (type, char) => {
|
|
|
2542
2511
|
* @return {Object}
|
|
2543
2512
|
*/
|
|
2544
2513
|
|
|
2545
|
-
const parse$
|
|
2514
|
+
const parse$2 = (input, options) => {
|
|
2546
2515
|
if (typeof input !== 'string') {
|
|
2547
2516
|
throw new TypeError('Expected a string');
|
|
2548
2517
|
}
|
|
@@ -2745,7 +2714,7 @@ const parse$1 = (input, options) => {
|
|
|
2745
2714
|
// Suitable patterns: `/!(*.d).ts`, `/!(*.d).{ts,tsx}`, `**/!(*-dbg).@(js)`.
|
|
2746
2715
|
//
|
|
2747
2716
|
// Disabling the `fastpaths` option due to a problem with parsing strings as `.ts` in the pattern like `**/!(*.d).ts`.
|
|
2748
|
-
const expression = parse$
|
|
2717
|
+
const expression = parse$2(rest, { ...options, fastpaths: false }).output;
|
|
2749
2718
|
|
|
2750
2719
|
output = token.close = `)${expression})${extglobStar})`;
|
|
2751
2720
|
}
|
|
@@ -3491,7 +3460,7 @@ const parse$1 = (input, options) => {
|
|
|
3491
3460
|
* impact when none of the fast paths match.
|
|
3492
3461
|
*/
|
|
3493
3462
|
|
|
3494
|
-
parse$
|
|
3463
|
+
parse$2.fastpaths = (input, options) => {
|
|
3495
3464
|
const opts = { ...options };
|
|
3496
3465
|
const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
|
|
3497
3466
|
const len = input.length;
|
|
@@ -3578,11 +3547,11 @@ parse$1.fastpaths = (input, options) => {
|
|
|
3578
3547
|
return source;
|
|
3579
3548
|
};
|
|
3580
3549
|
|
|
3581
|
-
var parse_1 = parse$
|
|
3550
|
+
var parse_1 = parse$2;
|
|
3582
3551
|
|
|
3583
|
-
const path$
|
|
3552
|
+
const path$7 = require$$0__default["default"];
|
|
3584
3553
|
const scan = scan_1;
|
|
3585
|
-
const parse = parse_1;
|
|
3554
|
+
const parse$1 = parse_1;
|
|
3586
3555
|
const utils$c = utils$f;
|
|
3587
3556
|
const constants$1 = constants$3;
|
|
3588
3557
|
const isObject = val => val && typeof val === 'object' && !Array.isArray(val);
|
|
@@ -3740,7 +3709,7 @@ picomatch$1.test = (input, regex, options, { glob, posix } = {}) => {
|
|
|
3740
3709
|
|
|
3741
3710
|
picomatch$1.matchBase = (input, glob, options, posix = utils$c.isWindows(options)) => {
|
|
3742
3711
|
const regex = glob instanceof RegExp ? glob : picomatch$1.makeRe(glob, options);
|
|
3743
|
-
return regex.test(path$
|
|
3712
|
+
return regex.test(path$7.basename(input));
|
|
3744
3713
|
};
|
|
3745
3714
|
|
|
3746
3715
|
/**
|
|
@@ -3778,7 +3747,7 @@ picomatch$1.isMatch = (str, patterns, options) => picomatch$1(patterns, options)
|
|
|
3778
3747
|
|
|
3779
3748
|
picomatch$1.parse = (pattern, options) => {
|
|
3780
3749
|
if (Array.isArray(pattern)) return pattern.map(p => picomatch$1.parse(p, options));
|
|
3781
|
-
return parse(pattern, { ...options, fastpaths: false });
|
|
3750
|
+
return parse$1(pattern, { ...options, fastpaths: false });
|
|
3782
3751
|
};
|
|
3783
3752
|
|
|
3784
3753
|
/**
|
|
@@ -3871,11 +3840,11 @@ picomatch$1.makeRe = (input, options = {}, returnOutput = false, returnState = f
|
|
|
3871
3840
|
let parsed = { negated: false, fastpaths: true };
|
|
3872
3841
|
|
|
3873
3842
|
if (options.fastpaths !== false && (input[0] === '.' || input[0] === '*')) {
|
|
3874
|
-
parsed.output = parse.fastpaths(input, options);
|
|
3843
|
+
parsed.output = parse$1.fastpaths(input, options);
|
|
3875
3844
|
}
|
|
3876
3845
|
|
|
3877
3846
|
if (!parsed.output) {
|
|
3878
|
-
parsed = parse(input, options);
|
|
3847
|
+
parsed = parse$1(input, options);
|
|
3879
3848
|
}
|
|
3880
3849
|
|
|
3881
3850
|
return picomatch$1.compileRe(parsed, options, returnOutput, returnState);
|
|
@@ -3926,7 +3895,7 @@ var picomatch_1 = picomatch$1;
|
|
|
3926
3895
|
module.exports = picomatch_1;
|
|
3927
3896
|
} (picomatch$2));
|
|
3928
3897
|
|
|
3929
|
-
const util = require$$0__default$
|
|
3898
|
+
const util = require$$0__default$1["default"];
|
|
3930
3899
|
const braces = braces_1;
|
|
3931
3900
|
const picomatch = picomatch$2.exports;
|
|
3932
3901
|
const utils$b = utils$f;
|
|
@@ -4394,7 +4363,7 @@ var micromatch_1 = micromatch$1;
|
|
|
4394
4363
|
|
|
4395
4364
|
Object.defineProperty(pattern$1, "__esModule", { value: true });
|
|
4396
4365
|
pattern$1.removeDuplicateSlashes = pattern$1.matchAny = pattern$1.convertPatternsToRe = pattern$1.makeRe = pattern$1.getPatternParts = pattern$1.expandBraceExpansion = pattern$1.expandPatternsWithBraceExpansion = pattern$1.isAffectDepthOfReadingPattern = pattern$1.endsWithSlashGlobStar = pattern$1.hasGlobStar = pattern$1.getBaseDirectory = pattern$1.isPatternRelatedToParentDirectory = pattern$1.getPatternsOutsideCurrentDirectory = pattern$1.getPatternsInsideCurrentDirectory = pattern$1.getPositivePatterns = pattern$1.getNegativePatterns = pattern$1.isPositivePattern = pattern$1.isNegativePattern = pattern$1.convertToNegativePattern = pattern$1.convertToPositivePattern = pattern$1.isDynamicPattern = pattern$1.isStaticPattern = void 0;
|
|
4397
|
-
const path$
|
|
4366
|
+
const path$6 = require$$0__default["default"];
|
|
4398
4367
|
const globParent = globParent$1;
|
|
4399
4368
|
const micromatch = micromatch_1;
|
|
4400
4369
|
const GLOBSTAR = '**';
|
|
@@ -4516,7 +4485,7 @@ function endsWithSlashGlobStar(pattern) {
|
|
|
4516
4485
|
}
|
|
4517
4486
|
pattern$1.endsWithSlashGlobStar = endsWithSlashGlobStar;
|
|
4518
4487
|
function isAffectDepthOfReadingPattern(pattern) {
|
|
4519
|
-
const basename = path$
|
|
4488
|
+
const basename = path$6.basename(pattern);
|
|
4520
4489
|
return endsWithSlashGlobStar(pattern) || isStaticPattern(basename);
|
|
4521
4490
|
}
|
|
4522
4491
|
pattern$1.isAffectDepthOfReadingPattern = isAffectDepthOfReadingPattern;
|
|
@@ -4589,7 +4558,7 @@ var stream$4 = {};
|
|
|
4589
4558
|
* Copyright (c) 2014-2020 Teambition
|
|
4590
4559
|
* Licensed under the MIT license.
|
|
4591
4560
|
*/
|
|
4592
|
-
const Stream = require$$0__default$
|
|
4561
|
+
const Stream = require$$0__default$2["default"];
|
|
4593
4562
|
const PassThrough = Stream.PassThrough;
|
|
4594
4563
|
const slice = Array.prototype.slice;
|
|
4595
4564
|
|
|
@@ -4762,10 +4731,10 @@ const array = array$1;
|
|
|
4762
4731
|
utils$k.array = array;
|
|
4763
4732
|
const errno = errno$1;
|
|
4764
4733
|
utils$k.errno = errno;
|
|
4765
|
-
const fs$
|
|
4766
|
-
utils$k.fs = fs$
|
|
4767
|
-
const path$
|
|
4768
|
-
utils$k.path = path$
|
|
4734
|
+
const fs$7 = fs$8;
|
|
4735
|
+
utils$k.fs = fs$7;
|
|
4736
|
+
const path$5 = path$a;
|
|
4737
|
+
utils$k.path = path$5;
|
|
4769
4738
|
const pattern = pattern$1;
|
|
4770
4739
|
utils$k.pattern = pattern;
|
|
4771
4740
|
const stream$3 = stream$4;
|
|
@@ -4964,7 +4933,7 @@ sync$7.read = read$2;
|
|
|
4964
4933
|
|
|
4965
4934
|
var settings$3 = {};
|
|
4966
4935
|
|
|
4967
|
-
var fs$
|
|
4936
|
+
var fs$6 = {};
|
|
4968
4937
|
|
|
4969
4938
|
(function (exports) {
|
|
4970
4939
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -4983,15 +4952,15 @@ var fs$5 = {};
|
|
|
4983
4952
|
return Object.assign(Object.assign({}, exports.FILE_SYSTEM_ADAPTER), fsMethods);
|
|
4984
4953
|
}
|
|
4985
4954
|
exports.createFileSystemAdapter = createFileSystemAdapter;
|
|
4986
|
-
} (fs$
|
|
4955
|
+
} (fs$6));
|
|
4987
4956
|
|
|
4988
4957
|
Object.defineProperty(settings$3, "__esModule", { value: true });
|
|
4989
|
-
const fs$
|
|
4958
|
+
const fs$5 = fs$6;
|
|
4990
4959
|
class Settings$2 {
|
|
4991
4960
|
constructor(_options = {}) {
|
|
4992
4961
|
this._options = _options;
|
|
4993
4962
|
this.followSymbolicLink = this._getValue(this._options.followSymbolicLink, true);
|
|
4994
|
-
this.fs = fs$
|
|
4963
|
+
this.fs = fs$5.createFileSystemAdapter(this._options.fs);
|
|
4995
4964
|
this.markSymbolicLink = this._getValue(this._options.markSymbolicLink, false);
|
|
4996
4965
|
this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
|
|
4997
4966
|
}
|
|
@@ -5112,10 +5081,10 @@ constants.IS_SUPPORT_READDIR_WITH_FILE_TYPES = IS_MATCHED_BY_MAJOR || IS_MATCHED
|
|
|
5112
5081
|
|
|
5113
5082
|
var utils$9 = {};
|
|
5114
5083
|
|
|
5115
|
-
var fs$
|
|
5084
|
+
var fs$4 = {};
|
|
5116
5085
|
|
|
5117
|
-
Object.defineProperty(fs$
|
|
5118
|
-
fs$
|
|
5086
|
+
Object.defineProperty(fs$4, "__esModule", { value: true });
|
|
5087
|
+
fs$4.createDirentFromStats = void 0;
|
|
5119
5088
|
class DirentFromStats {
|
|
5120
5089
|
constructor(name, stats) {
|
|
5121
5090
|
this.name = name;
|
|
@@ -5131,12 +5100,12 @@ class DirentFromStats {
|
|
|
5131
5100
|
function createDirentFromStats(name, stats) {
|
|
5132
5101
|
return new DirentFromStats(name, stats);
|
|
5133
5102
|
}
|
|
5134
|
-
fs$
|
|
5103
|
+
fs$4.createDirentFromStats = createDirentFromStats;
|
|
5135
5104
|
|
|
5136
5105
|
Object.defineProperty(utils$9, "__esModule", { value: true });
|
|
5137
5106
|
utils$9.fs = void 0;
|
|
5138
|
-
const fs$
|
|
5139
|
-
utils$9.fs = fs$
|
|
5107
|
+
const fs$3 = fs$4;
|
|
5108
|
+
utils$9.fs = fs$3;
|
|
5140
5109
|
|
|
5141
5110
|
var common$6 = {};
|
|
5142
5111
|
|
|
@@ -5315,7 +5284,7 @@ sync$5.readdir = readdir;
|
|
|
5315
5284
|
|
|
5316
5285
|
var settings$2 = {};
|
|
5317
5286
|
|
|
5318
|
-
var fs$
|
|
5287
|
+
var fs$2 = {};
|
|
5319
5288
|
|
|
5320
5289
|
(function (exports) {
|
|
5321
5290
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -5336,18 +5305,18 @@ var fs$1 = {};
|
|
|
5336
5305
|
return Object.assign(Object.assign({}, exports.FILE_SYSTEM_ADAPTER), fsMethods);
|
|
5337
5306
|
}
|
|
5338
5307
|
exports.createFileSystemAdapter = createFileSystemAdapter;
|
|
5339
|
-
} (fs$
|
|
5308
|
+
} (fs$2));
|
|
5340
5309
|
|
|
5341
5310
|
Object.defineProperty(settings$2, "__esModule", { value: true });
|
|
5342
|
-
const path$
|
|
5311
|
+
const path$4 = require$$0__default["default"];
|
|
5343
5312
|
const fsStat$3 = out$1;
|
|
5344
|
-
const fs = fs$
|
|
5313
|
+
const fs$1 = fs$2;
|
|
5345
5314
|
class Settings$1 {
|
|
5346
5315
|
constructor(_options = {}) {
|
|
5347
5316
|
this._options = _options;
|
|
5348
5317
|
this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, false);
|
|
5349
|
-
this.fs = fs.createFileSystemAdapter(this._options.fs);
|
|
5350
|
-
this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path$
|
|
5318
|
+
this.fs = fs$1.createFileSystemAdapter(this._options.fs);
|
|
5319
|
+
this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path$4.sep);
|
|
5351
5320
|
this.stats = this._getValue(this._options.stats, false);
|
|
5352
5321
|
this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
|
|
5353
5322
|
this.fsStatSettings = new fsStat$3.Settings({
|
|
@@ -5757,7 +5726,7 @@ class Reader$1 {
|
|
|
5757
5726
|
reader$1.default = Reader$1;
|
|
5758
5727
|
|
|
5759
5728
|
Object.defineProperty(async$4, "__esModule", { value: true });
|
|
5760
|
-
const events_1 = require$$0__default$
|
|
5729
|
+
const events_1 = require$$0__default$3["default"];
|
|
5761
5730
|
const fsScandir$2 = out$2;
|
|
5762
5731
|
const fastq = queue.exports;
|
|
5763
5732
|
const common$1 = common$3;
|
|
@@ -5886,7 +5855,7 @@ function callSuccessCallback(callback, entries) {
|
|
|
5886
5855
|
var stream$2 = {};
|
|
5887
5856
|
|
|
5888
5857
|
Object.defineProperty(stream$2, "__esModule", { value: true });
|
|
5889
|
-
const stream_1$5 = require$$0__default$
|
|
5858
|
+
const stream_1$5 = require$$0__default$2["default"];
|
|
5890
5859
|
const async_1$3 = async$4;
|
|
5891
5860
|
class StreamProvider {
|
|
5892
5861
|
constructor(_root, _settings) {
|
|
@@ -5999,7 +5968,7 @@ sync$3.default = SyncProvider;
|
|
|
5999
5968
|
var settings$1 = {};
|
|
6000
5969
|
|
|
6001
5970
|
Object.defineProperty(settings$1, "__esModule", { value: true });
|
|
6002
|
-
const path$
|
|
5971
|
+
const path$3 = require$$0__default["default"];
|
|
6003
5972
|
const fsScandir = out$2;
|
|
6004
5973
|
class Settings {
|
|
6005
5974
|
constructor(_options = {}) {
|
|
@@ -6009,7 +5978,7 @@ class Settings {
|
|
|
6009
5978
|
this.deepFilter = this._getValue(this._options.deepFilter, null);
|
|
6010
5979
|
this.entryFilter = this._getValue(this._options.entryFilter, null);
|
|
6011
5980
|
this.errorFilter = this._getValue(this._options.errorFilter, null);
|
|
6012
|
-
this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path$
|
|
5981
|
+
this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path$3.sep);
|
|
6013
5982
|
this.fsScandirSettings = new fsScandir.Settings({
|
|
6014
5983
|
followSymbolicLinks: this._options.followSymbolicLinks,
|
|
6015
5984
|
fs: this._options.fs,
|
|
@@ -6061,7 +6030,7 @@ function getSettings(settingsOrOptions = {}) {
|
|
|
6061
6030
|
var reader = {};
|
|
6062
6031
|
|
|
6063
6032
|
Object.defineProperty(reader, "__esModule", { value: true });
|
|
6064
|
-
const path$
|
|
6033
|
+
const path$2 = require$$0__default["default"];
|
|
6065
6034
|
const fsStat$2 = out$1;
|
|
6066
6035
|
const utils$6 = utils$k;
|
|
6067
6036
|
class Reader {
|
|
@@ -6074,7 +6043,7 @@ class Reader {
|
|
|
6074
6043
|
});
|
|
6075
6044
|
}
|
|
6076
6045
|
_getFullEntryPath(filepath) {
|
|
6077
|
-
return path$
|
|
6046
|
+
return path$2.resolve(this._settings.cwd, filepath);
|
|
6078
6047
|
}
|
|
6079
6048
|
_makeEntry(stats, pattern) {
|
|
6080
6049
|
const entry = {
|
|
@@ -6096,7 +6065,7 @@ reader.default = Reader;
|
|
|
6096
6065
|
var stream$1 = {};
|
|
6097
6066
|
|
|
6098
6067
|
Object.defineProperty(stream$1, "__esModule", { value: true });
|
|
6099
|
-
const stream_1$3 = require$$0__default$
|
|
6068
|
+
const stream_1$3 = require$$0__default$2["default"];
|
|
6100
6069
|
const fsStat$1 = out$1;
|
|
6101
6070
|
const fsWalk$2 = out$3;
|
|
6102
6071
|
const reader_1$2 = reader;
|
|
@@ -6449,7 +6418,7 @@ class EntryTransformer {
|
|
|
6449
6418
|
entry.default = EntryTransformer;
|
|
6450
6419
|
|
|
6451
6420
|
Object.defineProperty(provider, "__esModule", { value: true });
|
|
6452
|
-
const path = require$$0__default
|
|
6421
|
+
const path$1 = require$$0__default["default"];
|
|
6453
6422
|
const deep_1 = deep;
|
|
6454
6423
|
const entry_1 = entry$1;
|
|
6455
6424
|
const error_1 = error;
|
|
@@ -6463,7 +6432,7 @@ class Provider {
|
|
|
6463
6432
|
this.entryTransformer = new entry_2.default(this._settings);
|
|
6464
6433
|
}
|
|
6465
6434
|
_getRootDirectory(task) {
|
|
6466
|
-
return path.resolve(this._settings.cwd, task.base);
|
|
6435
|
+
return path$1.resolve(this._settings.cwd, task.base);
|
|
6467
6436
|
}
|
|
6468
6437
|
_getReaderOptions(task) {
|
|
6469
6438
|
const basePath = task.base === '.' ? '' : task.base;
|
|
@@ -6522,7 +6491,7 @@ async$7.default = ProviderAsync;
|
|
|
6522
6491
|
var stream = {};
|
|
6523
6492
|
|
|
6524
6493
|
Object.defineProperty(stream, "__esModule", { value: true });
|
|
6525
|
-
const stream_1$1 = require$$0__default$
|
|
6494
|
+
const stream_1$1 = require$$0__default$2["default"];
|
|
6526
6495
|
const stream_2 = stream$1;
|
|
6527
6496
|
const provider_1$1 = provider;
|
|
6528
6497
|
class ProviderStream extends provider_1$1.default {
|
|
@@ -6628,7 +6597,7 @@ var settings = {};
|
|
|
6628
6597
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6629
6598
|
exports.DEFAULT_FILE_SYSTEM_ADAPTER = void 0;
|
|
6630
6599
|
const fs = fs__default["default"];
|
|
6631
|
-
const os = require$$
|
|
6600
|
+
const os = require$$2__default["default"];
|
|
6632
6601
|
/**
|
|
6633
6602
|
* The `os.cpus` method can return zero. We expect the number of cores to be greater than zero.
|
|
6634
6603
|
* https://github.com/nodejs/node/blob/7faeddf23a98c53896f8b574a6e66589e8fb1eb8/lib/os.js#L106-L107
|
|
@@ -6785,107 +6754,10 @@ function assertPatternsInput(input) {
|
|
|
6785
6754
|
}
|
|
6786
6755
|
var out = FastGlob;
|
|
6787
6756
|
|
|
6788
|
-
const joinString = (string1, string2, string3 = "", separator = " ") => {
|
|
6789
|
-
if (string3 === "") {
|
|
6790
|
-
return string1 + separator + string2;
|
|
6791
|
-
}
|
|
6792
|
-
return string1 + separator + string2 + separator + string3;
|
|
6793
|
-
};
|
|
6794
|
-
const readFileSyncIfExists$1 = (path = STORAGE_STATE$1) => {
|
|
6795
|
-
try {
|
|
6796
|
-
return JSON.parse(fs__namespace.readFileSync(path, "utf8"));
|
|
6797
|
-
}
|
|
6798
|
-
catch (error) {
|
|
6799
|
-
return {};
|
|
6800
|
-
}
|
|
6801
|
-
};
|
|
6802
|
-
const writeDataToFile = data => {
|
|
6803
|
-
try {
|
|
6804
|
-
fs__namespace.writeFileSync(STORAGE_STATE$1, data, "utf8");
|
|
6805
|
-
}
|
|
6806
|
-
catch (error) {
|
|
6807
|
-
console.log(error); // eslint-disable-line
|
|
6808
|
-
}
|
|
6809
|
-
return true;
|
|
6810
|
-
};
|
|
6811
|
-
const updateCredentials = ({ key, value }) => {
|
|
6812
|
-
const data = readFileSyncIfExists$1();
|
|
6813
|
-
data["user"][key] = value;
|
|
6814
|
-
return writeDataToFile(JSON.stringify(data));
|
|
6815
|
-
};
|
|
6816
|
-
const clearCredentials = () => {
|
|
6817
|
-
fs__namespace.unlink(STORAGE_STATE$1, error => {
|
|
6818
|
-
if (!error)
|
|
6819
|
-
return;
|
|
6820
|
-
console.log(error); // eslint-disable-line
|
|
6821
|
-
});
|
|
6822
|
-
};
|
|
6823
|
-
const readTranslations = () => {
|
|
6824
|
-
let translations = readFileSyncIfExists$1(PROJECT_TRANSLATIONS_PATH);
|
|
6825
|
-
const paths = out.sync(GLOBAL_TRANSLATIONS_PATTERN);
|
|
6826
|
-
paths.forEach(path => {
|
|
6827
|
-
const packageTranslation = readFileSyncIfExists$1(path);
|
|
6828
|
-
translations = ramda.mergeDeepLeft(translations, packageTranslation);
|
|
6829
|
-
});
|
|
6830
|
-
return translations;
|
|
6831
|
-
};
|
|
6832
|
-
|
|
6833
|
-
const timestamp = dayjs__default["default"]().format("YYYYMMDDHH");
|
|
6834
|
-
const firstName = "André";
|
|
6835
|
-
const lastName = "O'Reilly";
|
|
6836
|
-
const stagingOrganization = `cypresstest-invoice-${timestamp}`;
|
|
6837
|
-
const otpBypassKey = process.env.OTP_BYPASS_KEY;
|
|
6838
|
-
const stagingData = {
|
|
6839
|
-
firstName,
|
|
6840
|
-
lastName,
|
|
6841
|
-
otp: 111111,
|
|
6842
|
-
domain: "neetoinvoice.net",
|
|
6843
|
-
currentUserName: IS_STAGING_ENV
|
|
6844
|
-
? joinString(firstName, lastName)
|
|
6845
|
-
: "Oliver Smith",
|
|
6846
|
-
businessName: stagingOrganization,
|
|
6847
|
-
subdomainName: IS_STAGING_ENV ? stagingOrganization : "spinkart",
|
|
6848
|
-
email: IS_STAGING_ENV
|
|
6849
|
-
? `cypresstest${otpBypassKey}+invoice+${timestamp}@bigbinary.com`
|
|
6850
|
-
: "oliver@example.com",
|
|
6851
|
-
};
|
|
6852
|
-
|
|
6853
|
-
const initializeCredentials = () => {
|
|
6854
|
-
const { user } = readFileSyncIfExists$1();
|
|
6855
|
-
const newState = {
|
|
6856
|
-
...user,
|
|
6857
|
-
businessName: (user === null || user === void 0 ? void 0 : user.businessName) || stagingData.businessName,
|
|
6858
|
-
currentUserName: (user === null || user === void 0 ? void 0 : user.currentUserName) || stagingData.currentUserName,
|
|
6859
|
-
email: (user === null || user === void 0 ? void 0 : user.email) || stagingData.email,
|
|
6860
|
-
firstName: (user === null || user === void 0 ? void 0 : user.firstName) || stagingData.firstName,
|
|
6861
|
-
lastName: (user === null || user === void 0 ? void 0 : user.lastName) || stagingData.lastName,
|
|
6862
|
-
subdomainName: (user === null || user === void 0 ? void 0 : user.subdomainName) || stagingData.subdomainName,
|
|
6863
|
-
skipSetup: user === null || user === void 0 ? void 0 : user.skipSetup,
|
|
6864
|
-
};
|
|
6865
|
-
writeDataToFile(JSON.stringify({ user: newState }, null, 2));
|
|
6866
|
-
if (IS_STAGING_ENV) {
|
|
6867
|
-
const baseUrl = `https://${newState.subdomainName}.${stagingData.domain}`;
|
|
6868
|
-
process.env.BASE_URL = baseUrl;
|
|
6869
|
-
}
|
|
6870
|
-
};
|
|
6871
|
-
|
|
6872
|
-
const COMMON_SELECTORS = {
|
|
6873
|
-
toastMessage: "toastr-message-container",
|
|
6874
|
-
toastIcon: ".Toastify__toast-icon",
|
|
6875
|
-
toastCloseButton: "toastr-close-button",
|
|
6876
|
-
dropdownIcon: "nui-dropdown-icon",
|
|
6877
|
-
checkbox: "nui-checkbox-input",
|
|
6878
|
-
spinner: ".neeto-ui-spinner",
|
|
6879
|
-
input: "nui-input-field",
|
|
6880
|
-
alertModalSubmitButton: "alert-submit-button",
|
|
6881
|
-
selectContainer: "nui-select-container",
|
|
6882
|
-
subheaderText: "subheader-left",
|
|
6883
|
-
};
|
|
6884
|
-
|
|
6885
6757
|
process.env.TEST_ENV === "staging";
|
|
6886
|
-
const STORAGE_STATE = "./e2e/auth/user.json";
|
|
6758
|
+
const STORAGE_STATE$1 = "./e2e/auth/user.json";
|
|
6887
6759
|
|
|
6888
|
-
const readFileSyncIfExists = (path = STORAGE_STATE) => {
|
|
6760
|
+
const readFileSyncIfExists$1 = (path = STORAGE_STATE$1) => {
|
|
6889
6761
|
try {
|
|
6890
6762
|
return JSON.parse(fs__namespace.readFileSync(path, "utf8"));
|
|
6891
6763
|
}
|
|
@@ -6925,13 +6797,13 @@ class CustomCommands {
|
|
|
6925
6797
|
};
|
|
6926
6798
|
this.verifySuccessToast = async ({ message, closeAfterVerification = true, }) => {
|
|
6927
6799
|
if (message) {
|
|
6928
|
-
await test
|
|
6800
|
+
await test.expect(this.page.getByTestId(COMMON_SELECTORS$1.toastMessage)).toHaveValue(message);
|
|
6929
6801
|
}
|
|
6930
6802
|
else {
|
|
6931
|
-
await test
|
|
6803
|
+
await test.expect(this.page.locator(COMMON_SELECTORS$1.toastIcon)).toHaveValue("👍");
|
|
6932
6804
|
closeAfterVerification &&
|
|
6933
6805
|
(await this.page
|
|
6934
|
-
.getByTestId(COMMON_SELECTORS.toastCloseButton)
|
|
6806
|
+
.getByTestId(COMMON_SELECTORS$1.toastCloseButton)
|
|
6935
6807
|
.click());
|
|
6936
6808
|
}
|
|
6937
6809
|
};
|
|
@@ -6943,7 +6815,7 @@ class CustomCommands {
|
|
|
6943
6815
|
await reloadRequests;
|
|
6944
6816
|
};
|
|
6945
6817
|
this.apiRequest = async ({ url, headers: additionalHeaders, body: data, method = "get", params = {}, ...otherOptions }) => {
|
|
6946
|
-
const { headers } = readFileSyncIfExists();
|
|
6818
|
+
const { headers } = readFileSyncIfExists$1();
|
|
6947
6819
|
const requestOptions = {
|
|
6948
6820
|
headers: { ...headers, ...additionalHeaders, "accept-encoding": "gzip" },
|
|
6949
6821
|
data,
|
|
@@ -6958,7 +6830,7 @@ class CustomCommands {
|
|
|
6958
6830
|
}[method.toLowerCase()];
|
|
6959
6831
|
};
|
|
6960
6832
|
this.verifyFieldValue = values => {
|
|
6961
|
-
const verifyEachFieldValue = ({ field, value, }) => test
|
|
6833
|
+
const verifyEachFieldValue = ({ field, value, }) => test.expect(this.page.getByTestId(field)).toHaveValue(value);
|
|
6962
6834
|
return Array.isArray(values)
|
|
6963
6835
|
? Promise.all(values.map(value => verifyEachFieldValue(value)))
|
|
6964
6836
|
: verifyEachFieldValue(values);
|
|
@@ -6969,7 +6841,7 @@ class CustomCommands {
|
|
|
6969
6841
|
}
|
|
6970
6842
|
}
|
|
6971
6843
|
|
|
6972
|
-
const
|
|
6844
|
+
const commands = {
|
|
6973
6845
|
neetoPlaywrightUtilities: async ({ page, request }, use) => {
|
|
6974
6846
|
const commands = new CustomCommands(page, request);
|
|
6975
6847
|
await use(commands);
|
|
@@ -6979,13 +6851,723 @@ const test = test$1.test.extend({
|
|
|
6979
6851
|
await page.waitForLoadState("load");
|
|
6980
6852
|
await use(page);
|
|
6981
6853
|
},
|
|
6982
|
-
}
|
|
6854
|
+
};
|
|
6855
|
+
|
|
6856
|
+
const ENVIRONMENT = {
|
|
6857
|
+
development: "development",
|
|
6858
|
+
staging: "staging",
|
|
6859
|
+
review: "review",
|
|
6860
|
+
};
|
|
6861
|
+
const IS_STAGING_ENV = process.env.TEST_ENV === "staging";
|
|
6862
|
+
const STORAGE_STATE = "./e2e/auth/user.json";
|
|
6863
|
+
const GLOBAL_TRANSLATIONS_PATTERN = "../node_modules/@bigbinary/**/translations/en.json";
|
|
6864
|
+
const PROJECT_TRANSLATIONS_PATH = "../app/javascript/src/translations/en.json";
|
|
6865
|
+
const CREDENTIALS = { email: "oliver@example.com", password: "welcome" };
|
|
6866
|
+
|
|
6867
|
+
const joinString = (string1, string2, string3 = "", separator = " ") => {
|
|
6868
|
+
if (string3 === "") {
|
|
6869
|
+
return string1 + separator + string2;
|
|
6870
|
+
}
|
|
6871
|
+
return string1 + separator + string2 + separator + string3;
|
|
6872
|
+
};
|
|
6873
|
+
const readFileSyncIfExists = (path = STORAGE_STATE) => {
|
|
6874
|
+
try {
|
|
6875
|
+
return JSON.parse(fs__namespace.readFileSync(path, "utf8"));
|
|
6876
|
+
}
|
|
6877
|
+
catch (error) {
|
|
6878
|
+
return {};
|
|
6879
|
+
}
|
|
6880
|
+
};
|
|
6881
|
+
const writeDataToFile = data => {
|
|
6882
|
+
try {
|
|
6883
|
+
fs__namespace.writeFileSync(STORAGE_STATE, data, "utf8");
|
|
6884
|
+
}
|
|
6885
|
+
catch (error) {
|
|
6886
|
+
console.log(error); // eslint-disable-line
|
|
6887
|
+
}
|
|
6888
|
+
return true;
|
|
6889
|
+
};
|
|
6890
|
+
const updateCredentials = ({ key, value }) => {
|
|
6891
|
+
const data = readFileSyncIfExists();
|
|
6892
|
+
data["user"][key] = value;
|
|
6893
|
+
return writeDataToFile(JSON.stringify(data));
|
|
6894
|
+
};
|
|
6895
|
+
const clearCredentials = () => {
|
|
6896
|
+
fs__namespace.unlink(STORAGE_STATE, error => {
|
|
6897
|
+
if (!error)
|
|
6898
|
+
return;
|
|
6899
|
+
console.log(error); // eslint-disable-line
|
|
6900
|
+
});
|
|
6901
|
+
};
|
|
6902
|
+
const readTranslations = () => {
|
|
6903
|
+
let translations = readFileSyncIfExists(PROJECT_TRANSLATIONS_PATH);
|
|
6904
|
+
const paths = out.sync(GLOBAL_TRANSLATIONS_PATTERN);
|
|
6905
|
+
paths.forEach(path => {
|
|
6906
|
+
const packageTranslation = readFileSyncIfExists(path);
|
|
6907
|
+
translations = ramda.mergeDeepLeft(translations, packageTranslation);
|
|
6908
|
+
});
|
|
6909
|
+
return translations;
|
|
6910
|
+
};
|
|
6911
|
+
|
|
6912
|
+
const timestamp = dayjs__default["default"]().format("YYYYMMDDHH");
|
|
6913
|
+
const firstName = "André";
|
|
6914
|
+
const lastName = "O'Reilly";
|
|
6915
|
+
const stagingOrganization = `cypresstest-invoice-${timestamp}`;
|
|
6916
|
+
const otpBypassKey = process.env.OTP_BYPASS_KEY;
|
|
6917
|
+
const stagingData = {
|
|
6918
|
+
firstName,
|
|
6919
|
+
lastName,
|
|
6920
|
+
otp: 111111,
|
|
6921
|
+
domain: "neetoinvoice.net",
|
|
6922
|
+
currentUserName: IS_STAGING_ENV
|
|
6923
|
+
? joinString(firstName, lastName)
|
|
6924
|
+
: "Oliver Smith",
|
|
6925
|
+
businessName: stagingOrganization,
|
|
6926
|
+
subdomainName: IS_STAGING_ENV ? stagingOrganization : "spinkart",
|
|
6927
|
+
email: IS_STAGING_ENV
|
|
6928
|
+
? `cypresstest${otpBypassKey}+invoice+${timestamp}@bigbinary.com`
|
|
6929
|
+
: "oliver@example.com",
|
|
6930
|
+
};
|
|
6931
|
+
|
|
6932
|
+
const i18n = {
|
|
6933
|
+
// i18n configuration options
|
|
6934
|
+
options: {
|
|
6935
|
+
debug: false,
|
|
6936
|
+
fallbackLng: "en",
|
|
6937
|
+
resources: { en: { translation: readTranslations() } },
|
|
6938
|
+
},
|
|
6939
|
+
// Fetch translations in every test or fetch once
|
|
6940
|
+
// Default: true
|
|
6941
|
+
cache: true,
|
|
6942
|
+
// Run as auto fixture to be available through all tests by getI18nInstance()
|
|
6943
|
+
// Default: true
|
|
6944
|
+
auto: true,
|
|
6945
|
+
};
|
|
6946
|
+
|
|
6947
|
+
const BASE_URL = "/api/v1";
|
|
6948
|
+
const PROFILE_PATH = "/profile";
|
|
6949
|
+
const NEETO_AUTH_URL = "https://app.neetoauth.net";
|
|
6950
|
+
const LOGIN_PATH = `${BASE_URL}/login`;
|
|
6951
|
+
const SIGNUP_PATH = `${BASE_URL}/signups`;
|
|
6952
|
+
const SUBDOMAIN_AVAILABILITY_PATH = `${BASE_URL}/subdomain_availability`;
|
|
6953
|
+
const COUNTRIES_PATH = `${BASE_URL}/countries`;
|
|
6954
|
+
const NEETO_APPS_PATH = `${BASE_URL}/neeto_apps`;
|
|
6955
|
+
|
|
6956
|
+
const COMMON_SELECTORS = {
|
|
6957
|
+
toastMessage: "toastr-message-container",
|
|
6958
|
+
toastIcon: ".Toastify__toast-icon",
|
|
6959
|
+
toastCloseButton: "toastr-close-button",
|
|
6960
|
+
dropdownIcon: "nui-dropdown-icon",
|
|
6961
|
+
checkbox: "nui-checkbox-input",
|
|
6962
|
+
spinner: ".neeto-ui-spinner",
|
|
6963
|
+
input: "nui-input-field",
|
|
6964
|
+
alertModalSubmitButton: "alert-submit-button",
|
|
6965
|
+
selectContainer: "nui-select-container",
|
|
6966
|
+
subheaderText: "subheader-left",
|
|
6967
|
+
};
|
|
6968
|
+
|
|
6969
|
+
const SIGNUP_SELECTORS = {
|
|
6970
|
+
emailTextField: "signup-email-text-field",
|
|
6971
|
+
firstNameTextField: "signup-profile-first-name-text-field",
|
|
6972
|
+
lastNameTextField: "signup-profile-last-name-text-field",
|
|
6973
|
+
organizationNameTextField: "signup-organization-name-text-field",
|
|
6974
|
+
organizationSubmitButton: "signup-organization-submit-button",
|
|
6975
|
+
otpTextBox: "otpinput-otp-number",
|
|
6976
|
+
profileSubmitButton: "signup-profile-submit-button",
|
|
6977
|
+
signupViaEmailButton: "signup-via-email-button",
|
|
6978
|
+
submitButton: "signup-email-submit-button",
|
|
6979
|
+
subdomainNameTextField: "signup-organization-subdomain-text-field",
|
|
6980
|
+
subdomainError: "subdomain-input-error",
|
|
6981
|
+
tryFreeButton: "neeto-auth-signup-link",
|
|
6982
|
+
};
|
|
6983
|
+
|
|
6984
|
+
const extractSubdomainFromError = (errorString) => {
|
|
6985
|
+
const regex = /cypresstest[a-zA-Z0-9-]+/g;
|
|
6986
|
+
const matches = errorString.match(regex);
|
|
6987
|
+
return matches[1];
|
|
6988
|
+
};
|
|
6989
|
+
|
|
6990
|
+
class OrganizationPage {
|
|
6991
|
+
constructor(page, neetoPlaywrightUtilities) {
|
|
6992
|
+
this.createOrganization = async ({ email, businessName, subdomainName, firstName, lastName, appName, }) => {
|
|
6993
|
+
if (!IS_STAGING_ENV)
|
|
6994
|
+
return;
|
|
6995
|
+
const defaultOtp = "123456";
|
|
6996
|
+
const appNameInLowerCase = appName.toLowerCase();
|
|
6997
|
+
const isNeetoAuth = appNameInLowerCase === "neetoauth";
|
|
6998
|
+
const authUrl = "https://app.neetoauth.net/signups/new";
|
|
6999
|
+
isNeetoAuth
|
|
7000
|
+
? await this.page.goto(authUrl)
|
|
7001
|
+
: await this.page.goto(`${authUrl}?redirect_uri=${appNameInLowerCase}.net`);
|
|
7002
|
+
await this.page.getByTestId(SIGNUP_SELECTORS.emailTextField).fill(email);
|
|
7003
|
+
const signup = this.neetoPlaywrightUtilities.interceptMultipleResponses({
|
|
7004
|
+
responseUrl: SIGNUP_PATH,
|
|
7005
|
+
baseUrl: NEETO_AUTH_URL,
|
|
7006
|
+
});
|
|
7007
|
+
await this.page.getByTestId(SIGNUP_SELECTORS.submitButton).click();
|
|
7008
|
+
await signup;
|
|
7009
|
+
await this.page.getByTestId(SIGNUP_SELECTORS.otpTextBox).fill(defaultOtp);
|
|
7010
|
+
await this.page
|
|
7011
|
+
.getByTestId(SIGNUP_SELECTORS.organizationNameTextField)
|
|
7012
|
+
.fill(businessName);
|
|
7013
|
+
const fetchSubdomainAvailability = this.page.waitForResponse(response => response.url().includes(SUBDOMAIN_AVAILABILITY_PATH));
|
|
7014
|
+
await this.page
|
|
7015
|
+
.getByTestId(SIGNUP_SELECTORS.subdomainNameTextField)
|
|
7016
|
+
.fill(subdomainName);
|
|
7017
|
+
await fetchSubdomainAvailability;
|
|
7018
|
+
const subdomainError = this.page.getByTestId(SIGNUP_SELECTORS.subdomainError);
|
|
7019
|
+
const subdomainErrorCount = await subdomainError.count();
|
|
7020
|
+
if (subdomainErrorCount !== 0) {
|
|
7021
|
+
await this.updateSubdomainIfExists(appNameInLowerCase);
|
|
7022
|
+
}
|
|
7023
|
+
await this.page
|
|
7024
|
+
.getByTestId(SIGNUP_SELECTORS.organizationSubmitButton)
|
|
7025
|
+
.click();
|
|
7026
|
+
await Promise.all([
|
|
7027
|
+
this.page.waitForResponse(response => response.url().includes(SIGNUP_PATH)),
|
|
7028
|
+
this.page.waitForResponse(response => response.url().includes(COUNTRIES_PATH)),
|
|
7029
|
+
]);
|
|
7030
|
+
await this.page.waitForURL(`**${PROFILE_PATH}`, { timeout: 15000 });
|
|
7031
|
+
await this.page
|
|
7032
|
+
.getByTestId(SIGNUP_SELECTORS.firstNameTextField)
|
|
7033
|
+
.fill(firstName);
|
|
7034
|
+
await this.page
|
|
7035
|
+
.getByTestId(SIGNUP_SELECTORS.lastNameTextField)
|
|
7036
|
+
.fill(lastName);
|
|
7037
|
+
await this.page.getByTestId(COMMON_SELECTORS.checkbox).click();
|
|
7038
|
+
const submitProfile = this.neetoPlaywrightUtilities.interceptMultipleResponses({
|
|
7039
|
+
responseUrl: SIGNUP_PATH,
|
|
7040
|
+
baseUrl: NEETO_AUTH_URL,
|
|
7041
|
+
});
|
|
7042
|
+
await this.page.getByTestId(SIGNUP_SELECTORS.profileSubmitButton).click();
|
|
7043
|
+
await submitProfile;
|
|
7044
|
+
};
|
|
7045
|
+
this.setupOrganization = async () => {
|
|
7046
|
+
if (!IS_STAGING_ENV)
|
|
7047
|
+
return;
|
|
7048
|
+
let headers = {};
|
|
7049
|
+
const { user } = readFileSyncIfExists();
|
|
7050
|
+
await this.createOrganization({
|
|
7051
|
+
businessName: user.businessName,
|
|
7052
|
+
email: user.email,
|
|
7053
|
+
firstName: user.firstName,
|
|
7054
|
+
lastName: user.lastName,
|
|
7055
|
+
subdomainName: user.subdomainName,
|
|
7056
|
+
appName: "neetoInvoice",
|
|
7057
|
+
});
|
|
7058
|
+
await this.page.route(`**${NEETO_APPS_PATH}`, async (route) => {
|
|
7059
|
+
headers = await route.request().allHeaders();
|
|
7060
|
+
await route.continue();
|
|
7061
|
+
});
|
|
7062
|
+
await test.expect(this.page.locator(COMMON_SELECTORS.spinner)).toBeHidden();
|
|
7063
|
+
const userCredentials = readFileSyncIfExists();
|
|
7064
|
+
await this.page.context().storageState({ path: STORAGE_STATE });
|
|
7065
|
+
const mergedCredentials = {
|
|
7066
|
+
...readFileSyncIfExists(),
|
|
7067
|
+
...userCredentials,
|
|
7068
|
+
headers,
|
|
7069
|
+
};
|
|
7070
|
+
writeDataToFile(JSON.stringify(mergedCredentials, null, 2));
|
|
7071
|
+
};
|
|
7072
|
+
this.updateSubdomainIfExists = async (appName) => {
|
|
7073
|
+
const subdomainError = this.page.getByTestId(SIGNUP_SELECTORS.subdomainError);
|
|
7074
|
+
let subdomainErrorCount = await subdomainError.count();
|
|
7075
|
+
if (subdomainErrorCount !== 0) {
|
|
7076
|
+
const subdomainErrorText = await subdomainError.innerText();
|
|
7077
|
+
const newOrganizationName = extractSubdomainFromError(subdomainErrorText);
|
|
7078
|
+
await this.page
|
|
7079
|
+
.getByTestId(SIGNUP_SELECTORS.subdomainNameTextField)
|
|
7080
|
+
.fill(newOrganizationName);
|
|
7081
|
+
await this.page.waitForResponse(response => response.url().includes(SUBDOMAIN_AVAILABILITY_PATH));
|
|
7082
|
+
subdomainErrorCount = await subdomainError.count();
|
|
7083
|
+
if (subdomainErrorCount === 0) {
|
|
7084
|
+
updateCredentials({
|
|
7085
|
+
key: "subdomainName",
|
|
7086
|
+
value: newOrganizationName,
|
|
7087
|
+
});
|
|
7088
|
+
updateCredentials({
|
|
7089
|
+
key: "businessName",
|
|
7090
|
+
value: newOrganizationName,
|
|
7091
|
+
});
|
|
7092
|
+
const newBaseUrl = `https://${newOrganizationName}.${appName}.net`;
|
|
7093
|
+
process.env.BASE_URL = newBaseUrl;
|
|
7094
|
+
await this.page
|
|
7095
|
+
.getByTestId(SIGNUP_SELECTORS.organizationNameTextField)
|
|
7096
|
+
.fill(newOrganizationName);
|
|
7097
|
+
}
|
|
7098
|
+
subdomainErrorCount = await subdomainError.count();
|
|
7099
|
+
if (subdomainErrorCount !== 0) {
|
|
7100
|
+
await this.updateSubdomainIfExists(appName);
|
|
7101
|
+
}
|
|
7102
|
+
}
|
|
7103
|
+
};
|
|
7104
|
+
this.page = page;
|
|
7105
|
+
this.neetoPlaywrightUtilities = neetoPlaywrightUtilities;
|
|
7106
|
+
}
|
|
7107
|
+
}
|
|
7108
|
+
|
|
7109
|
+
const LOGIN_SELECTORS = {
|
|
7110
|
+
appleAuthenticationButton: "apple-authentication-button",
|
|
7111
|
+
emailTextField: "login-email-text-field",
|
|
7112
|
+
googleAuthenticationButton: "google-authentication-button",
|
|
7113
|
+
githubAuthenticationButton: "github-authentication-button",
|
|
7114
|
+
loginViaEmailButton: "login-via-email-button",
|
|
7115
|
+
passwordTextField: "login-password-text-field",
|
|
7116
|
+
rememberMeCheckBox: "login-remember-me-check-box",
|
|
7117
|
+
submitButton: "login-submit-button",
|
|
7118
|
+
twitterAuthenticationButton: "twitter-authentication-button",
|
|
7119
|
+
};
|
|
7120
|
+
|
|
7121
|
+
const COMMON_TEXTS = { edit: "Edit" };
|
|
7122
|
+
|
|
7123
|
+
const initializeCredentials = () => {
|
|
7124
|
+
const { user } = readFileSyncIfExists();
|
|
7125
|
+
const newState = {
|
|
7126
|
+
...user,
|
|
7127
|
+
businessName: (user === null || user === void 0 ? void 0 : user.businessName) || stagingData.businessName,
|
|
7128
|
+
currentUserName: (user === null || user === void 0 ? void 0 : user.currentUserName) || stagingData.currentUserName,
|
|
7129
|
+
email: (user === null || user === void 0 ? void 0 : user.email) || stagingData.email,
|
|
7130
|
+
firstName: (user === null || user === void 0 ? void 0 : user.firstName) || stagingData.firstName,
|
|
7131
|
+
lastName: (user === null || user === void 0 ? void 0 : user.lastName) || stagingData.lastName,
|
|
7132
|
+
subdomainName: (user === null || user === void 0 ? void 0 : user.subdomainName) || stagingData.subdomainName,
|
|
7133
|
+
skipSetup: user === null || user === void 0 ? void 0 : user.skipSetup,
|
|
7134
|
+
};
|
|
7135
|
+
writeDataToFile(JSON.stringify({ user: newState }, null, 2));
|
|
7136
|
+
if (IS_STAGING_ENV) {
|
|
7137
|
+
const baseUrl = `https://${newState.subdomainName}.${stagingData.domain}`;
|
|
7138
|
+
process.env.BASE_URL = baseUrl;
|
|
7139
|
+
}
|
|
7140
|
+
};
|
|
7141
|
+
|
|
7142
|
+
const loginWithoutSSO = async ({ page, neetoPlaywrightUtilities, }) => {
|
|
7143
|
+
var _a;
|
|
7144
|
+
await page.goto((_a = process.env.BASE_URL) !== null && _a !== void 0 ? _a : "");
|
|
7145
|
+
let headers = {};
|
|
7146
|
+
await page.route(`**${LOGIN_PATH}`, async (route) => {
|
|
7147
|
+
headers = await route.request().allHeaders();
|
|
7148
|
+
await route.continue();
|
|
7149
|
+
});
|
|
7150
|
+
await page.getByTestId("login-email-text-field").fill(CREDENTIALS.email);
|
|
7151
|
+
await page
|
|
7152
|
+
.getByTestId("login-password-text-field")
|
|
7153
|
+
.fill(CREDENTIALS.password);
|
|
7154
|
+
const login = neetoPlaywrightUtilities.interceptMultipleResponses({
|
|
7155
|
+
times: 2,
|
|
7156
|
+
});
|
|
7157
|
+
await page.getByTestId(LOGIN_SELECTORS.submitButton).click();
|
|
7158
|
+
await login;
|
|
7159
|
+
const userCredentials = readFileSyncIfExists();
|
|
7160
|
+
await page.context().storageState({ path: STORAGE_STATE });
|
|
7161
|
+
const mergedCredentials = {
|
|
7162
|
+
...readFileSyncIfExists(),
|
|
7163
|
+
...userCredentials,
|
|
7164
|
+
headers,
|
|
7165
|
+
};
|
|
7166
|
+
writeDataToFile(JSON.stringify(mergedCredentials, null, 2));
|
|
7167
|
+
};
|
|
7168
|
+
const login = async ({ page, neetoPlaywrightUtilities }) => !IS_STAGING_ENV &&
|
|
7169
|
+
(await loginWithoutSSO({ page, neetoPlaywrightUtilities }));
|
|
7170
|
+
|
|
7171
|
+
var main$1 = {exports: {}};
|
|
7172
|
+
|
|
7173
|
+
var name = "dotenv";
|
|
7174
|
+
var version$1 = "16.3.1";
|
|
7175
|
+
var description = "Loads environment variables from .env file";
|
|
7176
|
+
var main = "lib/main.js";
|
|
7177
|
+
var types = "lib/main.d.ts";
|
|
7178
|
+
var exports$1 = {
|
|
7179
|
+
".": {
|
|
7180
|
+
types: "./lib/main.d.ts",
|
|
7181
|
+
require: "./lib/main.js",
|
|
7182
|
+
"default": "./lib/main.js"
|
|
7183
|
+
},
|
|
7184
|
+
"./config": "./config.js",
|
|
7185
|
+
"./config.js": "./config.js",
|
|
7186
|
+
"./lib/env-options": "./lib/env-options.js",
|
|
7187
|
+
"./lib/env-options.js": "./lib/env-options.js",
|
|
7188
|
+
"./lib/cli-options": "./lib/cli-options.js",
|
|
7189
|
+
"./lib/cli-options.js": "./lib/cli-options.js",
|
|
7190
|
+
"./package.json": "./package.json"
|
|
7191
|
+
};
|
|
7192
|
+
var scripts = {
|
|
7193
|
+
"dts-check": "tsc --project tests/types/tsconfig.json",
|
|
7194
|
+
lint: "standard",
|
|
7195
|
+
"lint-readme": "standard-markdown",
|
|
7196
|
+
pretest: "npm run lint && npm run dts-check",
|
|
7197
|
+
test: "tap tests/*.js --100 -Rspec",
|
|
7198
|
+
prerelease: "npm test",
|
|
7199
|
+
release: "standard-version"
|
|
7200
|
+
};
|
|
7201
|
+
var repository = {
|
|
7202
|
+
type: "git",
|
|
7203
|
+
url: "git://github.com/motdotla/dotenv.git"
|
|
7204
|
+
};
|
|
7205
|
+
var funding = "https://github.com/motdotla/dotenv?sponsor=1";
|
|
7206
|
+
var keywords = [
|
|
7207
|
+
"dotenv",
|
|
7208
|
+
"env",
|
|
7209
|
+
".env",
|
|
7210
|
+
"environment",
|
|
7211
|
+
"variables",
|
|
7212
|
+
"config",
|
|
7213
|
+
"settings"
|
|
7214
|
+
];
|
|
7215
|
+
var readmeFilename = "README.md";
|
|
7216
|
+
var license = "BSD-2-Clause";
|
|
7217
|
+
var devDependencies = {
|
|
7218
|
+
"@definitelytyped/dtslint": "^0.0.133",
|
|
7219
|
+
"@types/node": "^18.11.3",
|
|
7220
|
+
decache: "^4.6.1",
|
|
7221
|
+
sinon: "^14.0.1",
|
|
7222
|
+
standard: "^17.0.0",
|
|
7223
|
+
"standard-markdown": "^7.1.0",
|
|
7224
|
+
"standard-version": "^9.5.0",
|
|
7225
|
+
tap: "^16.3.0",
|
|
7226
|
+
tar: "^6.1.11",
|
|
7227
|
+
typescript: "^4.8.4"
|
|
7228
|
+
};
|
|
7229
|
+
var engines = {
|
|
7230
|
+
node: ">=12"
|
|
7231
|
+
};
|
|
7232
|
+
var browser = {
|
|
7233
|
+
fs: false
|
|
7234
|
+
};
|
|
7235
|
+
var require$$4 = {
|
|
7236
|
+
name: name,
|
|
7237
|
+
version: version$1,
|
|
7238
|
+
description: description,
|
|
7239
|
+
main: main,
|
|
7240
|
+
types: types,
|
|
7241
|
+
exports: exports$1,
|
|
7242
|
+
scripts: scripts,
|
|
7243
|
+
repository: repository,
|
|
7244
|
+
funding: funding,
|
|
7245
|
+
keywords: keywords,
|
|
7246
|
+
readmeFilename: readmeFilename,
|
|
7247
|
+
license: license,
|
|
7248
|
+
devDependencies: devDependencies,
|
|
7249
|
+
engines: engines,
|
|
7250
|
+
browser: browser
|
|
7251
|
+
};
|
|
7252
|
+
|
|
7253
|
+
const fs = fs__default["default"];
|
|
7254
|
+
const path = require$$0__default["default"];
|
|
7255
|
+
const os = require$$2__default["default"];
|
|
7256
|
+
const crypto = require$$3__default["default"];
|
|
7257
|
+
const packageJson = require$$4;
|
|
7258
|
+
|
|
7259
|
+
const version = packageJson.version;
|
|
7260
|
+
|
|
7261
|
+
const LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;
|
|
7262
|
+
|
|
7263
|
+
// Parse src into an Object
|
|
7264
|
+
function parse (src) {
|
|
7265
|
+
const obj = {};
|
|
7266
|
+
|
|
7267
|
+
// Convert buffer to string
|
|
7268
|
+
let lines = src.toString();
|
|
7269
|
+
|
|
7270
|
+
// Convert line breaks to same format
|
|
7271
|
+
lines = lines.replace(/\r\n?/mg, '\n');
|
|
7272
|
+
|
|
7273
|
+
let match;
|
|
7274
|
+
while ((match = LINE.exec(lines)) != null) {
|
|
7275
|
+
const key = match[1];
|
|
7276
|
+
|
|
7277
|
+
// Default undefined or null to empty string
|
|
7278
|
+
let value = (match[2] || '');
|
|
7279
|
+
|
|
7280
|
+
// Remove whitespace
|
|
7281
|
+
value = value.trim();
|
|
7282
|
+
|
|
7283
|
+
// Check if double quoted
|
|
7284
|
+
const maybeQuote = value[0];
|
|
7285
|
+
|
|
7286
|
+
// Remove surrounding quotes
|
|
7287
|
+
value = value.replace(/^(['"`])([\s\S]*)\1$/mg, '$2');
|
|
7288
|
+
|
|
7289
|
+
// Expand newlines if double quoted
|
|
7290
|
+
if (maybeQuote === '"') {
|
|
7291
|
+
value = value.replace(/\\n/g, '\n');
|
|
7292
|
+
value = value.replace(/\\r/g, '\r');
|
|
7293
|
+
}
|
|
7294
|
+
|
|
7295
|
+
// Add to object
|
|
7296
|
+
obj[key] = value;
|
|
7297
|
+
}
|
|
7298
|
+
|
|
7299
|
+
return obj
|
|
7300
|
+
}
|
|
7301
|
+
|
|
7302
|
+
function _parseVault (options) {
|
|
7303
|
+
const vaultPath = _vaultPath(options);
|
|
7304
|
+
|
|
7305
|
+
// Parse .env.vault
|
|
7306
|
+
const result = DotenvModule.configDotenv({ path: vaultPath });
|
|
7307
|
+
if (!result.parsed) {
|
|
7308
|
+
throw new Error(`MISSING_DATA: Cannot parse ${vaultPath} for an unknown reason`)
|
|
7309
|
+
}
|
|
7310
|
+
|
|
7311
|
+
// handle scenario for comma separated keys - for use with key rotation
|
|
7312
|
+
// example: DOTENV_KEY="dotenv://:key_1234@dotenv.org/vault/.env.vault?environment=prod,dotenv://:key_7890@dotenv.org/vault/.env.vault?environment=prod"
|
|
7313
|
+
const keys = _dotenvKey(options).split(',');
|
|
7314
|
+
const length = keys.length;
|
|
7315
|
+
|
|
7316
|
+
let decrypted;
|
|
7317
|
+
for (let i = 0; i < length; i++) {
|
|
7318
|
+
try {
|
|
7319
|
+
// Get full key
|
|
7320
|
+
const key = keys[i].trim();
|
|
7321
|
+
|
|
7322
|
+
// Get instructions for decrypt
|
|
7323
|
+
const attrs = _instructions(result, key);
|
|
7324
|
+
|
|
7325
|
+
// Decrypt
|
|
7326
|
+
decrypted = DotenvModule.decrypt(attrs.ciphertext, attrs.key);
|
|
7327
|
+
|
|
7328
|
+
break
|
|
7329
|
+
} catch (error) {
|
|
7330
|
+
// last key
|
|
7331
|
+
if (i + 1 >= length) {
|
|
7332
|
+
throw error
|
|
7333
|
+
}
|
|
7334
|
+
// try next key
|
|
7335
|
+
}
|
|
7336
|
+
}
|
|
7337
|
+
|
|
7338
|
+
// Parse decrypted .env string
|
|
7339
|
+
return DotenvModule.parse(decrypted)
|
|
7340
|
+
}
|
|
7341
|
+
|
|
7342
|
+
function _log (message) {
|
|
7343
|
+
console.log(`[dotenv@${version}][INFO] ${message}`);
|
|
7344
|
+
}
|
|
7345
|
+
|
|
7346
|
+
function _warn (message) {
|
|
7347
|
+
console.log(`[dotenv@${version}][WARN] ${message}`);
|
|
7348
|
+
}
|
|
7349
|
+
|
|
7350
|
+
function _debug (message) {
|
|
7351
|
+
console.log(`[dotenv@${version}][DEBUG] ${message}`);
|
|
7352
|
+
}
|
|
7353
|
+
|
|
7354
|
+
function _dotenvKey (options) {
|
|
7355
|
+
// prioritize developer directly setting options.DOTENV_KEY
|
|
7356
|
+
if (options && options.DOTENV_KEY && options.DOTENV_KEY.length > 0) {
|
|
7357
|
+
return options.DOTENV_KEY
|
|
7358
|
+
}
|
|
7359
|
+
|
|
7360
|
+
// secondary infra already contains a DOTENV_KEY environment variable
|
|
7361
|
+
if (process.env.DOTENV_KEY && process.env.DOTENV_KEY.length > 0) {
|
|
7362
|
+
return process.env.DOTENV_KEY
|
|
7363
|
+
}
|
|
7364
|
+
|
|
7365
|
+
// fallback to empty string
|
|
7366
|
+
return ''
|
|
7367
|
+
}
|
|
7368
|
+
|
|
7369
|
+
function _instructions (result, dotenvKey) {
|
|
7370
|
+
// Parse DOTENV_KEY. Format is a URI
|
|
7371
|
+
let uri;
|
|
7372
|
+
try {
|
|
7373
|
+
uri = new URL(dotenvKey);
|
|
7374
|
+
} catch (error) {
|
|
7375
|
+
if (error.code === 'ERR_INVALID_URL') {
|
|
7376
|
+
throw new Error('INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenv.org/vault/.env.vault?environment=development')
|
|
7377
|
+
}
|
|
7378
|
+
|
|
7379
|
+
throw error
|
|
7380
|
+
}
|
|
7381
|
+
|
|
7382
|
+
// Get decrypt key
|
|
7383
|
+
const key = uri.password;
|
|
7384
|
+
if (!key) {
|
|
7385
|
+
throw new Error('INVALID_DOTENV_KEY: Missing key part')
|
|
7386
|
+
}
|
|
7387
|
+
|
|
7388
|
+
// Get environment
|
|
7389
|
+
const environment = uri.searchParams.get('environment');
|
|
7390
|
+
if (!environment) {
|
|
7391
|
+
throw new Error('INVALID_DOTENV_KEY: Missing environment part')
|
|
7392
|
+
}
|
|
7393
|
+
|
|
7394
|
+
// Get ciphertext payload
|
|
7395
|
+
const environmentKey = `DOTENV_VAULT_${environment.toUpperCase()}`;
|
|
7396
|
+
const ciphertext = result.parsed[environmentKey]; // DOTENV_VAULT_PRODUCTION
|
|
7397
|
+
if (!ciphertext) {
|
|
7398
|
+
throw new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${environmentKey} in your .env.vault file.`)
|
|
7399
|
+
}
|
|
7400
|
+
|
|
7401
|
+
return { ciphertext, key }
|
|
7402
|
+
}
|
|
7403
|
+
|
|
7404
|
+
function _vaultPath (options) {
|
|
7405
|
+
let dotenvPath = path.resolve(process.cwd(), '.env');
|
|
7406
|
+
|
|
7407
|
+
if (options && options.path && options.path.length > 0) {
|
|
7408
|
+
dotenvPath = options.path;
|
|
7409
|
+
}
|
|
7410
|
+
|
|
7411
|
+
// Locate .env.vault
|
|
7412
|
+
return dotenvPath.endsWith('.vault') ? dotenvPath : `${dotenvPath}.vault`
|
|
7413
|
+
}
|
|
7414
|
+
|
|
7415
|
+
function _resolveHome (envPath) {
|
|
7416
|
+
return envPath[0] === '~' ? path.join(os.homedir(), envPath.slice(1)) : envPath
|
|
7417
|
+
}
|
|
7418
|
+
|
|
7419
|
+
function _configVault (options) {
|
|
7420
|
+
_log('Loading env from encrypted .env.vault');
|
|
7421
|
+
|
|
7422
|
+
const parsed = DotenvModule._parseVault(options);
|
|
7423
|
+
|
|
7424
|
+
let processEnv = process.env;
|
|
7425
|
+
if (options && options.processEnv != null) {
|
|
7426
|
+
processEnv = options.processEnv;
|
|
7427
|
+
}
|
|
7428
|
+
|
|
7429
|
+
DotenvModule.populate(processEnv, parsed, options);
|
|
7430
|
+
|
|
7431
|
+
return { parsed }
|
|
7432
|
+
}
|
|
7433
|
+
|
|
7434
|
+
function configDotenv (options) {
|
|
7435
|
+
let dotenvPath = path.resolve(process.cwd(), '.env');
|
|
7436
|
+
let encoding = 'utf8';
|
|
7437
|
+
const debug = Boolean(options && options.debug);
|
|
7438
|
+
|
|
7439
|
+
if (options) {
|
|
7440
|
+
if (options.path != null) {
|
|
7441
|
+
dotenvPath = _resolveHome(options.path);
|
|
7442
|
+
}
|
|
7443
|
+
if (options.encoding != null) {
|
|
7444
|
+
encoding = options.encoding;
|
|
7445
|
+
}
|
|
7446
|
+
}
|
|
7447
|
+
|
|
7448
|
+
try {
|
|
7449
|
+
// Specifying an encoding returns a string instead of a buffer
|
|
7450
|
+
const parsed = DotenvModule.parse(fs.readFileSync(dotenvPath, { encoding }));
|
|
7451
|
+
|
|
7452
|
+
let processEnv = process.env;
|
|
7453
|
+
if (options && options.processEnv != null) {
|
|
7454
|
+
processEnv = options.processEnv;
|
|
7455
|
+
}
|
|
7456
|
+
|
|
7457
|
+
DotenvModule.populate(processEnv, parsed, options);
|
|
7458
|
+
|
|
7459
|
+
return { parsed }
|
|
7460
|
+
} catch (e) {
|
|
7461
|
+
if (debug) {
|
|
7462
|
+
_debug(`Failed to load ${dotenvPath} ${e.message}`);
|
|
7463
|
+
}
|
|
7464
|
+
|
|
7465
|
+
return { error: e }
|
|
7466
|
+
}
|
|
7467
|
+
}
|
|
7468
|
+
|
|
7469
|
+
// Populates process.env from .env file
|
|
7470
|
+
function config (options) {
|
|
7471
|
+
const vaultPath = _vaultPath(options);
|
|
7472
|
+
|
|
7473
|
+
// fallback to original dotenv if DOTENV_KEY is not set
|
|
7474
|
+
if (_dotenvKey(options).length === 0) {
|
|
7475
|
+
return DotenvModule.configDotenv(options)
|
|
7476
|
+
}
|
|
7477
|
+
|
|
7478
|
+
// dotenvKey exists but .env.vault file does not exist
|
|
7479
|
+
if (!fs.existsSync(vaultPath)) {
|
|
7480
|
+
_warn(`You set DOTENV_KEY but you are missing a .env.vault file at ${vaultPath}. Did you forget to build it?`);
|
|
7481
|
+
|
|
7482
|
+
return DotenvModule.configDotenv(options)
|
|
7483
|
+
}
|
|
7484
|
+
|
|
7485
|
+
return DotenvModule._configVault(options)
|
|
7486
|
+
}
|
|
7487
|
+
|
|
7488
|
+
function decrypt (encrypted, keyStr) {
|
|
7489
|
+
const key = Buffer.from(keyStr.slice(-64), 'hex');
|
|
7490
|
+
let ciphertext = Buffer.from(encrypted, 'base64');
|
|
7491
|
+
|
|
7492
|
+
const nonce = ciphertext.slice(0, 12);
|
|
7493
|
+
const authTag = ciphertext.slice(-16);
|
|
7494
|
+
ciphertext = ciphertext.slice(12, -16);
|
|
7495
|
+
|
|
7496
|
+
try {
|
|
7497
|
+
const aesgcm = crypto.createDecipheriv('aes-256-gcm', key, nonce);
|
|
7498
|
+
aesgcm.setAuthTag(authTag);
|
|
7499
|
+
return `${aesgcm.update(ciphertext)}${aesgcm.final()}`
|
|
7500
|
+
} catch (error) {
|
|
7501
|
+
const isRange = error instanceof RangeError;
|
|
7502
|
+
const invalidKeyLength = error.message === 'Invalid key length';
|
|
7503
|
+
const decryptionFailed = error.message === 'Unsupported state or unable to authenticate data';
|
|
7504
|
+
|
|
7505
|
+
if (isRange || invalidKeyLength) {
|
|
7506
|
+
const msg = 'INVALID_DOTENV_KEY: It must be 64 characters long (or more)';
|
|
7507
|
+
throw new Error(msg)
|
|
7508
|
+
} else if (decryptionFailed) {
|
|
7509
|
+
const msg = 'DECRYPTION_FAILED: Please check your DOTENV_KEY';
|
|
7510
|
+
throw new Error(msg)
|
|
7511
|
+
} else {
|
|
7512
|
+
console.error('Error: ', error.code);
|
|
7513
|
+
console.error('Error: ', error.message);
|
|
7514
|
+
throw error
|
|
7515
|
+
}
|
|
7516
|
+
}
|
|
7517
|
+
}
|
|
7518
|
+
|
|
7519
|
+
// Populate process.env with parsed values
|
|
7520
|
+
function populate (processEnv, parsed, options = {}) {
|
|
7521
|
+
const debug = Boolean(options && options.debug);
|
|
7522
|
+
const override = Boolean(options && options.override);
|
|
7523
|
+
|
|
7524
|
+
if (typeof parsed !== 'object') {
|
|
7525
|
+
throw new Error('OBJECT_REQUIRED: Please check the processEnv argument being passed to populate')
|
|
7526
|
+
}
|
|
7527
|
+
|
|
7528
|
+
// Set process.env
|
|
7529
|
+
for (const key of Object.keys(parsed)) {
|
|
7530
|
+
if (Object.prototype.hasOwnProperty.call(processEnv, key)) {
|
|
7531
|
+
if (override === true) {
|
|
7532
|
+
processEnv[key] = parsed[key];
|
|
7533
|
+
}
|
|
7534
|
+
|
|
7535
|
+
if (debug) {
|
|
7536
|
+
if (override === true) {
|
|
7537
|
+
_debug(`"${key}" is already defined and WAS overwritten`);
|
|
7538
|
+
} else {
|
|
7539
|
+
_debug(`"${key}" is already defined and was NOT overwritten`);
|
|
7540
|
+
}
|
|
7541
|
+
}
|
|
7542
|
+
} else {
|
|
7543
|
+
processEnv[key] = parsed[key];
|
|
7544
|
+
}
|
|
7545
|
+
}
|
|
7546
|
+
}
|
|
7547
|
+
|
|
7548
|
+
const DotenvModule = {
|
|
7549
|
+
configDotenv,
|
|
7550
|
+
_configVault,
|
|
7551
|
+
_parseVault,
|
|
7552
|
+
config,
|
|
7553
|
+
decrypt,
|
|
7554
|
+
parse,
|
|
7555
|
+
populate
|
|
7556
|
+
};
|
|
7557
|
+
|
|
7558
|
+
main$1.exports.configDotenv = DotenvModule.configDotenv;
|
|
7559
|
+
main$1.exports._configVault = DotenvModule._configVault;
|
|
7560
|
+
main$1.exports._parseVault = DotenvModule._parseVault;
|
|
7561
|
+
main$1.exports.config = DotenvModule.config;
|
|
7562
|
+
main$1.exports.decrypt = DotenvModule.decrypt;
|
|
7563
|
+
main$1.exports.parse = DotenvModule.parse;
|
|
7564
|
+
main$1.exports.populate = DotenvModule.populate;
|
|
7565
|
+
|
|
7566
|
+
main$1.exports = DotenvModule;
|
|
6983
7567
|
|
|
6984
7568
|
// @ts-check
|
|
6985
7569
|
var _a, _b;
|
|
6986
|
-
|
|
6987
|
-
const dotenv = require("dotenv");
|
|
6988
|
-
dotenv.config({
|
|
7570
|
+
main$1.exports.config({
|
|
6989
7571
|
path: `./e2e/config/.env.${(_a = process.env.TEST_ENV) !== null && _a !== void 0 ? _a : "development"}`,
|
|
6990
7572
|
});
|
|
6991
7573
|
const storageState = "./e2e/auth/user.json";
|
|
@@ -6998,7 +7580,7 @@ const isCI = ["staging", "review"].includes((_b = process.env.TEST_ENV) !== null
|
|
|
6998
7580
|
!!process.env.NEETO_CI_JOB_ID;
|
|
6999
7581
|
const definePlaywrightConfig = (overrides) => {
|
|
7000
7582
|
const { globalOverrides = {}, useOverrides = {}, projectOverrides = [], currentsOverrides = {}, } = overrides;
|
|
7001
|
-
return defineConfig({
|
|
7583
|
+
return test.defineConfig({
|
|
7002
7584
|
testDir: "./e2e/tests",
|
|
7003
7585
|
fullyParallel: false,
|
|
7004
7586
|
forbidOnly: isCI,
|
|
@@ -7025,7 +7607,7 @@ const definePlaywrightConfig = (overrides) => {
|
|
|
7025
7607
|
},
|
|
7026
7608
|
{
|
|
7027
7609
|
name: "chromium",
|
|
7028
|
-
use: { ...devices["Desktop Chrome"], storageState },
|
|
7610
|
+
use: { ...test.devices["Desktop Chrome"], storageState },
|
|
7029
7611
|
dependencies: ["setup"],
|
|
7030
7612
|
},
|
|
7031
7613
|
{ name: "cleanup credentials", testMatch: "global.teardown.ts" },
|
|
@@ -7035,28 +7617,36 @@ const definePlaywrightConfig = (overrides) => {
|
|
|
7035
7617
|
};
|
|
7036
7618
|
|
|
7037
7619
|
exports.BASE_URL = BASE_URL;
|
|
7038
|
-
exports.COMMON_SELECTORS = COMMON_SELECTORS
|
|
7620
|
+
exports.COMMON_SELECTORS = COMMON_SELECTORS;
|
|
7039
7621
|
exports.COMMON_TEXTS = COMMON_TEXTS;
|
|
7040
7622
|
exports.COUNTRIES_PATH = COUNTRIES_PATH;
|
|
7623
|
+
exports.CREDENTIALS = CREDENTIALS;
|
|
7624
|
+
exports.CustomCommands = CustomCommands;
|
|
7041
7625
|
exports.ENVIRONMENT = ENVIRONMENT;
|
|
7042
7626
|
exports.GLOBAL_TRANSLATIONS_PATTERN = GLOBAL_TRANSLATIONS_PATTERN;
|
|
7043
7627
|
exports.IS_STAGING_ENV = IS_STAGING_ENV;
|
|
7044
7628
|
exports.LOGIN_PATH = LOGIN_PATH;
|
|
7629
|
+
exports.LOGIN_SELECTORS = LOGIN_SELECTORS;
|
|
7045
7630
|
exports.NEETO_APPS_PATH = NEETO_APPS_PATH;
|
|
7631
|
+
exports.NEETO_AUTH_URL = NEETO_AUTH_URL;
|
|
7632
|
+
exports.OrganizationPage = OrganizationPage;
|
|
7046
7633
|
exports.PROFILE_PATH = PROFILE_PATH;
|
|
7047
7634
|
exports.PROJECT_TRANSLATIONS_PATH = PROJECT_TRANSLATIONS_PATH;
|
|
7048
7635
|
exports.SIGNUP_PATH = SIGNUP_PATH;
|
|
7049
7636
|
exports.SIGNUP_SELECTORS = SIGNUP_SELECTORS;
|
|
7050
|
-
exports.STORAGE_STATE = STORAGE_STATE
|
|
7637
|
+
exports.STORAGE_STATE = STORAGE_STATE;
|
|
7051
7638
|
exports.SUBDOMAIN_AVAILABILITY_PATH = SUBDOMAIN_AVAILABILITY_PATH;
|
|
7052
7639
|
exports.clearCredentials = clearCredentials;
|
|
7640
|
+
exports.commands = commands;
|
|
7053
7641
|
exports.definePlaywrightConfig = definePlaywrightConfig;
|
|
7642
|
+
exports.i18n = i18n;
|
|
7054
7643
|
exports.initializeCredentials = initializeCredentials;
|
|
7055
7644
|
exports.joinString = joinString;
|
|
7056
|
-
exports.
|
|
7645
|
+
exports.login = login;
|
|
7646
|
+
exports.loginWithoutSSO = loginWithoutSSO;
|
|
7647
|
+
exports.readFileSyncIfExists = readFileSyncIfExists;
|
|
7057
7648
|
exports.readTranslations = readTranslations;
|
|
7058
7649
|
exports.stagingData = stagingData;
|
|
7059
|
-
exports.test = test;
|
|
7060
7650
|
exports.updateCredentials = updateCredentials;
|
|
7061
7651
|
exports.writeDataToFile = writeDataToFile;
|
|
7062
7652
|
//# sourceMappingURL=index.cjs.js.map
|