@bigbinary/neeto-playwright-commons 1.1.0 → 1.1.2
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 +774 -214
- package/index.cjs.js.map +1 -1
- package/index.d.ts +142 -37
- package/index.js +744 -186
- package/index.js.map +1 -1
- package/package.json +25 -107
package/index.js
CHANGED
|
@@ -1,33 +1,16 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import require$$
|
|
1
|
+
import { expect, defineConfig, devices } from '@playwright/test';
|
|
2
|
+
import * as require$$0 from 'fs';
|
|
3
|
+
import require$$0__default from 'fs';
|
|
4
|
+
import require$$2 from 'os';
|
|
4
5
|
import require$$0$1 from 'path';
|
|
5
6
|
import require$$0$2 from 'util';
|
|
6
7
|
import require$$0$3 from 'stream';
|
|
7
8
|
import require$$0$4 from 'events';
|
|
8
9
|
import { mergeDeepLeft } from 'ramda';
|
|
9
10
|
import dayjs from 'dayjs';
|
|
10
|
-
import
|
|
11
|
+
import require$$3 from 'crypto';
|
|
11
12
|
|
|
12
|
-
const
|
|
13
|
-
development: "development",
|
|
14
|
-
staging: "staging",
|
|
15
|
-
review: "review",
|
|
16
|
-
};
|
|
17
|
-
const IS_STAGING_ENV = process.env.TEST_ENV === "staging";
|
|
18
|
-
const STORAGE_STATE$1 = "./e2e/auth/user.json";
|
|
19
|
-
const GLOBAL_TRANSLATIONS_PATTERN = "../node_modules/@bigbinary/**/translations/en.json";
|
|
20
|
-
const PROJECT_TRANSLATIONS_PATH = "../app/javascript/src/translations/en.json";
|
|
21
|
-
|
|
22
|
-
const BASE_URL = "/api/v1";
|
|
23
|
-
const PROFILE_PATH = "/profile";
|
|
24
|
-
const LOGIN_PATH = `${BASE_URL}/login`;
|
|
25
|
-
const SIGNUP_PATH = `${BASE_URL}/signups`;
|
|
26
|
-
const SUBDOMAIN_AVAILABILITY_PATH = `${BASE_URL}/subdomain_availability`;
|
|
27
|
-
const COUNTRIES_PATH = `${BASE_URL}/countries`;
|
|
28
|
-
const NEETO_APPS_PATH = `${BASE_URL}/neeto_apps`;
|
|
29
|
-
|
|
30
|
-
const COMMON_SELECTORS$1 = {
|
|
13
|
+
const COMMON_SELECTORS = {
|
|
31
14
|
toastMessage: "toastr-message-container",
|
|
32
15
|
toastIcon: ".Toastify__toast-icon",
|
|
33
16
|
toastCloseButton: "toastr-close-button",
|
|
@@ -40,21 +23,6 @@ const COMMON_SELECTORS$1 = {
|
|
|
40
23
|
subheaderText: "subheader-left",
|
|
41
24
|
};
|
|
42
25
|
|
|
43
|
-
const SIGNUP_SELECTORS = {
|
|
44
|
-
emailField: "signup-email-text-field",
|
|
45
|
-
signupButton: "signup-email-submit-button",
|
|
46
|
-
otpInput: "otpinput-otp-number",
|
|
47
|
-
organizationField: "signup-organization-name-text-field",
|
|
48
|
-
subdomainField: "signup-organization-subdomain-text-field",
|
|
49
|
-
submitButton: "signup-organization-submit-button",
|
|
50
|
-
firstNameField: "signup-profile-first-name-text-field",
|
|
51
|
-
lastNameField: "signup-profile-last-name-text-field",
|
|
52
|
-
profileSubmitButton: "signup-profile-submit-button",
|
|
53
|
-
subdomainInputError: "subdomain-input-error",
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
const COMMON_TEXTS = { edit: "Edit" };
|
|
57
|
-
|
|
58
26
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
59
27
|
|
|
60
28
|
var tasks = {};
|
|
@@ -94,10 +62,10 @@ function isEnoentCodeError(error) {
|
|
|
94
62
|
}
|
|
95
63
|
errno$1.isEnoentCodeError = isEnoentCodeError;
|
|
96
64
|
|
|
97
|
-
var fs$
|
|
65
|
+
var fs$8 = {};
|
|
98
66
|
|
|
99
|
-
Object.defineProperty(fs$
|
|
100
|
-
fs$
|
|
67
|
+
Object.defineProperty(fs$8, "__esModule", { value: true });
|
|
68
|
+
fs$8.createDirentFromStats = void 0;
|
|
101
69
|
class DirentFromStats$1 {
|
|
102
70
|
constructor(name, stats) {
|
|
103
71
|
this.name = name;
|
|
@@ -113,15 +81,15 @@ class DirentFromStats$1 {
|
|
|
113
81
|
function createDirentFromStats$1(name, stats) {
|
|
114
82
|
return new DirentFromStats$1(name, stats);
|
|
115
83
|
}
|
|
116
|
-
fs$
|
|
84
|
+
fs$8.createDirentFromStats = createDirentFromStats$1;
|
|
117
85
|
|
|
118
|
-
var path$
|
|
86
|
+
var path$a = {};
|
|
119
87
|
|
|
120
|
-
Object.defineProperty(path$
|
|
121
|
-
path$
|
|
122
|
-
const os = require$$
|
|
123
|
-
const path$
|
|
124
|
-
const IS_WINDOWS_PLATFORM = os.platform() === 'win32';
|
|
88
|
+
Object.defineProperty(path$a, "__esModule", { value: true });
|
|
89
|
+
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;
|
|
90
|
+
const os$1 = require$$2;
|
|
91
|
+
const path$9 = require$$0$1;
|
|
92
|
+
const IS_WINDOWS_PLATFORM = os$1.platform() === 'win32';
|
|
125
93
|
const LEADING_DOT_SEGMENT_CHARACTERS_COUNT = 2; // ./ or .\\
|
|
126
94
|
/**
|
|
127
95
|
* All non-escaped special characters.
|
|
@@ -147,11 +115,11 @@ const WINDOWS_BACKSLASHES_RE = /\\(?![!()+@[\]{}])/g;
|
|
|
147
115
|
function unixify(filepath) {
|
|
148
116
|
return filepath.replace(/\\/g, '/');
|
|
149
117
|
}
|
|
150
|
-
path$
|
|
118
|
+
path$a.unixify = unixify;
|
|
151
119
|
function makeAbsolute(cwd, filepath) {
|
|
152
|
-
return path$
|
|
120
|
+
return path$9.resolve(cwd, filepath);
|
|
153
121
|
}
|
|
154
|
-
path$
|
|
122
|
+
path$a.makeAbsolute = makeAbsolute;
|
|
155
123
|
function removeLeadingDotSegment(entry) {
|
|
156
124
|
// We do not use `startsWith` because this is 10x slower than current implementation for some cases.
|
|
157
125
|
// eslint-disable-next-line @typescript-eslint/prefer-string-starts-ends-with
|
|
@@ -163,27 +131,27 @@ function removeLeadingDotSegment(entry) {
|
|
|
163
131
|
}
|
|
164
132
|
return entry;
|
|
165
133
|
}
|
|
166
|
-
path$
|
|
167
|
-
path$
|
|
134
|
+
path$a.removeLeadingDotSegment = removeLeadingDotSegment;
|
|
135
|
+
path$a.escape = IS_WINDOWS_PLATFORM ? escapeWindowsPath : escapePosixPath;
|
|
168
136
|
function escapeWindowsPath(pattern) {
|
|
169
137
|
return pattern.replace(WINDOWS_UNESCAPED_GLOB_SYMBOLS_RE, '\\$2');
|
|
170
138
|
}
|
|
171
|
-
path$
|
|
139
|
+
path$a.escapeWindowsPath = escapeWindowsPath;
|
|
172
140
|
function escapePosixPath(pattern) {
|
|
173
141
|
return pattern.replace(POSIX_UNESCAPED_GLOB_SYMBOLS_RE, '\\$2');
|
|
174
142
|
}
|
|
175
|
-
path$
|
|
176
|
-
path$
|
|
143
|
+
path$a.escapePosixPath = escapePosixPath;
|
|
144
|
+
path$a.convertPathToPattern = IS_WINDOWS_PLATFORM ? convertWindowsPathToPattern : convertPosixPathToPattern;
|
|
177
145
|
function convertWindowsPathToPattern(filepath) {
|
|
178
146
|
return escapeWindowsPath(filepath)
|
|
179
147
|
.replace(DOS_DEVICE_PATH_RE, '//$1')
|
|
180
148
|
.replace(WINDOWS_BACKSLASHES_RE, '/');
|
|
181
149
|
}
|
|
182
|
-
path$
|
|
150
|
+
path$a.convertWindowsPathToPattern = convertWindowsPathToPattern;
|
|
183
151
|
function convertPosixPathToPattern(filepath) {
|
|
184
152
|
return escapePosixPath(filepath);
|
|
185
153
|
}
|
|
186
|
-
path$
|
|
154
|
+
path$a.convertPosixPathToPattern = convertPosixPathToPattern;
|
|
187
155
|
|
|
188
156
|
var pattern$1 = {};
|
|
189
157
|
|
|
@@ -361,7 +329,7 @@ var isGlob$1 = function isGlob(str, options) {
|
|
|
361
329
|
|
|
362
330
|
var isGlob = isGlob$1;
|
|
363
331
|
var pathPosixDirname = require$$0$1.posix.dirname;
|
|
364
|
-
var isWin32 = require$$
|
|
332
|
+
var isWin32 = require$$2.platform() === 'win32';
|
|
365
333
|
|
|
366
334
|
var slash = '/';
|
|
367
335
|
var backslash = /\\/g;
|
|
@@ -1350,7 +1318,7 @@ const {
|
|
|
1350
1318
|
* parse
|
|
1351
1319
|
*/
|
|
1352
1320
|
|
|
1353
|
-
const parse$
|
|
1321
|
+
const parse$4 = (input, options = {}) => {
|
|
1354
1322
|
if (typeof input !== 'string') {
|
|
1355
1323
|
throw new TypeError('Expected a string');
|
|
1356
1324
|
}
|
|
@@ -1649,12 +1617,12 @@ const parse$3 = (input, options = {}) => {
|
|
|
1649
1617
|
return ast;
|
|
1650
1618
|
};
|
|
1651
1619
|
|
|
1652
|
-
var parse_1$1 = parse$
|
|
1620
|
+
var parse_1$1 = parse$4;
|
|
1653
1621
|
|
|
1654
1622
|
const stringify = stringify$4;
|
|
1655
1623
|
const compile = compile_1;
|
|
1656
1624
|
const expand = expand_1;
|
|
1657
|
-
const parse$
|
|
1625
|
+
const parse$3 = parse_1$1;
|
|
1658
1626
|
|
|
1659
1627
|
/**
|
|
1660
1628
|
* Expand the given pattern or create a regex-compatible string.
|
|
@@ -1706,7 +1674,7 @@ const braces$1 = (input, options = {}) => {
|
|
|
1706
1674
|
* @api public
|
|
1707
1675
|
*/
|
|
1708
1676
|
|
|
1709
|
-
braces$1.parse = (input, options = {}) => parse$
|
|
1677
|
+
braces$1.parse = (input, options = {}) => parse$3(input, options);
|
|
1710
1678
|
|
|
1711
1679
|
/**
|
|
1712
1680
|
* Creates a braces string from an AST, or an AST node.
|
|
@@ -1824,7 +1792,7 @@ var picomatch$2 = {exports: {}};
|
|
|
1824
1792
|
|
|
1825
1793
|
var utils$f = {};
|
|
1826
1794
|
|
|
1827
|
-
const path$
|
|
1795
|
+
const path$8 = require$$0$1;
|
|
1828
1796
|
const WIN_SLASH = '\\\\/';
|
|
1829
1797
|
const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
|
|
1830
1798
|
|
|
@@ -1977,7 +1945,7 @@ var constants$3 = {
|
|
|
1977
1945
|
CHAR_VERTICAL_LINE: 124, /* | */
|
|
1978
1946
|
CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279, /* \uFEFF */
|
|
1979
1947
|
|
|
1980
|
-
SEP: path$
|
|
1948
|
+
SEP: path$8.sep,
|
|
1981
1949
|
|
|
1982
1950
|
/**
|
|
1983
1951
|
* Create EXTGLOB_CHARS
|
|
@@ -2510,7 +2478,7 @@ const syntaxError = (type, char) => {
|
|
|
2510
2478
|
* @return {Object}
|
|
2511
2479
|
*/
|
|
2512
2480
|
|
|
2513
|
-
const parse$
|
|
2481
|
+
const parse$2 = (input, options) => {
|
|
2514
2482
|
if (typeof input !== 'string') {
|
|
2515
2483
|
throw new TypeError('Expected a string');
|
|
2516
2484
|
}
|
|
@@ -2713,7 +2681,7 @@ const parse$1 = (input, options) => {
|
|
|
2713
2681
|
// Suitable patterns: `/!(*.d).ts`, `/!(*.d).{ts,tsx}`, `**/!(*-dbg).@(js)`.
|
|
2714
2682
|
//
|
|
2715
2683
|
// Disabling the `fastpaths` option due to a problem with parsing strings as `.ts` in the pattern like `**/!(*.d).ts`.
|
|
2716
|
-
const expression = parse$
|
|
2684
|
+
const expression = parse$2(rest, { ...options, fastpaths: false }).output;
|
|
2717
2685
|
|
|
2718
2686
|
output = token.close = `)${expression})${extglobStar})`;
|
|
2719
2687
|
}
|
|
@@ -3459,7 +3427,7 @@ const parse$1 = (input, options) => {
|
|
|
3459
3427
|
* impact when none of the fast paths match.
|
|
3460
3428
|
*/
|
|
3461
3429
|
|
|
3462
|
-
parse$
|
|
3430
|
+
parse$2.fastpaths = (input, options) => {
|
|
3463
3431
|
const opts = { ...options };
|
|
3464
3432
|
const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
|
|
3465
3433
|
const len = input.length;
|
|
@@ -3546,11 +3514,11 @@ parse$1.fastpaths = (input, options) => {
|
|
|
3546
3514
|
return source;
|
|
3547
3515
|
};
|
|
3548
3516
|
|
|
3549
|
-
var parse_1 = parse$
|
|
3517
|
+
var parse_1 = parse$2;
|
|
3550
3518
|
|
|
3551
|
-
const path$
|
|
3519
|
+
const path$7 = require$$0$1;
|
|
3552
3520
|
const scan = scan_1;
|
|
3553
|
-
const parse = parse_1;
|
|
3521
|
+
const parse$1 = parse_1;
|
|
3554
3522
|
const utils$c = utils$f;
|
|
3555
3523
|
const constants$1 = constants$3;
|
|
3556
3524
|
const isObject = val => val && typeof val === 'object' && !Array.isArray(val);
|
|
@@ -3708,7 +3676,7 @@ picomatch$1.test = (input, regex, options, { glob, posix } = {}) => {
|
|
|
3708
3676
|
|
|
3709
3677
|
picomatch$1.matchBase = (input, glob, options, posix = utils$c.isWindows(options)) => {
|
|
3710
3678
|
const regex = glob instanceof RegExp ? glob : picomatch$1.makeRe(glob, options);
|
|
3711
|
-
return regex.test(path$
|
|
3679
|
+
return regex.test(path$7.basename(input));
|
|
3712
3680
|
};
|
|
3713
3681
|
|
|
3714
3682
|
/**
|
|
@@ -3746,7 +3714,7 @@ picomatch$1.isMatch = (str, patterns, options) => picomatch$1(patterns, options)
|
|
|
3746
3714
|
|
|
3747
3715
|
picomatch$1.parse = (pattern, options) => {
|
|
3748
3716
|
if (Array.isArray(pattern)) return pattern.map(p => picomatch$1.parse(p, options));
|
|
3749
|
-
return parse(pattern, { ...options, fastpaths: false });
|
|
3717
|
+
return parse$1(pattern, { ...options, fastpaths: false });
|
|
3750
3718
|
};
|
|
3751
3719
|
|
|
3752
3720
|
/**
|
|
@@ -3839,11 +3807,11 @@ picomatch$1.makeRe = (input, options = {}, returnOutput = false, returnState = f
|
|
|
3839
3807
|
let parsed = { negated: false, fastpaths: true };
|
|
3840
3808
|
|
|
3841
3809
|
if (options.fastpaths !== false && (input[0] === '.' || input[0] === '*')) {
|
|
3842
|
-
parsed.output = parse.fastpaths(input, options);
|
|
3810
|
+
parsed.output = parse$1.fastpaths(input, options);
|
|
3843
3811
|
}
|
|
3844
3812
|
|
|
3845
3813
|
if (!parsed.output) {
|
|
3846
|
-
parsed = parse(input, options);
|
|
3814
|
+
parsed = parse$1(input, options);
|
|
3847
3815
|
}
|
|
3848
3816
|
|
|
3849
3817
|
return picomatch$1.compileRe(parsed, options, returnOutput, returnState);
|
|
@@ -4362,7 +4330,7 @@ var micromatch_1 = micromatch$1;
|
|
|
4362
4330
|
|
|
4363
4331
|
Object.defineProperty(pattern$1, "__esModule", { value: true });
|
|
4364
4332
|
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;
|
|
4365
|
-
const path$
|
|
4333
|
+
const path$6 = require$$0$1;
|
|
4366
4334
|
const globParent = globParent$1;
|
|
4367
4335
|
const micromatch = micromatch_1;
|
|
4368
4336
|
const GLOBSTAR = '**';
|
|
@@ -4484,7 +4452,7 @@ function endsWithSlashGlobStar(pattern) {
|
|
|
4484
4452
|
}
|
|
4485
4453
|
pattern$1.endsWithSlashGlobStar = endsWithSlashGlobStar;
|
|
4486
4454
|
function isAffectDepthOfReadingPattern(pattern) {
|
|
4487
|
-
const basename = path$
|
|
4455
|
+
const basename = path$6.basename(pattern);
|
|
4488
4456
|
return endsWithSlashGlobStar(pattern) || isStaticPattern(basename);
|
|
4489
4457
|
}
|
|
4490
4458
|
pattern$1.isAffectDepthOfReadingPattern = isAffectDepthOfReadingPattern;
|
|
@@ -4730,10 +4698,10 @@ const array = array$1;
|
|
|
4730
4698
|
utils$k.array = array;
|
|
4731
4699
|
const errno = errno$1;
|
|
4732
4700
|
utils$k.errno = errno;
|
|
4733
|
-
const fs$
|
|
4734
|
-
utils$k.fs = fs$
|
|
4735
|
-
const path$
|
|
4736
|
-
utils$k.path = path$
|
|
4701
|
+
const fs$7 = fs$8;
|
|
4702
|
+
utils$k.fs = fs$7;
|
|
4703
|
+
const path$5 = path$a;
|
|
4704
|
+
utils$k.path = path$5;
|
|
4737
4705
|
const pattern = pattern$1;
|
|
4738
4706
|
utils$k.pattern = pattern;
|
|
4739
4707
|
const stream$3 = stream$4;
|
|
@@ -4932,12 +4900,12 @@ sync$7.read = read$2;
|
|
|
4932
4900
|
|
|
4933
4901
|
var settings$3 = {};
|
|
4934
4902
|
|
|
4935
|
-
var fs$
|
|
4903
|
+
var fs$6 = {};
|
|
4936
4904
|
|
|
4937
4905
|
(function (exports) {
|
|
4938
4906
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4939
4907
|
exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = void 0;
|
|
4940
|
-
const fs =
|
|
4908
|
+
const fs = require$$0__default;
|
|
4941
4909
|
exports.FILE_SYSTEM_ADAPTER = {
|
|
4942
4910
|
lstat: fs.lstat,
|
|
4943
4911
|
stat: fs.stat,
|
|
@@ -4951,15 +4919,15 @@ var fs$5 = {};
|
|
|
4951
4919
|
return Object.assign(Object.assign({}, exports.FILE_SYSTEM_ADAPTER), fsMethods);
|
|
4952
4920
|
}
|
|
4953
4921
|
exports.createFileSystemAdapter = createFileSystemAdapter;
|
|
4954
|
-
} (fs$
|
|
4922
|
+
} (fs$6));
|
|
4955
4923
|
|
|
4956
4924
|
Object.defineProperty(settings$3, "__esModule", { value: true });
|
|
4957
|
-
const fs$
|
|
4925
|
+
const fs$5 = fs$6;
|
|
4958
4926
|
class Settings$2 {
|
|
4959
4927
|
constructor(_options = {}) {
|
|
4960
4928
|
this._options = _options;
|
|
4961
4929
|
this.followSymbolicLink = this._getValue(this._options.followSymbolicLink, true);
|
|
4962
|
-
this.fs = fs$
|
|
4930
|
+
this.fs = fs$5.createFileSystemAdapter(this._options.fs);
|
|
4963
4931
|
this.markSymbolicLink = this._getValue(this._options.markSymbolicLink, false);
|
|
4964
4932
|
this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
|
|
4965
4933
|
}
|
|
@@ -5080,10 +5048,10 @@ constants.IS_SUPPORT_READDIR_WITH_FILE_TYPES = IS_MATCHED_BY_MAJOR || IS_MATCHED
|
|
|
5080
5048
|
|
|
5081
5049
|
var utils$9 = {};
|
|
5082
5050
|
|
|
5083
|
-
var fs$
|
|
5051
|
+
var fs$4 = {};
|
|
5084
5052
|
|
|
5085
|
-
Object.defineProperty(fs$
|
|
5086
|
-
fs$
|
|
5053
|
+
Object.defineProperty(fs$4, "__esModule", { value: true });
|
|
5054
|
+
fs$4.createDirentFromStats = void 0;
|
|
5087
5055
|
class DirentFromStats {
|
|
5088
5056
|
constructor(name, stats) {
|
|
5089
5057
|
this.name = name;
|
|
@@ -5099,12 +5067,12 @@ class DirentFromStats {
|
|
|
5099
5067
|
function createDirentFromStats(name, stats) {
|
|
5100
5068
|
return new DirentFromStats(name, stats);
|
|
5101
5069
|
}
|
|
5102
|
-
fs$
|
|
5070
|
+
fs$4.createDirentFromStats = createDirentFromStats;
|
|
5103
5071
|
|
|
5104
5072
|
Object.defineProperty(utils$9, "__esModule", { value: true });
|
|
5105
5073
|
utils$9.fs = void 0;
|
|
5106
|
-
const fs$
|
|
5107
|
-
utils$9.fs = fs$
|
|
5074
|
+
const fs$3 = fs$4;
|
|
5075
|
+
utils$9.fs = fs$3;
|
|
5108
5076
|
|
|
5109
5077
|
var common$6 = {};
|
|
5110
5078
|
|
|
@@ -5283,12 +5251,12 @@ sync$5.readdir = readdir;
|
|
|
5283
5251
|
|
|
5284
5252
|
var settings$2 = {};
|
|
5285
5253
|
|
|
5286
|
-
var fs$
|
|
5254
|
+
var fs$2 = {};
|
|
5287
5255
|
|
|
5288
5256
|
(function (exports) {
|
|
5289
5257
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5290
5258
|
exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = void 0;
|
|
5291
|
-
const fs =
|
|
5259
|
+
const fs = require$$0__default;
|
|
5292
5260
|
exports.FILE_SYSTEM_ADAPTER = {
|
|
5293
5261
|
lstat: fs.lstat,
|
|
5294
5262
|
stat: fs.stat,
|
|
@@ -5304,18 +5272,18 @@ var fs$1 = {};
|
|
|
5304
5272
|
return Object.assign(Object.assign({}, exports.FILE_SYSTEM_ADAPTER), fsMethods);
|
|
5305
5273
|
}
|
|
5306
5274
|
exports.createFileSystemAdapter = createFileSystemAdapter;
|
|
5307
|
-
} (fs$
|
|
5275
|
+
} (fs$2));
|
|
5308
5276
|
|
|
5309
5277
|
Object.defineProperty(settings$2, "__esModule", { value: true });
|
|
5310
|
-
const path$
|
|
5278
|
+
const path$4 = require$$0$1;
|
|
5311
5279
|
const fsStat$3 = out$1;
|
|
5312
|
-
const fs = fs$
|
|
5280
|
+
const fs$1 = fs$2;
|
|
5313
5281
|
class Settings$1 {
|
|
5314
5282
|
constructor(_options = {}) {
|
|
5315
5283
|
this._options = _options;
|
|
5316
5284
|
this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, false);
|
|
5317
|
-
this.fs = fs.createFileSystemAdapter(this._options.fs);
|
|
5318
|
-
this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path$
|
|
5285
|
+
this.fs = fs$1.createFileSystemAdapter(this._options.fs);
|
|
5286
|
+
this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path$4.sep);
|
|
5319
5287
|
this.stats = this._getValue(this._options.stats, false);
|
|
5320
5288
|
this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
|
|
5321
5289
|
this.fsStatSettings = new fsStat$3.Settings({
|
|
@@ -5967,7 +5935,7 @@ sync$3.default = SyncProvider;
|
|
|
5967
5935
|
var settings$1 = {};
|
|
5968
5936
|
|
|
5969
5937
|
Object.defineProperty(settings$1, "__esModule", { value: true });
|
|
5970
|
-
const path$
|
|
5938
|
+
const path$3 = require$$0$1;
|
|
5971
5939
|
const fsScandir = out$2;
|
|
5972
5940
|
class Settings {
|
|
5973
5941
|
constructor(_options = {}) {
|
|
@@ -5977,7 +5945,7 @@ class Settings {
|
|
|
5977
5945
|
this.deepFilter = this._getValue(this._options.deepFilter, null);
|
|
5978
5946
|
this.entryFilter = this._getValue(this._options.entryFilter, null);
|
|
5979
5947
|
this.errorFilter = this._getValue(this._options.errorFilter, null);
|
|
5980
|
-
this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path$
|
|
5948
|
+
this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path$3.sep);
|
|
5981
5949
|
this.fsScandirSettings = new fsScandir.Settings({
|
|
5982
5950
|
followSymbolicLinks: this._options.followSymbolicLinks,
|
|
5983
5951
|
fs: this._options.fs,
|
|
@@ -6029,7 +5997,7 @@ function getSettings(settingsOrOptions = {}) {
|
|
|
6029
5997
|
var reader = {};
|
|
6030
5998
|
|
|
6031
5999
|
Object.defineProperty(reader, "__esModule", { value: true });
|
|
6032
|
-
const path$
|
|
6000
|
+
const path$2 = require$$0$1;
|
|
6033
6001
|
const fsStat$2 = out$1;
|
|
6034
6002
|
const utils$6 = utils$k;
|
|
6035
6003
|
class Reader {
|
|
@@ -6042,7 +6010,7 @@ class Reader {
|
|
|
6042
6010
|
});
|
|
6043
6011
|
}
|
|
6044
6012
|
_getFullEntryPath(filepath) {
|
|
6045
|
-
return path$
|
|
6013
|
+
return path$2.resolve(this._settings.cwd, filepath);
|
|
6046
6014
|
}
|
|
6047
6015
|
_makeEntry(stats, pattern) {
|
|
6048
6016
|
const entry = {
|
|
@@ -6417,7 +6385,7 @@ class EntryTransformer {
|
|
|
6417
6385
|
entry.default = EntryTransformer;
|
|
6418
6386
|
|
|
6419
6387
|
Object.defineProperty(provider, "__esModule", { value: true });
|
|
6420
|
-
const path = require$$0$1;
|
|
6388
|
+
const path$1 = require$$0$1;
|
|
6421
6389
|
const deep_1 = deep;
|
|
6422
6390
|
const entry_1 = entry$1;
|
|
6423
6391
|
const error_1 = error;
|
|
@@ -6431,7 +6399,7 @@ class Provider {
|
|
|
6431
6399
|
this.entryTransformer = new entry_2.default(this._settings);
|
|
6432
6400
|
}
|
|
6433
6401
|
_getRootDirectory(task) {
|
|
6434
|
-
return path.resolve(this._settings.cwd, task.base);
|
|
6402
|
+
return path$1.resolve(this._settings.cwd, task.base);
|
|
6435
6403
|
}
|
|
6436
6404
|
_getReaderOptions(task) {
|
|
6437
6405
|
const basePath = task.base === '.' ? '' : task.base;
|
|
@@ -6595,8 +6563,8 @@ var settings = {};
|
|
|
6595
6563
|
(function (exports) {
|
|
6596
6564
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6597
6565
|
exports.DEFAULT_FILE_SYSTEM_ADAPTER = void 0;
|
|
6598
|
-
const fs =
|
|
6599
|
-
const os = require$$
|
|
6566
|
+
const fs = require$$0__default;
|
|
6567
|
+
const os = require$$2;
|
|
6600
6568
|
/**
|
|
6601
6569
|
* The `os.cpus` method can return zero. We expect the number of cores to be greater than zero.
|
|
6602
6570
|
* https://github.com/nodejs/node/blob/7faeddf23a98c53896f8b574a6e66589e8fb1eb8/lib/os.js#L106-L107
|
|
@@ -6753,15 +6721,26 @@ function assertPatternsInput(input) {
|
|
|
6753
6721
|
}
|
|
6754
6722
|
var out = FastGlob;
|
|
6755
6723
|
|
|
6724
|
+
const ENVIRONMENT = {
|
|
6725
|
+
development: "development",
|
|
6726
|
+
staging: "staging",
|
|
6727
|
+
review: "review",
|
|
6728
|
+
};
|
|
6729
|
+
const IS_STAGING_ENV = process.env.TEST_ENV === "staging";
|
|
6730
|
+
const STORAGE_STATE = "./e2e/auth/user.json";
|
|
6731
|
+
const GLOBAL_TRANSLATIONS_PATTERN = "../node_modules/@bigbinary/**/translations/en.json";
|
|
6732
|
+
const PROJECT_TRANSLATIONS_PATH = "../app/javascript/src/translations/en.json";
|
|
6733
|
+
const CREDENTIALS = { email: "oliver@example.com", password: "welcome" };
|
|
6734
|
+
|
|
6756
6735
|
const joinString = (string1, string2, string3 = "", separator = " ") => {
|
|
6757
6736
|
if (string3 === "") {
|
|
6758
6737
|
return string1 + separator + string2;
|
|
6759
6738
|
}
|
|
6760
6739
|
return string1 + separator + string2 + separator + string3;
|
|
6761
6740
|
};
|
|
6762
|
-
const readFileSyncIfExists
|
|
6741
|
+
const readFileSyncIfExists = (path = STORAGE_STATE) => {
|
|
6763
6742
|
try {
|
|
6764
|
-
return JSON.parse(
|
|
6743
|
+
return JSON.parse(require$$0.readFileSync(path, "utf8"));
|
|
6765
6744
|
}
|
|
6766
6745
|
catch (error) {
|
|
6767
6746
|
return {};
|
|
@@ -6769,7 +6748,7 @@ const readFileSyncIfExists$1 = (path = STORAGE_STATE$1) => {
|
|
|
6769
6748
|
};
|
|
6770
6749
|
const writeDataToFile = data => {
|
|
6771
6750
|
try {
|
|
6772
|
-
|
|
6751
|
+
require$$0.writeFileSync(STORAGE_STATE, data, "utf8");
|
|
6773
6752
|
}
|
|
6774
6753
|
catch (error) {
|
|
6775
6754
|
console.log(error); // eslint-disable-line
|
|
@@ -6777,91 +6756,27 @@ const writeDataToFile = data => {
|
|
|
6777
6756
|
return true;
|
|
6778
6757
|
};
|
|
6779
6758
|
const updateCredentials = ({ key, value }) => {
|
|
6780
|
-
const data = readFileSyncIfExists
|
|
6759
|
+
const data = readFileSyncIfExists();
|
|
6781
6760
|
data["user"][key] = value;
|
|
6782
6761
|
return writeDataToFile(JSON.stringify(data));
|
|
6783
6762
|
};
|
|
6784
6763
|
const clearCredentials = () => {
|
|
6785
|
-
|
|
6764
|
+
require$$0.unlink(STORAGE_STATE, error => {
|
|
6786
6765
|
if (!error)
|
|
6787
6766
|
return;
|
|
6788
6767
|
console.log(error); // eslint-disable-line
|
|
6789
6768
|
});
|
|
6790
6769
|
};
|
|
6791
6770
|
const readTranslations = () => {
|
|
6792
|
-
let translations = readFileSyncIfExists
|
|
6771
|
+
let translations = readFileSyncIfExists(PROJECT_TRANSLATIONS_PATH);
|
|
6793
6772
|
const paths = out.sync(GLOBAL_TRANSLATIONS_PATTERN);
|
|
6794
6773
|
paths.forEach(path => {
|
|
6795
|
-
const packageTranslation = readFileSyncIfExists
|
|
6774
|
+
const packageTranslation = readFileSyncIfExists(path);
|
|
6796
6775
|
translations = mergeDeepLeft(translations, packageTranslation);
|
|
6797
6776
|
});
|
|
6798
6777
|
return translations;
|
|
6799
6778
|
};
|
|
6800
6779
|
|
|
6801
|
-
const timestamp = dayjs().format("YYYYMMDDHH");
|
|
6802
|
-
const firstName = "André";
|
|
6803
|
-
const lastName = "O'Reilly";
|
|
6804
|
-
const stagingOrganization = `cypresstest-invoice-${timestamp}`;
|
|
6805
|
-
const otpBypassKey = process.env.OTP_BYPASS_KEY;
|
|
6806
|
-
const stagingData = {
|
|
6807
|
-
firstName,
|
|
6808
|
-
lastName,
|
|
6809
|
-
otp: 111111,
|
|
6810
|
-
domain: "neetoinvoice.net",
|
|
6811
|
-
currentUserName: IS_STAGING_ENV
|
|
6812
|
-
? joinString(firstName, lastName)
|
|
6813
|
-
: "Oliver Smith",
|
|
6814
|
-
businessName: stagingOrganization,
|
|
6815
|
-
subdomainName: IS_STAGING_ENV ? stagingOrganization : "spinkart",
|
|
6816
|
-
email: IS_STAGING_ENV
|
|
6817
|
-
? `cypresstest${otpBypassKey}+invoice+${timestamp}@bigbinary.com`
|
|
6818
|
-
: "oliver@example.com",
|
|
6819
|
-
};
|
|
6820
|
-
|
|
6821
|
-
const initializeCredentials = () => {
|
|
6822
|
-
const { user } = readFileSyncIfExists$1();
|
|
6823
|
-
const newState = {
|
|
6824
|
-
...user,
|
|
6825
|
-
businessName: (user === null || user === void 0 ? void 0 : user.businessName) || stagingData.businessName,
|
|
6826
|
-
currentUserName: (user === null || user === void 0 ? void 0 : user.currentUserName) || stagingData.currentUserName,
|
|
6827
|
-
email: (user === null || user === void 0 ? void 0 : user.email) || stagingData.email,
|
|
6828
|
-
firstName: (user === null || user === void 0 ? void 0 : user.firstName) || stagingData.firstName,
|
|
6829
|
-
lastName: (user === null || user === void 0 ? void 0 : user.lastName) || stagingData.lastName,
|
|
6830
|
-
subdomainName: (user === null || user === void 0 ? void 0 : user.subdomainName) || stagingData.subdomainName,
|
|
6831
|
-
skipSetup: user === null || user === void 0 ? void 0 : user.skipSetup,
|
|
6832
|
-
};
|
|
6833
|
-
writeDataToFile(JSON.stringify({ user: newState }, null, 2));
|
|
6834
|
-
if (IS_STAGING_ENV) {
|
|
6835
|
-
const baseUrl = `https://${newState.subdomainName}.${stagingData.domain}`;
|
|
6836
|
-
process.env.BASE_URL = baseUrl;
|
|
6837
|
-
}
|
|
6838
|
-
};
|
|
6839
|
-
|
|
6840
|
-
const COMMON_SELECTORS = {
|
|
6841
|
-
toastMessage: "toastr-message-container",
|
|
6842
|
-
toastIcon: ".Toastify__toast-icon",
|
|
6843
|
-
toastCloseButton: "toastr-close-button",
|
|
6844
|
-
dropdownIcon: "nui-dropdown-icon",
|
|
6845
|
-
checkbox: "nui-checkbox-input",
|
|
6846
|
-
spinner: ".neeto-ui-spinner",
|
|
6847
|
-
input: "nui-input-field",
|
|
6848
|
-
alertModalSubmitButton: "alert-submit-button",
|
|
6849
|
-
selectContainer: "nui-select-container",
|
|
6850
|
-
subheaderText: "subheader-left",
|
|
6851
|
-
};
|
|
6852
|
-
|
|
6853
|
-
process.env.TEST_ENV === "staging";
|
|
6854
|
-
const STORAGE_STATE = "./e2e/auth/user.json";
|
|
6855
|
-
|
|
6856
|
-
const readFileSyncIfExists = (path = STORAGE_STATE) => {
|
|
6857
|
-
try {
|
|
6858
|
-
return JSON.parse(fs$8.readFileSync(path, "utf8"));
|
|
6859
|
-
}
|
|
6860
|
-
catch (error) {
|
|
6861
|
-
return {};
|
|
6862
|
-
}
|
|
6863
|
-
};
|
|
6864
|
-
|
|
6865
6780
|
class CustomCommands {
|
|
6866
6781
|
constructor(page, request) {
|
|
6867
6782
|
this.interceptMultipleResponses = ({ responseUrl = "", times = 1, baseUrl, }) => Promise.all([...new Array(times)].map(() => this.page.waitForResponse(response => {
|
|
@@ -6937,23 +6852,666 @@ class CustomCommands {
|
|
|
6937
6852
|
}
|
|
6938
6853
|
}
|
|
6939
6854
|
|
|
6940
|
-
const
|
|
6855
|
+
const commands = {
|
|
6941
6856
|
neetoPlaywrightUtilities: async ({ page, request }, use) => {
|
|
6942
6857
|
const commands = new CustomCommands(page, request);
|
|
6943
6858
|
await use(commands);
|
|
6944
6859
|
},
|
|
6945
6860
|
page: async ({ page }, use) => {
|
|
6946
6861
|
await page.goto("/");
|
|
6947
|
-
await page.waitForLoadState(
|
|
6862
|
+
await page.waitForLoadState();
|
|
6948
6863
|
await use(page);
|
|
6949
6864
|
},
|
|
6950
|
-
}
|
|
6865
|
+
};
|
|
6866
|
+
|
|
6867
|
+
const timestamp = dayjs().format("YYYYMMDDHH");
|
|
6868
|
+
const firstName = "André";
|
|
6869
|
+
const lastName = "O'Reilly";
|
|
6870
|
+
const stagingOrganization = `cypresstest-invoice-${timestamp}`;
|
|
6871
|
+
const otpBypassKey = process.env.OTP_BYPASS_KEY;
|
|
6872
|
+
const stagingData = {
|
|
6873
|
+
firstName,
|
|
6874
|
+
lastName,
|
|
6875
|
+
otp: 111111,
|
|
6876
|
+
domain: "neetoinvoice.net",
|
|
6877
|
+
currentUserName: IS_STAGING_ENV
|
|
6878
|
+
? joinString(firstName, lastName)
|
|
6879
|
+
: "Oliver Smith",
|
|
6880
|
+
businessName: stagingOrganization,
|
|
6881
|
+
subdomainName: IS_STAGING_ENV ? stagingOrganization : "spinkart",
|
|
6882
|
+
email: IS_STAGING_ENV
|
|
6883
|
+
? `cypresstest${otpBypassKey}+invoice+${timestamp}-playwright@bigbinary.com`
|
|
6884
|
+
: "oliver@example.com",
|
|
6885
|
+
};
|
|
6886
|
+
|
|
6887
|
+
const i18n = {
|
|
6888
|
+
// i18n configuration options
|
|
6889
|
+
options: {
|
|
6890
|
+
debug: false,
|
|
6891
|
+
fallbackLng: "en",
|
|
6892
|
+
resources: { en: { translation: readTranslations() } },
|
|
6893
|
+
},
|
|
6894
|
+
// Fetch translations in every test or fetch once
|
|
6895
|
+
// Default: true
|
|
6896
|
+
cache: true,
|
|
6897
|
+
// Run as auto fixture to be available through all tests by getI18nInstance()
|
|
6898
|
+
// Default: true
|
|
6899
|
+
auto: true,
|
|
6900
|
+
};
|
|
6901
|
+
|
|
6902
|
+
const BASE_URL = "/api/v1";
|
|
6903
|
+
const ROUTES = {
|
|
6904
|
+
neetoAuth: "https://app.neetoauth.net",
|
|
6905
|
+
profile: "/profile",
|
|
6906
|
+
login: `${BASE_URL}/login`,
|
|
6907
|
+
signup: `${BASE_URL}/signups`,
|
|
6908
|
+
subdomainAvailability: `${BASE_URL}/subdomain_availability`,
|
|
6909
|
+
countries: `${BASE_URL}/countries`,
|
|
6910
|
+
neetoAps: `${BASE_URL}/neeto_apps`,
|
|
6911
|
+
};
|
|
6912
|
+
|
|
6913
|
+
const SIGNUP_SELECTORS = {
|
|
6914
|
+
emailTextField: "signup-email-text-field",
|
|
6915
|
+
firstNameTextField: "signup-profile-first-name-text-field",
|
|
6916
|
+
lastNameTextField: "signup-profile-last-name-text-field",
|
|
6917
|
+
organizationNameTextField: "signup-organization-name-text-field",
|
|
6918
|
+
organizationSubmitButton: "signup-organization-submit-button",
|
|
6919
|
+
otpTextBox: "otpinput-otp-number",
|
|
6920
|
+
profileSubmitButton: "signup-profile-submit-button",
|
|
6921
|
+
signupViaEmailButton: "signup-via-email-button",
|
|
6922
|
+
submitButton: "signup-email-submit-button",
|
|
6923
|
+
subdomainNameTextField: "signup-organization-subdomain-text-field",
|
|
6924
|
+
subdomainError: "subdomain-input-error",
|
|
6925
|
+
tryFreeButton: "neeto-auth-signup-link",
|
|
6926
|
+
};
|
|
6927
|
+
|
|
6928
|
+
const extractSubdomainFromError = (errorString) => {
|
|
6929
|
+
const regex = /cypresstest[a-zA-Z0-9-]+/g;
|
|
6930
|
+
const matches = errorString.match(regex);
|
|
6931
|
+
return matches[1];
|
|
6932
|
+
};
|
|
6933
|
+
|
|
6934
|
+
class OrganizationPage {
|
|
6935
|
+
constructor(page, neetoPlaywrightUtilities) {
|
|
6936
|
+
this.createOrganization = async ({ email, businessName, subdomainName, firstName, lastName, appName, }) => {
|
|
6937
|
+
if (!IS_STAGING_ENV)
|
|
6938
|
+
return;
|
|
6939
|
+
const defaultOtp = "123456";
|
|
6940
|
+
const appNameInLowerCase = appName.toLowerCase();
|
|
6941
|
+
const isNeetoAuth = appNameInLowerCase === "neetoauth";
|
|
6942
|
+
const authUrl = "https://app.neetoauth.net/signups/new";
|
|
6943
|
+
isNeetoAuth
|
|
6944
|
+
? await this.page.goto(authUrl)
|
|
6945
|
+
: await this.page.goto(`${authUrl}?redirect_uri=${appNameInLowerCase}.net`);
|
|
6946
|
+
await this.page.getByTestId(SIGNUP_SELECTORS.emailTextField).fill(email);
|
|
6947
|
+
const signup = this.neetoPlaywrightUtilities.interceptMultipleResponses({
|
|
6948
|
+
responseUrl: ROUTES.signup,
|
|
6949
|
+
baseUrl: ROUTES.neetoAuth,
|
|
6950
|
+
});
|
|
6951
|
+
await this.page.getByTestId(SIGNUP_SELECTORS.submitButton).click();
|
|
6952
|
+
await signup;
|
|
6953
|
+
await this.page.getByTestId(SIGNUP_SELECTORS.otpTextBox).fill(defaultOtp);
|
|
6954
|
+
await this.page
|
|
6955
|
+
.getByTestId(SIGNUP_SELECTORS.organizationNameTextField)
|
|
6956
|
+
.fill(businessName);
|
|
6957
|
+
const fetchSubdomainAvailability = this.page.waitForResponse(response => response.url().includes(ROUTES.subdomainAvailability));
|
|
6958
|
+
await this.page
|
|
6959
|
+
.getByTestId(SIGNUP_SELECTORS.subdomainNameTextField)
|
|
6960
|
+
.fill(subdomainName);
|
|
6961
|
+
await fetchSubdomainAvailability;
|
|
6962
|
+
const subdomainError = this.page.getByTestId(SIGNUP_SELECTORS.subdomainError);
|
|
6963
|
+
const subdomainErrorCount = await subdomainError.count();
|
|
6964
|
+
if (subdomainErrorCount !== 0) {
|
|
6965
|
+
await this.updateSubdomainIfExists(appNameInLowerCase);
|
|
6966
|
+
}
|
|
6967
|
+
await this.page
|
|
6968
|
+
.getByTestId(SIGNUP_SELECTORS.organizationSubmitButton)
|
|
6969
|
+
.click();
|
|
6970
|
+
await Promise.all([
|
|
6971
|
+
this.page.waitForResponse(response => response.url().includes(ROUTES.signup)),
|
|
6972
|
+
this.page.waitForResponse(response => response.url().includes(ROUTES.countries)),
|
|
6973
|
+
]);
|
|
6974
|
+
await this.page.waitForURL(`**${ROUTES.profile}`, { timeout: 15000 });
|
|
6975
|
+
await this.page
|
|
6976
|
+
.getByTestId(SIGNUP_SELECTORS.firstNameTextField)
|
|
6977
|
+
.fill(firstName);
|
|
6978
|
+
await this.page
|
|
6979
|
+
.getByTestId(SIGNUP_SELECTORS.lastNameTextField)
|
|
6980
|
+
.fill(lastName);
|
|
6981
|
+
await this.page.getByTestId(COMMON_SELECTORS.checkbox).click();
|
|
6982
|
+
const submitProfile = this.neetoPlaywrightUtilities.interceptMultipleResponses({
|
|
6983
|
+
responseUrl: ROUTES.signup,
|
|
6984
|
+
baseUrl: ROUTES.neetoAuth,
|
|
6985
|
+
});
|
|
6986
|
+
await this.page.getByTestId(SIGNUP_SELECTORS.profileSubmitButton).click();
|
|
6987
|
+
await submitProfile;
|
|
6988
|
+
};
|
|
6989
|
+
this.setupOrganization = async () => {
|
|
6990
|
+
if (!IS_STAGING_ENV)
|
|
6991
|
+
return;
|
|
6992
|
+
let headers = {};
|
|
6993
|
+
const { user } = readFileSyncIfExists();
|
|
6994
|
+
await this.createOrganization({
|
|
6995
|
+
businessName: user.businessName,
|
|
6996
|
+
email: user.email,
|
|
6997
|
+
firstName: user.firstName,
|
|
6998
|
+
lastName: user.lastName,
|
|
6999
|
+
subdomainName: user.subdomainName,
|
|
7000
|
+
appName: "neetoInvoice",
|
|
7001
|
+
});
|
|
7002
|
+
await this.page.route(`**${ROUTES.neetoAps}`, async (route) => {
|
|
7003
|
+
headers = await route.request().allHeaders();
|
|
7004
|
+
await route.continue();
|
|
7005
|
+
});
|
|
7006
|
+
await expect(this.page.locator(COMMON_SELECTORS.spinner)).toBeHidden();
|
|
7007
|
+
const userCredentials = readFileSyncIfExists();
|
|
7008
|
+
await this.page.context().storageState({ path: STORAGE_STATE });
|
|
7009
|
+
const mergedCredentials = {
|
|
7010
|
+
...readFileSyncIfExists(),
|
|
7011
|
+
...userCredentials,
|
|
7012
|
+
headers,
|
|
7013
|
+
};
|
|
7014
|
+
writeDataToFile(JSON.stringify(mergedCredentials, null, 2));
|
|
7015
|
+
};
|
|
7016
|
+
this.updateSubdomainIfExists = async (appName) => {
|
|
7017
|
+
const subdomainError = this.page.getByTestId(SIGNUP_SELECTORS.subdomainError);
|
|
7018
|
+
let subdomainErrorCount = await subdomainError.count();
|
|
7019
|
+
if (subdomainErrorCount !== 0) {
|
|
7020
|
+
const subdomainErrorText = await subdomainError.innerText();
|
|
7021
|
+
const newOrganizationName = extractSubdomainFromError(subdomainErrorText);
|
|
7022
|
+
await this.page
|
|
7023
|
+
.getByTestId(SIGNUP_SELECTORS.subdomainNameTextField)
|
|
7024
|
+
.fill(newOrganizationName);
|
|
7025
|
+
await this.page.waitForResponse(response => response.url().includes(ROUTES.subdomainAvailability));
|
|
7026
|
+
subdomainErrorCount = await subdomainError.count();
|
|
7027
|
+
if (subdomainErrorCount === 0) {
|
|
7028
|
+
updateCredentials({
|
|
7029
|
+
key: "subdomainName",
|
|
7030
|
+
value: newOrganizationName,
|
|
7031
|
+
});
|
|
7032
|
+
updateCredentials({
|
|
7033
|
+
key: "businessName",
|
|
7034
|
+
value: newOrganizationName,
|
|
7035
|
+
});
|
|
7036
|
+
const newBaseUrl = `https://${newOrganizationName}.${appName}.net`;
|
|
7037
|
+
process.env.BASE_URL = newBaseUrl;
|
|
7038
|
+
await this.page
|
|
7039
|
+
.getByTestId(SIGNUP_SELECTORS.organizationNameTextField)
|
|
7040
|
+
.fill(newOrganizationName);
|
|
7041
|
+
}
|
|
7042
|
+
subdomainErrorCount = await subdomainError.count();
|
|
7043
|
+
if (subdomainErrorCount !== 0) {
|
|
7044
|
+
await this.updateSubdomainIfExists(appName);
|
|
7045
|
+
}
|
|
7046
|
+
}
|
|
7047
|
+
};
|
|
7048
|
+
this.page = page;
|
|
7049
|
+
this.neetoPlaywrightUtilities = neetoPlaywrightUtilities;
|
|
7050
|
+
}
|
|
7051
|
+
}
|
|
7052
|
+
|
|
7053
|
+
const LOGIN_SELECTORS = {
|
|
7054
|
+
appleAuthenticationButton: "apple-authentication-button",
|
|
7055
|
+
emailTextField: "login-email-text-field",
|
|
7056
|
+
googleAuthenticationButton: "google-authentication-button",
|
|
7057
|
+
githubAuthenticationButton: "github-authentication-button",
|
|
7058
|
+
loginViaEmailButton: "login-via-email-button",
|
|
7059
|
+
passwordTextField: "login-password-text-field",
|
|
7060
|
+
rememberMeCheckBox: "login-remember-me-check-box",
|
|
7061
|
+
submitButton: "login-submit-button",
|
|
7062
|
+
twitterAuthenticationButton: "twitter-authentication-button",
|
|
7063
|
+
};
|
|
7064
|
+
|
|
7065
|
+
const COMMON_TEXTS = { edit: "Edit" };
|
|
7066
|
+
|
|
7067
|
+
const initializeCredentials = () => {
|
|
7068
|
+
const { user } = readFileSyncIfExists();
|
|
7069
|
+
const newState = {
|
|
7070
|
+
...user,
|
|
7071
|
+
businessName: (user === null || user === void 0 ? void 0 : user.businessName) || stagingData.businessName,
|
|
7072
|
+
currentUserName: (user === null || user === void 0 ? void 0 : user.currentUserName) || stagingData.currentUserName,
|
|
7073
|
+
email: (user === null || user === void 0 ? void 0 : user.email) || stagingData.email,
|
|
7074
|
+
firstName: (user === null || user === void 0 ? void 0 : user.firstName) || stagingData.firstName,
|
|
7075
|
+
lastName: (user === null || user === void 0 ? void 0 : user.lastName) || stagingData.lastName,
|
|
7076
|
+
subdomainName: (user === null || user === void 0 ? void 0 : user.subdomainName) || stagingData.subdomainName,
|
|
7077
|
+
skipSetup: user === null || user === void 0 ? void 0 : user.skipSetup,
|
|
7078
|
+
};
|
|
7079
|
+
writeDataToFile(JSON.stringify({ user: newState }, null, 2));
|
|
7080
|
+
if (IS_STAGING_ENV) {
|
|
7081
|
+
const baseUrl = `https://${newState.subdomainName}.${stagingData.domain}`;
|
|
7082
|
+
process.env.BASE_URL = baseUrl;
|
|
7083
|
+
}
|
|
7084
|
+
};
|
|
7085
|
+
|
|
7086
|
+
const loginWithoutSSO = async ({ page, neetoPlaywrightUtilities, }) => {
|
|
7087
|
+
var _a;
|
|
7088
|
+
await page.goto((_a = process.env.BASE_URL) !== null && _a !== void 0 ? _a : "");
|
|
7089
|
+
let headers = {};
|
|
7090
|
+
await page.route(`**${ROUTES.login}`, async (route) => {
|
|
7091
|
+
headers = await route.request().allHeaders();
|
|
7092
|
+
await route.continue();
|
|
7093
|
+
});
|
|
7094
|
+
await page.getByTestId("login-email-text-field").fill(CREDENTIALS.email);
|
|
7095
|
+
await page
|
|
7096
|
+
.getByTestId("login-password-text-field")
|
|
7097
|
+
.fill(CREDENTIALS.password);
|
|
7098
|
+
const login = neetoPlaywrightUtilities.interceptMultipleResponses({
|
|
7099
|
+
times: 2,
|
|
7100
|
+
});
|
|
7101
|
+
await page.getByTestId(LOGIN_SELECTORS.submitButton).click();
|
|
7102
|
+
await login;
|
|
7103
|
+
const userCredentials = readFileSyncIfExists();
|
|
7104
|
+
await page.context().storageState({ path: STORAGE_STATE });
|
|
7105
|
+
const mergedCredentials = {
|
|
7106
|
+
...readFileSyncIfExists(),
|
|
7107
|
+
...userCredentials,
|
|
7108
|
+
headers,
|
|
7109
|
+
};
|
|
7110
|
+
writeDataToFile(JSON.stringify(mergedCredentials, null, 2));
|
|
7111
|
+
};
|
|
7112
|
+
const login = async ({ page, neetoPlaywrightUtilities }) => !IS_STAGING_ENV &&
|
|
7113
|
+
(await loginWithoutSSO({ page, neetoPlaywrightUtilities }));
|
|
7114
|
+
|
|
7115
|
+
var main$1 = {exports: {}};
|
|
7116
|
+
|
|
7117
|
+
var name = "dotenv";
|
|
7118
|
+
var version$1 = "16.3.1";
|
|
7119
|
+
var description = "Loads environment variables from .env file";
|
|
7120
|
+
var main = "lib/main.js";
|
|
7121
|
+
var types = "lib/main.d.ts";
|
|
7122
|
+
var exports = {
|
|
7123
|
+
".": {
|
|
7124
|
+
types: "./lib/main.d.ts",
|
|
7125
|
+
require: "./lib/main.js",
|
|
7126
|
+
"default": "./lib/main.js"
|
|
7127
|
+
},
|
|
7128
|
+
"./config": "./config.js",
|
|
7129
|
+
"./config.js": "./config.js",
|
|
7130
|
+
"./lib/env-options": "./lib/env-options.js",
|
|
7131
|
+
"./lib/env-options.js": "./lib/env-options.js",
|
|
7132
|
+
"./lib/cli-options": "./lib/cli-options.js",
|
|
7133
|
+
"./lib/cli-options.js": "./lib/cli-options.js",
|
|
7134
|
+
"./package.json": "./package.json"
|
|
7135
|
+
};
|
|
7136
|
+
var scripts = {
|
|
7137
|
+
"dts-check": "tsc --project tests/types/tsconfig.json",
|
|
7138
|
+
lint: "standard",
|
|
7139
|
+
"lint-readme": "standard-markdown",
|
|
7140
|
+
pretest: "npm run lint && npm run dts-check",
|
|
7141
|
+
test: "tap tests/*.js --100 -Rspec",
|
|
7142
|
+
prerelease: "npm test",
|
|
7143
|
+
release: "standard-version"
|
|
7144
|
+
};
|
|
7145
|
+
var repository = {
|
|
7146
|
+
type: "git",
|
|
7147
|
+
url: "git://github.com/motdotla/dotenv.git"
|
|
7148
|
+
};
|
|
7149
|
+
var funding = "https://github.com/motdotla/dotenv?sponsor=1";
|
|
7150
|
+
var keywords = [
|
|
7151
|
+
"dotenv",
|
|
7152
|
+
"env",
|
|
7153
|
+
".env",
|
|
7154
|
+
"environment",
|
|
7155
|
+
"variables",
|
|
7156
|
+
"config",
|
|
7157
|
+
"settings"
|
|
7158
|
+
];
|
|
7159
|
+
var readmeFilename = "README.md";
|
|
7160
|
+
var license = "BSD-2-Clause";
|
|
7161
|
+
var devDependencies = {
|
|
7162
|
+
"@definitelytyped/dtslint": "^0.0.133",
|
|
7163
|
+
"@types/node": "^18.11.3",
|
|
7164
|
+
decache: "^4.6.1",
|
|
7165
|
+
sinon: "^14.0.1",
|
|
7166
|
+
standard: "^17.0.0",
|
|
7167
|
+
"standard-markdown": "^7.1.0",
|
|
7168
|
+
"standard-version": "^9.5.0",
|
|
7169
|
+
tap: "^16.3.0",
|
|
7170
|
+
tar: "^6.1.11",
|
|
7171
|
+
typescript: "^4.8.4"
|
|
7172
|
+
};
|
|
7173
|
+
var engines = {
|
|
7174
|
+
node: ">=12"
|
|
7175
|
+
};
|
|
7176
|
+
var browser = {
|
|
7177
|
+
fs: false
|
|
7178
|
+
};
|
|
7179
|
+
var require$$4 = {
|
|
7180
|
+
name: name,
|
|
7181
|
+
version: version$1,
|
|
7182
|
+
description: description,
|
|
7183
|
+
main: main,
|
|
7184
|
+
types: types,
|
|
7185
|
+
exports: exports,
|
|
7186
|
+
scripts: scripts,
|
|
7187
|
+
repository: repository,
|
|
7188
|
+
funding: funding,
|
|
7189
|
+
keywords: keywords,
|
|
7190
|
+
readmeFilename: readmeFilename,
|
|
7191
|
+
license: license,
|
|
7192
|
+
devDependencies: devDependencies,
|
|
7193
|
+
engines: engines,
|
|
7194
|
+
browser: browser
|
|
7195
|
+
};
|
|
7196
|
+
|
|
7197
|
+
const fs = require$$0__default;
|
|
7198
|
+
const path = require$$0$1;
|
|
7199
|
+
const os = require$$2;
|
|
7200
|
+
const crypto = require$$3;
|
|
7201
|
+
const packageJson = require$$4;
|
|
7202
|
+
|
|
7203
|
+
const version = packageJson.version;
|
|
7204
|
+
|
|
7205
|
+
const LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;
|
|
7206
|
+
|
|
7207
|
+
// Parse src into an Object
|
|
7208
|
+
function parse (src) {
|
|
7209
|
+
const obj = {};
|
|
7210
|
+
|
|
7211
|
+
// Convert buffer to string
|
|
7212
|
+
let lines = src.toString();
|
|
7213
|
+
|
|
7214
|
+
// Convert line breaks to same format
|
|
7215
|
+
lines = lines.replace(/\r\n?/mg, '\n');
|
|
7216
|
+
|
|
7217
|
+
let match;
|
|
7218
|
+
while ((match = LINE.exec(lines)) != null) {
|
|
7219
|
+
const key = match[1];
|
|
7220
|
+
|
|
7221
|
+
// Default undefined or null to empty string
|
|
7222
|
+
let value = (match[2] || '');
|
|
7223
|
+
|
|
7224
|
+
// Remove whitespace
|
|
7225
|
+
value = value.trim();
|
|
7226
|
+
|
|
7227
|
+
// Check if double quoted
|
|
7228
|
+
const maybeQuote = value[0];
|
|
7229
|
+
|
|
7230
|
+
// Remove surrounding quotes
|
|
7231
|
+
value = value.replace(/^(['"`])([\s\S]*)\1$/mg, '$2');
|
|
7232
|
+
|
|
7233
|
+
// Expand newlines if double quoted
|
|
7234
|
+
if (maybeQuote === '"') {
|
|
7235
|
+
value = value.replace(/\\n/g, '\n');
|
|
7236
|
+
value = value.replace(/\\r/g, '\r');
|
|
7237
|
+
}
|
|
7238
|
+
|
|
7239
|
+
// Add to object
|
|
7240
|
+
obj[key] = value;
|
|
7241
|
+
}
|
|
7242
|
+
|
|
7243
|
+
return obj
|
|
7244
|
+
}
|
|
7245
|
+
|
|
7246
|
+
function _parseVault (options) {
|
|
7247
|
+
const vaultPath = _vaultPath(options);
|
|
7248
|
+
|
|
7249
|
+
// Parse .env.vault
|
|
7250
|
+
const result = DotenvModule.configDotenv({ path: vaultPath });
|
|
7251
|
+
if (!result.parsed) {
|
|
7252
|
+
throw new Error(`MISSING_DATA: Cannot parse ${vaultPath} for an unknown reason`)
|
|
7253
|
+
}
|
|
7254
|
+
|
|
7255
|
+
// handle scenario for comma separated keys - for use with key rotation
|
|
7256
|
+
// example: DOTENV_KEY="dotenv://:key_1234@dotenv.org/vault/.env.vault?environment=prod,dotenv://:key_7890@dotenv.org/vault/.env.vault?environment=prod"
|
|
7257
|
+
const keys = _dotenvKey(options).split(',');
|
|
7258
|
+
const length = keys.length;
|
|
7259
|
+
|
|
7260
|
+
let decrypted;
|
|
7261
|
+
for (let i = 0; i < length; i++) {
|
|
7262
|
+
try {
|
|
7263
|
+
// Get full key
|
|
7264
|
+
const key = keys[i].trim();
|
|
7265
|
+
|
|
7266
|
+
// Get instructions for decrypt
|
|
7267
|
+
const attrs = _instructions(result, key);
|
|
7268
|
+
|
|
7269
|
+
// Decrypt
|
|
7270
|
+
decrypted = DotenvModule.decrypt(attrs.ciphertext, attrs.key);
|
|
7271
|
+
|
|
7272
|
+
break
|
|
7273
|
+
} catch (error) {
|
|
7274
|
+
// last key
|
|
7275
|
+
if (i + 1 >= length) {
|
|
7276
|
+
throw error
|
|
7277
|
+
}
|
|
7278
|
+
// try next key
|
|
7279
|
+
}
|
|
7280
|
+
}
|
|
7281
|
+
|
|
7282
|
+
// Parse decrypted .env string
|
|
7283
|
+
return DotenvModule.parse(decrypted)
|
|
7284
|
+
}
|
|
7285
|
+
|
|
7286
|
+
function _log (message) {
|
|
7287
|
+
console.log(`[dotenv@${version}][INFO] ${message}`);
|
|
7288
|
+
}
|
|
7289
|
+
|
|
7290
|
+
function _warn (message) {
|
|
7291
|
+
console.log(`[dotenv@${version}][WARN] ${message}`);
|
|
7292
|
+
}
|
|
7293
|
+
|
|
7294
|
+
function _debug (message) {
|
|
7295
|
+
console.log(`[dotenv@${version}][DEBUG] ${message}`);
|
|
7296
|
+
}
|
|
7297
|
+
|
|
7298
|
+
function _dotenvKey (options) {
|
|
7299
|
+
// prioritize developer directly setting options.DOTENV_KEY
|
|
7300
|
+
if (options && options.DOTENV_KEY && options.DOTENV_KEY.length > 0) {
|
|
7301
|
+
return options.DOTENV_KEY
|
|
7302
|
+
}
|
|
7303
|
+
|
|
7304
|
+
// secondary infra already contains a DOTENV_KEY environment variable
|
|
7305
|
+
if (process.env.DOTENV_KEY && process.env.DOTENV_KEY.length > 0) {
|
|
7306
|
+
return process.env.DOTENV_KEY
|
|
7307
|
+
}
|
|
7308
|
+
|
|
7309
|
+
// fallback to empty string
|
|
7310
|
+
return ''
|
|
7311
|
+
}
|
|
7312
|
+
|
|
7313
|
+
function _instructions (result, dotenvKey) {
|
|
7314
|
+
// Parse DOTENV_KEY. Format is a URI
|
|
7315
|
+
let uri;
|
|
7316
|
+
try {
|
|
7317
|
+
uri = new URL(dotenvKey);
|
|
7318
|
+
} catch (error) {
|
|
7319
|
+
if (error.code === 'ERR_INVALID_URL') {
|
|
7320
|
+
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')
|
|
7321
|
+
}
|
|
7322
|
+
|
|
7323
|
+
throw error
|
|
7324
|
+
}
|
|
7325
|
+
|
|
7326
|
+
// Get decrypt key
|
|
7327
|
+
const key = uri.password;
|
|
7328
|
+
if (!key) {
|
|
7329
|
+
throw new Error('INVALID_DOTENV_KEY: Missing key part')
|
|
7330
|
+
}
|
|
7331
|
+
|
|
7332
|
+
// Get environment
|
|
7333
|
+
const environment = uri.searchParams.get('environment');
|
|
7334
|
+
if (!environment) {
|
|
7335
|
+
throw new Error('INVALID_DOTENV_KEY: Missing environment part')
|
|
7336
|
+
}
|
|
7337
|
+
|
|
7338
|
+
// Get ciphertext payload
|
|
7339
|
+
const environmentKey = `DOTENV_VAULT_${environment.toUpperCase()}`;
|
|
7340
|
+
const ciphertext = result.parsed[environmentKey]; // DOTENV_VAULT_PRODUCTION
|
|
7341
|
+
if (!ciphertext) {
|
|
7342
|
+
throw new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${environmentKey} in your .env.vault file.`)
|
|
7343
|
+
}
|
|
7344
|
+
|
|
7345
|
+
return { ciphertext, key }
|
|
7346
|
+
}
|
|
7347
|
+
|
|
7348
|
+
function _vaultPath (options) {
|
|
7349
|
+
let dotenvPath = path.resolve(process.cwd(), '.env');
|
|
7350
|
+
|
|
7351
|
+
if (options && options.path && options.path.length > 0) {
|
|
7352
|
+
dotenvPath = options.path;
|
|
7353
|
+
}
|
|
7354
|
+
|
|
7355
|
+
// Locate .env.vault
|
|
7356
|
+
return dotenvPath.endsWith('.vault') ? dotenvPath : `${dotenvPath}.vault`
|
|
7357
|
+
}
|
|
7358
|
+
|
|
7359
|
+
function _resolveHome (envPath) {
|
|
7360
|
+
return envPath[0] === '~' ? path.join(os.homedir(), envPath.slice(1)) : envPath
|
|
7361
|
+
}
|
|
7362
|
+
|
|
7363
|
+
function _configVault (options) {
|
|
7364
|
+
_log('Loading env from encrypted .env.vault');
|
|
7365
|
+
|
|
7366
|
+
const parsed = DotenvModule._parseVault(options);
|
|
7367
|
+
|
|
7368
|
+
let processEnv = process.env;
|
|
7369
|
+
if (options && options.processEnv != null) {
|
|
7370
|
+
processEnv = options.processEnv;
|
|
7371
|
+
}
|
|
7372
|
+
|
|
7373
|
+
DotenvModule.populate(processEnv, parsed, options);
|
|
7374
|
+
|
|
7375
|
+
return { parsed }
|
|
7376
|
+
}
|
|
7377
|
+
|
|
7378
|
+
function configDotenv (options) {
|
|
7379
|
+
let dotenvPath = path.resolve(process.cwd(), '.env');
|
|
7380
|
+
let encoding = 'utf8';
|
|
7381
|
+
const debug = Boolean(options && options.debug);
|
|
7382
|
+
|
|
7383
|
+
if (options) {
|
|
7384
|
+
if (options.path != null) {
|
|
7385
|
+
dotenvPath = _resolveHome(options.path);
|
|
7386
|
+
}
|
|
7387
|
+
if (options.encoding != null) {
|
|
7388
|
+
encoding = options.encoding;
|
|
7389
|
+
}
|
|
7390
|
+
}
|
|
7391
|
+
|
|
7392
|
+
try {
|
|
7393
|
+
// Specifying an encoding returns a string instead of a buffer
|
|
7394
|
+
const parsed = DotenvModule.parse(fs.readFileSync(dotenvPath, { encoding }));
|
|
7395
|
+
|
|
7396
|
+
let processEnv = process.env;
|
|
7397
|
+
if (options && options.processEnv != null) {
|
|
7398
|
+
processEnv = options.processEnv;
|
|
7399
|
+
}
|
|
7400
|
+
|
|
7401
|
+
DotenvModule.populate(processEnv, parsed, options);
|
|
7402
|
+
|
|
7403
|
+
return { parsed }
|
|
7404
|
+
} catch (e) {
|
|
7405
|
+
if (debug) {
|
|
7406
|
+
_debug(`Failed to load ${dotenvPath} ${e.message}`);
|
|
7407
|
+
}
|
|
7408
|
+
|
|
7409
|
+
return { error: e }
|
|
7410
|
+
}
|
|
7411
|
+
}
|
|
7412
|
+
|
|
7413
|
+
// Populates process.env from .env file
|
|
7414
|
+
function config (options) {
|
|
7415
|
+
const vaultPath = _vaultPath(options);
|
|
7416
|
+
|
|
7417
|
+
// fallback to original dotenv if DOTENV_KEY is not set
|
|
7418
|
+
if (_dotenvKey(options).length === 0) {
|
|
7419
|
+
return DotenvModule.configDotenv(options)
|
|
7420
|
+
}
|
|
7421
|
+
|
|
7422
|
+
// dotenvKey exists but .env.vault file does not exist
|
|
7423
|
+
if (!fs.existsSync(vaultPath)) {
|
|
7424
|
+
_warn(`You set DOTENV_KEY but you are missing a .env.vault file at ${vaultPath}. Did you forget to build it?`);
|
|
7425
|
+
|
|
7426
|
+
return DotenvModule.configDotenv(options)
|
|
7427
|
+
}
|
|
7428
|
+
|
|
7429
|
+
return DotenvModule._configVault(options)
|
|
7430
|
+
}
|
|
7431
|
+
|
|
7432
|
+
function decrypt (encrypted, keyStr) {
|
|
7433
|
+
const key = Buffer.from(keyStr.slice(-64), 'hex');
|
|
7434
|
+
let ciphertext = Buffer.from(encrypted, 'base64');
|
|
7435
|
+
|
|
7436
|
+
const nonce = ciphertext.slice(0, 12);
|
|
7437
|
+
const authTag = ciphertext.slice(-16);
|
|
7438
|
+
ciphertext = ciphertext.slice(12, -16);
|
|
7439
|
+
|
|
7440
|
+
try {
|
|
7441
|
+
const aesgcm = crypto.createDecipheriv('aes-256-gcm', key, nonce);
|
|
7442
|
+
aesgcm.setAuthTag(authTag);
|
|
7443
|
+
return `${aesgcm.update(ciphertext)}${aesgcm.final()}`
|
|
7444
|
+
} catch (error) {
|
|
7445
|
+
const isRange = error instanceof RangeError;
|
|
7446
|
+
const invalidKeyLength = error.message === 'Invalid key length';
|
|
7447
|
+
const decryptionFailed = error.message === 'Unsupported state or unable to authenticate data';
|
|
7448
|
+
|
|
7449
|
+
if (isRange || invalidKeyLength) {
|
|
7450
|
+
const msg = 'INVALID_DOTENV_KEY: It must be 64 characters long (or more)';
|
|
7451
|
+
throw new Error(msg)
|
|
7452
|
+
} else if (decryptionFailed) {
|
|
7453
|
+
const msg = 'DECRYPTION_FAILED: Please check your DOTENV_KEY';
|
|
7454
|
+
throw new Error(msg)
|
|
7455
|
+
} else {
|
|
7456
|
+
console.error('Error: ', error.code);
|
|
7457
|
+
console.error('Error: ', error.message);
|
|
7458
|
+
throw error
|
|
7459
|
+
}
|
|
7460
|
+
}
|
|
7461
|
+
}
|
|
7462
|
+
|
|
7463
|
+
// Populate process.env with parsed values
|
|
7464
|
+
function populate (processEnv, parsed, options = {}) {
|
|
7465
|
+
const debug = Boolean(options && options.debug);
|
|
7466
|
+
const override = Boolean(options && options.override);
|
|
7467
|
+
|
|
7468
|
+
if (typeof parsed !== 'object') {
|
|
7469
|
+
throw new Error('OBJECT_REQUIRED: Please check the processEnv argument being passed to populate')
|
|
7470
|
+
}
|
|
7471
|
+
|
|
7472
|
+
// Set process.env
|
|
7473
|
+
for (const key of Object.keys(parsed)) {
|
|
7474
|
+
if (Object.prototype.hasOwnProperty.call(processEnv, key)) {
|
|
7475
|
+
if (override === true) {
|
|
7476
|
+
processEnv[key] = parsed[key];
|
|
7477
|
+
}
|
|
7478
|
+
|
|
7479
|
+
if (debug) {
|
|
7480
|
+
if (override === true) {
|
|
7481
|
+
_debug(`"${key}" is already defined and WAS overwritten`);
|
|
7482
|
+
} else {
|
|
7483
|
+
_debug(`"${key}" is already defined and was NOT overwritten`);
|
|
7484
|
+
}
|
|
7485
|
+
}
|
|
7486
|
+
} else {
|
|
7487
|
+
processEnv[key] = parsed[key];
|
|
7488
|
+
}
|
|
7489
|
+
}
|
|
7490
|
+
}
|
|
7491
|
+
|
|
7492
|
+
const DotenvModule = {
|
|
7493
|
+
configDotenv,
|
|
7494
|
+
_configVault,
|
|
7495
|
+
_parseVault,
|
|
7496
|
+
config,
|
|
7497
|
+
decrypt,
|
|
7498
|
+
parse,
|
|
7499
|
+
populate
|
|
7500
|
+
};
|
|
7501
|
+
|
|
7502
|
+
main$1.exports.configDotenv = DotenvModule.configDotenv;
|
|
7503
|
+
main$1.exports._configVault = DotenvModule._configVault;
|
|
7504
|
+
main$1.exports._parseVault = DotenvModule._parseVault;
|
|
7505
|
+
main$1.exports.config = DotenvModule.config;
|
|
7506
|
+
main$1.exports.decrypt = DotenvModule.decrypt;
|
|
7507
|
+
main$1.exports.parse = DotenvModule.parse;
|
|
7508
|
+
main$1.exports.populate = DotenvModule.populate;
|
|
7509
|
+
|
|
7510
|
+
main$1.exports = DotenvModule;
|
|
6951
7511
|
|
|
6952
7512
|
// @ts-check
|
|
6953
7513
|
var _a, _b;
|
|
6954
|
-
|
|
6955
|
-
const dotenv = require("dotenv");
|
|
6956
|
-
dotenv.config({
|
|
7514
|
+
main$1.exports.config({
|
|
6957
7515
|
path: `./e2e/config/.env.${(_a = process.env.TEST_ENV) !== null && _a !== void 0 ? _a : "development"}`,
|
|
6958
7516
|
});
|
|
6959
7517
|
const storageState = "./e2e/auth/user.json";
|
|
@@ -6968,7 +7526,7 @@ const definePlaywrightConfig = (overrides) => {
|
|
|
6968
7526
|
const { globalOverrides = {}, useOverrides = {}, projectOverrides = [], currentsOverrides = {}, } = overrides;
|
|
6969
7527
|
return defineConfig({
|
|
6970
7528
|
testDir: "./e2e/tests",
|
|
6971
|
-
fullyParallel:
|
|
7529
|
+
fullyParallel: true,
|
|
6972
7530
|
forbidOnly: isCI,
|
|
6973
7531
|
retries: isCI ? 1 : 0,
|
|
6974
7532
|
timeout: 0,
|
|
@@ -7002,5 +7560,5 @@ const definePlaywrightConfig = (overrides) => {
|
|
|
7002
7560
|
});
|
|
7003
7561
|
};
|
|
7004
7562
|
|
|
7005
|
-
export {
|
|
7563
|
+
export { COMMON_SELECTORS, COMMON_TEXTS, CREDENTIALS, CustomCommands, ENVIRONMENT, GLOBAL_TRANSLATIONS_PATTERN, IS_STAGING_ENV, LOGIN_SELECTORS, OrganizationPage, PROJECT_TRANSLATIONS_PATH, ROUTES, SIGNUP_SELECTORS, STORAGE_STATE, clearCredentials, commands, definePlaywrightConfig, i18n, initializeCredentials, joinString, login, loginWithoutSSO, readFileSyncIfExists, readTranslations, stagingData, updateCredentials, writeDataToFile };
|
|
7006
7564
|
//# sourceMappingURL=index.js.map
|