@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/index.js CHANGED
@@ -1,31 +1,14 @@
1
- import * as fs$8 from 'fs';
1
+ import { expect, defineConfig, devices } from '@playwright/test';
2
+ import * as fs$9 from 'fs';
2
3
  import fs__default from 'fs';
3
- import require$$0 from 'os';
4
- import require$$0$1 from 'path';
5
- import require$$0$2 from 'util';
6
- import require$$0$3 from 'stream';
7
- import require$$0$4 from 'events';
4
+ import require$$2 from 'os';
5
+ import require$$0 from 'path';
6
+ import require$$0$1 from 'util';
7
+ import require$$0$2 from 'stream';
8
+ import require$$0$3 from 'events';
8
9
  import { mergeDeepLeft } from 'ramda';
9
10
  import dayjs from 'dayjs';
10
- import { expect, test as test$1 } from '@playwright/test';
11
-
12
- const ENVIRONMENT = {
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`;
11
+ import require$$3 from 'crypto';
29
12
 
30
13
  const COMMON_SELECTORS$1 = {
31
14
  toastMessage: "toastr-message-container",
@@ -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$7 = {};
65
+ var fs$8 = {};
98
66
 
99
- Object.defineProperty(fs$7, "__esModule", { value: true });
100
- fs$7.createDirentFromStats = void 0;
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$7.createDirentFromStats = createDirentFromStats$1;
84
+ fs$8.createDirentFromStats = createDirentFromStats$1;
117
85
 
118
- var path$9 = {};
86
+ var path$a = {};
119
87
 
120
- Object.defineProperty(path$9, "__esModule", { value: true });
121
- path$9.convertPosixPathToPattern = path$9.convertWindowsPathToPattern = path$9.convertPathToPattern = path$9.escapePosixPath = path$9.escapeWindowsPath = path$9.escape = path$9.removeLeadingDotSegment = path$9.makeAbsolute = path$9.unixify = void 0;
122
- const os = require$$0;
123
- const path$8 = require$$0$1;
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;
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$9.unixify = unixify;
118
+ path$a.unixify = unixify;
151
119
  function makeAbsolute(cwd, filepath) {
152
- return path$8.resolve(cwd, filepath);
120
+ return path$9.resolve(cwd, filepath);
153
121
  }
154
- path$9.makeAbsolute = makeAbsolute;
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$9.removeLeadingDotSegment = removeLeadingDotSegment;
167
- path$9.escape = IS_WINDOWS_PLATFORM ? escapeWindowsPath : escapePosixPath;
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$9.escapeWindowsPath = escapeWindowsPath;
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$9.escapePosixPath = escapePosixPath;
176
- path$9.convertPathToPattern = IS_WINDOWS_PLATFORM ? convertWindowsPathToPattern : convertPosixPathToPattern;
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$9.convertWindowsPathToPattern = convertWindowsPathToPattern;
150
+ path$a.convertWindowsPathToPattern = convertWindowsPathToPattern;
183
151
  function convertPosixPathToPattern(filepath) {
184
152
  return escapePosixPath(filepath);
185
153
  }
186
- path$9.convertPosixPathToPattern = convertPosixPathToPattern;
154
+ path$a.convertPosixPathToPattern = convertPosixPathToPattern;
187
155
 
188
156
  var pattern$1 = {};
189
157
 
@@ -360,8 +328,8 @@ var isGlob$1 = function isGlob(str, options) {
360
328
  };
361
329
 
362
330
  var isGlob = isGlob$1;
363
- var pathPosixDirname = require$$0$1.posix.dirname;
364
- var isWin32 = require$$0.platform() === 'win32';
331
+ var pathPosixDirname = require$$0.posix.dirname;
332
+ var isWin32 = require$$2.platform() === 'win32';
365
333
 
366
334
  var slash = '/';
367
335
  var backslash = /\\/g;
@@ -857,7 +825,7 @@ var toRegexRange_1 = toRegexRange$1;
857
825
  * Licensed under the MIT License.
858
826
  */
859
827
 
860
- const util$1 = require$$0$2;
828
+ const util$1 = require$$0$1;
861
829
  const toRegexRange = toRegexRange_1;
862
830
 
863
831
  const isObject$1 = val => val !== null && typeof val === 'object' && !Array.isArray(val);
@@ -1350,7 +1318,7 @@ const {
1350
1318
  * parse
1351
1319
  */
1352
1320
 
1353
- const parse$3 = (input, options = {}) => {
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$3;
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$2 = parse_1$1;
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$2(input, options);
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$7 = require$$0$1;
1795
+ const path$8 = require$$0;
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$7.sep,
1948
+ SEP: path$8.sep,
1981
1949
 
1982
1950
  /**
1983
1951
  * Create EXTGLOB_CHARS
@@ -2004,7 +1972,7 @@ var constants$3 = {
2004
1972
 
2005
1973
  (function (exports) {
2006
1974
 
2007
- const path = require$$0$1;
1975
+ const path = require$$0;
2008
1976
  const win32 = process.platform === 'win32';
2009
1977
  const {
2010
1978
  REGEX_BACKSLASH,
@@ -2510,7 +2478,7 @@ const syntaxError = (type, char) => {
2510
2478
  * @return {Object}
2511
2479
  */
2512
2480
 
2513
- const parse$1 = (input, options) => {
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$1(rest, { ...options, fastpaths: false }).output;
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$1.fastpaths = (input, options) => {
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$1;
3517
+ var parse_1 = parse$2;
3550
3518
 
3551
- const path$6 = require$$0$1;
3519
+ const path$7 = require$$0;
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$6.basename(input));
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);
@@ -3894,7 +3862,7 @@ var picomatch_1 = picomatch$1;
3894
3862
  module.exports = picomatch_1;
3895
3863
  } (picomatch$2));
3896
3864
 
3897
- const util = require$$0$2;
3865
+ const util = require$$0$1;
3898
3866
  const braces = braces_1;
3899
3867
  const picomatch = picomatch$2.exports;
3900
3868
  const utils$b = utils$f;
@@ -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$5 = require$$0$1;
4333
+ const path$6 = require$$0;
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$5.basename(pattern);
4455
+ const basename = path$6.basename(pattern);
4488
4456
  return endsWithSlashGlobStar(pattern) || isStaticPattern(basename);
4489
4457
  }
4490
4458
  pattern$1.isAffectDepthOfReadingPattern = isAffectDepthOfReadingPattern;
@@ -4557,7 +4525,7 @@ var stream$4 = {};
4557
4525
  * Copyright (c) 2014-2020 Teambition
4558
4526
  * Licensed under the MIT license.
4559
4527
  */
4560
- const Stream = require$$0$3;
4528
+ const Stream = require$$0$2;
4561
4529
  const PassThrough = Stream.PassThrough;
4562
4530
  const slice = Array.prototype.slice;
4563
4531
 
@@ -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$6 = fs$7;
4734
- utils$k.fs = fs$6;
4735
- const path$4 = path$9;
4736
- utils$k.path = path$4;
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,7 +4900,7 @@ sync$7.read = read$2;
4932
4900
 
4933
4901
  var settings$3 = {};
4934
4902
 
4935
- var fs$5 = {};
4903
+ var fs$6 = {};
4936
4904
 
4937
4905
  (function (exports) {
4938
4906
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -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$5));
4922
+ } (fs$6));
4955
4923
 
4956
4924
  Object.defineProperty(settings$3, "__esModule", { value: true });
4957
- const fs$4 = fs$5;
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$4.createFileSystemAdapter(this._options.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$3 = {};
5051
+ var fs$4 = {};
5084
5052
 
5085
- Object.defineProperty(fs$3, "__esModule", { value: true });
5086
- fs$3.createDirentFromStats = void 0;
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$3.createDirentFromStats = createDirentFromStats;
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$2 = fs$3;
5107
- utils$9.fs = fs$2;
5074
+ const fs$3 = fs$4;
5075
+ utils$9.fs = fs$3;
5108
5076
 
5109
5077
  var common$6 = {};
5110
5078
 
@@ -5283,7 +5251,7 @@ sync$5.readdir = readdir;
5283
5251
 
5284
5252
  var settings$2 = {};
5285
5253
 
5286
- var fs$1 = {};
5254
+ var fs$2 = {};
5287
5255
 
5288
5256
  (function (exports) {
5289
5257
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -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$1));
5275
+ } (fs$2));
5308
5276
 
5309
5277
  Object.defineProperty(settings$2, "__esModule", { value: true });
5310
- const path$3 = require$$0$1;
5278
+ const path$4 = require$$0;
5311
5279
  const fsStat$3 = out$1;
5312
- const fs = fs$1;
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$3.sep);
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({
@@ -5725,7 +5693,7 @@ class Reader$1 {
5725
5693
  reader$1.default = Reader$1;
5726
5694
 
5727
5695
  Object.defineProperty(async$4, "__esModule", { value: true });
5728
- const events_1 = require$$0$4;
5696
+ const events_1 = require$$0$3;
5729
5697
  const fsScandir$2 = out$2;
5730
5698
  const fastq = queue.exports;
5731
5699
  const common$1 = common$3;
@@ -5854,7 +5822,7 @@ function callSuccessCallback(callback, entries) {
5854
5822
  var stream$2 = {};
5855
5823
 
5856
5824
  Object.defineProperty(stream$2, "__esModule", { value: true });
5857
- const stream_1$5 = require$$0$3;
5825
+ const stream_1$5 = require$$0$2;
5858
5826
  const async_1$3 = async$4;
5859
5827
  class StreamProvider {
5860
5828
  constructor(_root, _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$2 = require$$0$1;
5938
+ const path$3 = require$$0;
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$2.sep);
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$1 = require$$0$1;
6000
+ const path$2 = require$$0;
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$1.resolve(this._settings.cwd, filepath);
6013
+ return path$2.resolve(this._settings.cwd, filepath);
6046
6014
  }
6047
6015
  _makeEntry(stats, pattern) {
6048
6016
  const entry = {
@@ -6064,7 +6032,7 @@ reader.default = Reader;
6064
6032
  var stream$1 = {};
6065
6033
 
6066
6034
  Object.defineProperty(stream$1, "__esModule", { value: true });
6067
- const stream_1$3 = require$$0$3;
6035
+ const stream_1$3 = require$$0$2;
6068
6036
  const fsStat$1 = out$1;
6069
6037
  const fsWalk$2 = out$3;
6070
6038
  const reader_1$2 = reader;
@@ -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;
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;
@@ -6490,7 +6458,7 @@ async$7.default = ProviderAsync;
6490
6458
  var stream = {};
6491
6459
 
6492
6460
  Object.defineProperty(stream, "__esModule", { value: true });
6493
- const stream_1$1 = require$$0$3;
6461
+ const stream_1$1 = require$$0$2;
6494
6462
  const stream_2 = stream$1;
6495
6463
  const provider_1$1 = provider;
6496
6464
  class ProviderStream extends provider_1$1.default {
@@ -6596,7 +6564,7 @@ var settings = {};
6596
6564
  Object.defineProperty(exports, "__esModule", { value: true });
6597
6565
  exports.DEFAULT_FILE_SYSTEM_ADAPTER = void 0;
6598
6566
  const fs = fs__default;
6599
- const os = require$$0;
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,109 +6721,12 @@ function assertPatternsInput(input) {
6753
6721
  }
6754
6722
  var out = FastGlob;
6755
6723
 
6756
- const joinString = (string1, string2, string3 = "", separator = " ") => {
6757
- if (string3 === "") {
6758
- return string1 + separator + string2;
6759
- }
6760
- return string1 + separator + string2 + separator + string3;
6761
- };
6762
- const readFileSyncIfExists$1 = (path = STORAGE_STATE$1) => {
6763
- try {
6764
- return JSON.parse(fs$8.readFileSync(path, "utf8"));
6765
- }
6766
- catch (error) {
6767
- return {};
6768
- }
6769
- };
6770
- const writeDataToFile = data => {
6771
- try {
6772
- fs$8.writeFileSync(STORAGE_STATE$1, data, "utf8");
6773
- }
6774
- catch (error) {
6775
- console.log(error); // eslint-disable-line
6776
- }
6777
- return true;
6778
- };
6779
- const updateCredentials = ({ key, value }) => {
6780
- const data = readFileSyncIfExists$1();
6781
- data["user"][key] = value;
6782
- return writeDataToFile(JSON.stringify(data));
6783
- };
6784
- const clearCredentials = () => {
6785
- fs$8.unlink(STORAGE_STATE$1, error => {
6786
- if (!error)
6787
- return;
6788
- console.log(error); // eslint-disable-line
6789
- });
6790
- };
6791
- const readTranslations = () => {
6792
- let translations = readFileSyncIfExists$1(PROJECT_TRANSLATIONS_PATH);
6793
- const paths = out.sync(GLOBAL_TRANSLATIONS_PATTERN);
6794
- paths.forEach(path => {
6795
- const packageTranslation = readFileSyncIfExists$1(path);
6796
- translations = mergeDeepLeft(translations, packageTranslation);
6797
- });
6798
- return translations;
6799
- };
6800
-
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
6724
  process.env.TEST_ENV === "staging";
6854
- const STORAGE_STATE = "./e2e/auth/user.json";
6725
+ const STORAGE_STATE$1 = "./e2e/auth/user.json";
6855
6726
 
6856
- const readFileSyncIfExists = (path = STORAGE_STATE) => {
6727
+ const readFileSyncIfExists$1 = (path = STORAGE_STATE$1) => {
6857
6728
  try {
6858
- return JSON.parse(fs$8.readFileSync(path, "utf8"));
6729
+ return JSON.parse(fs$9.readFileSync(path, "utf8"));
6859
6730
  }
6860
6731
  catch (error) {
6861
6732
  return {};
@@ -6893,13 +6764,13 @@ class CustomCommands {
6893
6764
  };
6894
6765
  this.verifySuccessToast = async ({ message, closeAfterVerification = true, }) => {
6895
6766
  if (message) {
6896
- await expect(this.page.getByTestId(COMMON_SELECTORS.toastMessage)).toHaveValue(message);
6767
+ await expect(this.page.getByTestId(COMMON_SELECTORS$1.toastMessage)).toHaveValue(message);
6897
6768
  }
6898
6769
  else {
6899
- await expect(this.page.locator(COMMON_SELECTORS.toastIcon)).toHaveValue("👍");
6770
+ await expect(this.page.locator(COMMON_SELECTORS$1.toastIcon)).toHaveValue("👍");
6900
6771
  closeAfterVerification &&
6901
6772
  (await this.page
6902
- .getByTestId(COMMON_SELECTORS.toastCloseButton)
6773
+ .getByTestId(COMMON_SELECTORS$1.toastCloseButton)
6903
6774
  .click());
6904
6775
  }
6905
6776
  };
@@ -6911,7 +6782,7 @@ class CustomCommands {
6911
6782
  await reloadRequests;
6912
6783
  };
6913
6784
  this.apiRequest = async ({ url, headers: additionalHeaders, body: data, method = "get", params = {}, ...otherOptions }) => {
6914
- const { headers } = readFileSyncIfExists();
6785
+ const { headers } = readFileSyncIfExists$1();
6915
6786
  const requestOptions = {
6916
6787
  headers: { ...headers, ...additionalHeaders, "accept-encoding": "gzip" },
6917
6788
  data,
@@ -6937,7 +6808,7 @@ class CustomCommands {
6937
6808
  }
6938
6809
  }
6939
6810
 
6940
- const test = test$1.extend({
6811
+ const commands = {
6941
6812
  neetoPlaywrightUtilities: async ({ page, request }, use) => {
6942
6813
  const commands = new CustomCommands(page, request);
6943
6814
  await use(commands);
@@ -6947,13 +6818,723 @@ const test = test$1.extend({
6947
6818
  await page.waitForLoadState("load");
6948
6819
  await use(page);
6949
6820
  },
6950
- });
6821
+ };
6822
+
6823
+ const ENVIRONMENT = {
6824
+ development: "development",
6825
+ staging: "staging",
6826
+ review: "review",
6827
+ };
6828
+ const IS_STAGING_ENV = process.env.TEST_ENV === "staging";
6829
+ const STORAGE_STATE = "./e2e/auth/user.json";
6830
+ const GLOBAL_TRANSLATIONS_PATTERN = "../node_modules/@bigbinary/**/translations/en.json";
6831
+ const PROJECT_TRANSLATIONS_PATH = "../app/javascript/src/translations/en.json";
6832
+ const CREDENTIALS = { email: "oliver@example.com", password: "welcome" };
6833
+
6834
+ const joinString = (string1, string2, string3 = "", separator = " ") => {
6835
+ if (string3 === "") {
6836
+ return string1 + separator + string2;
6837
+ }
6838
+ return string1 + separator + string2 + separator + string3;
6839
+ };
6840
+ const readFileSyncIfExists = (path = STORAGE_STATE) => {
6841
+ try {
6842
+ return JSON.parse(fs$9.readFileSync(path, "utf8"));
6843
+ }
6844
+ catch (error) {
6845
+ return {};
6846
+ }
6847
+ };
6848
+ const writeDataToFile = data => {
6849
+ try {
6850
+ fs$9.writeFileSync(STORAGE_STATE, data, "utf8");
6851
+ }
6852
+ catch (error) {
6853
+ console.log(error); // eslint-disable-line
6854
+ }
6855
+ return true;
6856
+ };
6857
+ const updateCredentials = ({ key, value }) => {
6858
+ const data = readFileSyncIfExists();
6859
+ data["user"][key] = value;
6860
+ return writeDataToFile(JSON.stringify(data));
6861
+ };
6862
+ const clearCredentials = () => {
6863
+ fs$9.unlink(STORAGE_STATE, error => {
6864
+ if (!error)
6865
+ return;
6866
+ console.log(error); // eslint-disable-line
6867
+ });
6868
+ };
6869
+ const readTranslations = () => {
6870
+ let translations = readFileSyncIfExists(PROJECT_TRANSLATIONS_PATH);
6871
+ const paths = out.sync(GLOBAL_TRANSLATIONS_PATTERN);
6872
+ paths.forEach(path => {
6873
+ const packageTranslation = readFileSyncIfExists(path);
6874
+ translations = mergeDeepLeft(translations, packageTranslation);
6875
+ });
6876
+ return translations;
6877
+ };
6878
+
6879
+ const timestamp = dayjs().format("YYYYMMDDHH");
6880
+ const firstName = "André";
6881
+ const lastName = "O'Reilly";
6882
+ const stagingOrganization = `cypresstest-invoice-${timestamp}`;
6883
+ const otpBypassKey = process.env.OTP_BYPASS_KEY;
6884
+ const stagingData = {
6885
+ firstName,
6886
+ lastName,
6887
+ otp: 111111,
6888
+ domain: "neetoinvoice.net",
6889
+ currentUserName: IS_STAGING_ENV
6890
+ ? joinString(firstName, lastName)
6891
+ : "Oliver Smith",
6892
+ businessName: stagingOrganization,
6893
+ subdomainName: IS_STAGING_ENV ? stagingOrganization : "spinkart",
6894
+ email: IS_STAGING_ENV
6895
+ ? `cypresstest${otpBypassKey}+invoice+${timestamp}@bigbinary.com`
6896
+ : "oliver@example.com",
6897
+ };
6898
+
6899
+ const i18n = {
6900
+ // i18n configuration options
6901
+ options: {
6902
+ debug: false,
6903
+ fallbackLng: "en",
6904
+ resources: { en: { translation: readTranslations() } },
6905
+ },
6906
+ // Fetch translations in every test or fetch once
6907
+ // Default: true
6908
+ cache: true,
6909
+ // Run as auto fixture to be available through all tests by getI18nInstance()
6910
+ // Default: true
6911
+ auto: true,
6912
+ };
6913
+
6914
+ const BASE_URL = "/api/v1";
6915
+ const PROFILE_PATH = "/profile";
6916
+ const NEETO_AUTH_URL = "https://app.neetoauth.net";
6917
+ const LOGIN_PATH = `${BASE_URL}/login`;
6918
+ const SIGNUP_PATH = `${BASE_URL}/signups`;
6919
+ const SUBDOMAIN_AVAILABILITY_PATH = `${BASE_URL}/subdomain_availability`;
6920
+ const COUNTRIES_PATH = `${BASE_URL}/countries`;
6921
+ const NEETO_APPS_PATH = `${BASE_URL}/neeto_apps`;
6922
+
6923
+ const COMMON_SELECTORS = {
6924
+ toastMessage: "toastr-message-container",
6925
+ toastIcon: ".Toastify__toast-icon",
6926
+ toastCloseButton: "toastr-close-button",
6927
+ dropdownIcon: "nui-dropdown-icon",
6928
+ checkbox: "nui-checkbox-input",
6929
+ spinner: ".neeto-ui-spinner",
6930
+ input: "nui-input-field",
6931
+ alertModalSubmitButton: "alert-submit-button",
6932
+ selectContainer: "nui-select-container",
6933
+ subheaderText: "subheader-left",
6934
+ };
6935
+
6936
+ const SIGNUP_SELECTORS = {
6937
+ emailTextField: "signup-email-text-field",
6938
+ firstNameTextField: "signup-profile-first-name-text-field",
6939
+ lastNameTextField: "signup-profile-last-name-text-field",
6940
+ organizationNameTextField: "signup-organization-name-text-field",
6941
+ organizationSubmitButton: "signup-organization-submit-button",
6942
+ otpTextBox: "otpinput-otp-number",
6943
+ profileSubmitButton: "signup-profile-submit-button",
6944
+ signupViaEmailButton: "signup-via-email-button",
6945
+ submitButton: "signup-email-submit-button",
6946
+ subdomainNameTextField: "signup-organization-subdomain-text-field",
6947
+ subdomainError: "subdomain-input-error",
6948
+ tryFreeButton: "neeto-auth-signup-link",
6949
+ };
6950
+
6951
+ const extractSubdomainFromError = (errorString) => {
6952
+ const regex = /cypresstest[a-zA-Z0-9-]+/g;
6953
+ const matches = errorString.match(regex);
6954
+ return matches[1];
6955
+ };
6956
+
6957
+ class OrganizationPage {
6958
+ constructor(page, neetoPlaywrightUtilities) {
6959
+ this.createOrganization = async ({ email, businessName, subdomainName, firstName, lastName, appName, }) => {
6960
+ if (!IS_STAGING_ENV)
6961
+ return;
6962
+ const defaultOtp = "123456";
6963
+ const appNameInLowerCase = appName.toLowerCase();
6964
+ const isNeetoAuth = appNameInLowerCase === "neetoauth";
6965
+ const authUrl = "https://app.neetoauth.net/signups/new";
6966
+ isNeetoAuth
6967
+ ? await this.page.goto(authUrl)
6968
+ : await this.page.goto(`${authUrl}?redirect_uri=${appNameInLowerCase}.net`);
6969
+ await this.page.getByTestId(SIGNUP_SELECTORS.emailTextField).fill(email);
6970
+ const signup = this.neetoPlaywrightUtilities.interceptMultipleResponses({
6971
+ responseUrl: SIGNUP_PATH,
6972
+ baseUrl: NEETO_AUTH_URL,
6973
+ });
6974
+ await this.page.getByTestId(SIGNUP_SELECTORS.submitButton).click();
6975
+ await signup;
6976
+ await this.page.getByTestId(SIGNUP_SELECTORS.otpTextBox).fill(defaultOtp);
6977
+ await this.page
6978
+ .getByTestId(SIGNUP_SELECTORS.organizationNameTextField)
6979
+ .fill(businessName);
6980
+ const fetchSubdomainAvailability = this.page.waitForResponse(response => response.url().includes(SUBDOMAIN_AVAILABILITY_PATH));
6981
+ await this.page
6982
+ .getByTestId(SIGNUP_SELECTORS.subdomainNameTextField)
6983
+ .fill(subdomainName);
6984
+ await fetchSubdomainAvailability;
6985
+ const subdomainError = this.page.getByTestId(SIGNUP_SELECTORS.subdomainError);
6986
+ const subdomainErrorCount = await subdomainError.count();
6987
+ if (subdomainErrorCount !== 0) {
6988
+ await this.updateSubdomainIfExists(appNameInLowerCase);
6989
+ }
6990
+ await this.page
6991
+ .getByTestId(SIGNUP_SELECTORS.organizationSubmitButton)
6992
+ .click();
6993
+ await Promise.all([
6994
+ this.page.waitForResponse(response => response.url().includes(SIGNUP_PATH)),
6995
+ this.page.waitForResponse(response => response.url().includes(COUNTRIES_PATH)),
6996
+ ]);
6997
+ await this.page.waitForURL(`**${PROFILE_PATH}`, { timeout: 15000 });
6998
+ await this.page
6999
+ .getByTestId(SIGNUP_SELECTORS.firstNameTextField)
7000
+ .fill(firstName);
7001
+ await this.page
7002
+ .getByTestId(SIGNUP_SELECTORS.lastNameTextField)
7003
+ .fill(lastName);
7004
+ await this.page.getByTestId(COMMON_SELECTORS.checkbox).click();
7005
+ const submitProfile = this.neetoPlaywrightUtilities.interceptMultipleResponses({
7006
+ responseUrl: SIGNUP_PATH,
7007
+ baseUrl: NEETO_AUTH_URL,
7008
+ });
7009
+ await this.page.getByTestId(SIGNUP_SELECTORS.profileSubmitButton).click();
7010
+ await submitProfile;
7011
+ };
7012
+ this.setupOrganization = async () => {
7013
+ if (!IS_STAGING_ENV)
7014
+ return;
7015
+ let headers = {};
7016
+ const { user } = readFileSyncIfExists();
7017
+ await this.createOrganization({
7018
+ businessName: user.businessName,
7019
+ email: user.email,
7020
+ firstName: user.firstName,
7021
+ lastName: user.lastName,
7022
+ subdomainName: user.subdomainName,
7023
+ appName: "neetoInvoice",
7024
+ });
7025
+ await this.page.route(`**${NEETO_APPS_PATH}`, async (route) => {
7026
+ headers = await route.request().allHeaders();
7027
+ await route.continue();
7028
+ });
7029
+ await expect(this.page.locator(COMMON_SELECTORS.spinner)).toBeHidden();
7030
+ const userCredentials = readFileSyncIfExists();
7031
+ await this.page.context().storageState({ path: STORAGE_STATE });
7032
+ const mergedCredentials = {
7033
+ ...readFileSyncIfExists(),
7034
+ ...userCredentials,
7035
+ headers,
7036
+ };
7037
+ writeDataToFile(JSON.stringify(mergedCredentials, null, 2));
7038
+ };
7039
+ this.updateSubdomainIfExists = async (appName) => {
7040
+ const subdomainError = this.page.getByTestId(SIGNUP_SELECTORS.subdomainError);
7041
+ let subdomainErrorCount = await subdomainError.count();
7042
+ if (subdomainErrorCount !== 0) {
7043
+ const subdomainErrorText = await subdomainError.innerText();
7044
+ const newOrganizationName = extractSubdomainFromError(subdomainErrorText);
7045
+ await this.page
7046
+ .getByTestId(SIGNUP_SELECTORS.subdomainNameTextField)
7047
+ .fill(newOrganizationName);
7048
+ await this.page.waitForResponse(response => response.url().includes(SUBDOMAIN_AVAILABILITY_PATH));
7049
+ subdomainErrorCount = await subdomainError.count();
7050
+ if (subdomainErrorCount === 0) {
7051
+ updateCredentials({
7052
+ key: "subdomainName",
7053
+ value: newOrganizationName,
7054
+ });
7055
+ updateCredentials({
7056
+ key: "businessName",
7057
+ value: newOrganizationName,
7058
+ });
7059
+ const newBaseUrl = `https://${newOrganizationName}.${appName}.net`;
7060
+ process.env.BASE_URL = newBaseUrl;
7061
+ await this.page
7062
+ .getByTestId(SIGNUP_SELECTORS.organizationNameTextField)
7063
+ .fill(newOrganizationName);
7064
+ }
7065
+ subdomainErrorCount = await subdomainError.count();
7066
+ if (subdomainErrorCount !== 0) {
7067
+ await this.updateSubdomainIfExists(appName);
7068
+ }
7069
+ }
7070
+ };
7071
+ this.page = page;
7072
+ this.neetoPlaywrightUtilities = neetoPlaywrightUtilities;
7073
+ }
7074
+ }
7075
+
7076
+ const LOGIN_SELECTORS = {
7077
+ appleAuthenticationButton: "apple-authentication-button",
7078
+ emailTextField: "login-email-text-field",
7079
+ googleAuthenticationButton: "google-authentication-button",
7080
+ githubAuthenticationButton: "github-authentication-button",
7081
+ loginViaEmailButton: "login-via-email-button",
7082
+ passwordTextField: "login-password-text-field",
7083
+ rememberMeCheckBox: "login-remember-me-check-box",
7084
+ submitButton: "login-submit-button",
7085
+ twitterAuthenticationButton: "twitter-authentication-button",
7086
+ };
7087
+
7088
+ const COMMON_TEXTS = { edit: "Edit" };
7089
+
7090
+ const initializeCredentials = () => {
7091
+ const { user } = readFileSyncIfExists();
7092
+ const newState = {
7093
+ ...user,
7094
+ businessName: (user === null || user === void 0 ? void 0 : user.businessName) || stagingData.businessName,
7095
+ currentUserName: (user === null || user === void 0 ? void 0 : user.currentUserName) || stagingData.currentUserName,
7096
+ email: (user === null || user === void 0 ? void 0 : user.email) || stagingData.email,
7097
+ firstName: (user === null || user === void 0 ? void 0 : user.firstName) || stagingData.firstName,
7098
+ lastName: (user === null || user === void 0 ? void 0 : user.lastName) || stagingData.lastName,
7099
+ subdomainName: (user === null || user === void 0 ? void 0 : user.subdomainName) || stagingData.subdomainName,
7100
+ skipSetup: user === null || user === void 0 ? void 0 : user.skipSetup,
7101
+ };
7102
+ writeDataToFile(JSON.stringify({ user: newState }, null, 2));
7103
+ if (IS_STAGING_ENV) {
7104
+ const baseUrl = `https://${newState.subdomainName}.${stagingData.domain}`;
7105
+ process.env.BASE_URL = baseUrl;
7106
+ }
7107
+ };
7108
+
7109
+ const loginWithoutSSO = async ({ page, neetoPlaywrightUtilities, }) => {
7110
+ var _a;
7111
+ await page.goto((_a = process.env.BASE_URL) !== null && _a !== void 0 ? _a : "");
7112
+ let headers = {};
7113
+ await page.route(`**${LOGIN_PATH}`, async (route) => {
7114
+ headers = await route.request().allHeaders();
7115
+ await route.continue();
7116
+ });
7117
+ await page.getByTestId("login-email-text-field").fill(CREDENTIALS.email);
7118
+ await page
7119
+ .getByTestId("login-password-text-field")
7120
+ .fill(CREDENTIALS.password);
7121
+ const login = neetoPlaywrightUtilities.interceptMultipleResponses({
7122
+ times: 2,
7123
+ });
7124
+ await page.getByTestId(LOGIN_SELECTORS.submitButton).click();
7125
+ await login;
7126
+ const userCredentials = readFileSyncIfExists();
7127
+ await page.context().storageState({ path: STORAGE_STATE });
7128
+ const mergedCredentials = {
7129
+ ...readFileSyncIfExists(),
7130
+ ...userCredentials,
7131
+ headers,
7132
+ };
7133
+ writeDataToFile(JSON.stringify(mergedCredentials, null, 2));
7134
+ };
7135
+ const login = async ({ page, neetoPlaywrightUtilities }) => !IS_STAGING_ENV &&
7136
+ (await loginWithoutSSO({ page, neetoPlaywrightUtilities }));
7137
+
7138
+ var main$1 = {exports: {}};
7139
+
7140
+ var name = "dotenv";
7141
+ var version$1 = "16.3.1";
7142
+ var description = "Loads environment variables from .env file";
7143
+ var main = "lib/main.js";
7144
+ var types = "lib/main.d.ts";
7145
+ var exports = {
7146
+ ".": {
7147
+ types: "./lib/main.d.ts",
7148
+ require: "./lib/main.js",
7149
+ "default": "./lib/main.js"
7150
+ },
7151
+ "./config": "./config.js",
7152
+ "./config.js": "./config.js",
7153
+ "./lib/env-options": "./lib/env-options.js",
7154
+ "./lib/env-options.js": "./lib/env-options.js",
7155
+ "./lib/cli-options": "./lib/cli-options.js",
7156
+ "./lib/cli-options.js": "./lib/cli-options.js",
7157
+ "./package.json": "./package.json"
7158
+ };
7159
+ var scripts = {
7160
+ "dts-check": "tsc --project tests/types/tsconfig.json",
7161
+ lint: "standard",
7162
+ "lint-readme": "standard-markdown",
7163
+ pretest: "npm run lint && npm run dts-check",
7164
+ test: "tap tests/*.js --100 -Rspec",
7165
+ prerelease: "npm test",
7166
+ release: "standard-version"
7167
+ };
7168
+ var repository = {
7169
+ type: "git",
7170
+ url: "git://github.com/motdotla/dotenv.git"
7171
+ };
7172
+ var funding = "https://github.com/motdotla/dotenv?sponsor=1";
7173
+ var keywords = [
7174
+ "dotenv",
7175
+ "env",
7176
+ ".env",
7177
+ "environment",
7178
+ "variables",
7179
+ "config",
7180
+ "settings"
7181
+ ];
7182
+ var readmeFilename = "README.md";
7183
+ var license = "BSD-2-Clause";
7184
+ var devDependencies = {
7185
+ "@definitelytyped/dtslint": "^0.0.133",
7186
+ "@types/node": "^18.11.3",
7187
+ decache: "^4.6.1",
7188
+ sinon: "^14.0.1",
7189
+ standard: "^17.0.0",
7190
+ "standard-markdown": "^7.1.0",
7191
+ "standard-version": "^9.5.0",
7192
+ tap: "^16.3.0",
7193
+ tar: "^6.1.11",
7194
+ typescript: "^4.8.4"
7195
+ };
7196
+ var engines = {
7197
+ node: ">=12"
7198
+ };
7199
+ var browser = {
7200
+ fs: false
7201
+ };
7202
+ var require$$4 = {
7203
+ name: name,
7204
+ version: version$1,
7205
+ description: description,
7206
+ main: main,
7207
+ types: types,
7208
+ exports: exports,
7209
+ scripts: scripts,
7210
+ repository: repository,
7211
+ funding: funding,
7212
+ keywords: keywords,
7213
+ readmeFilename: readmeFilename,
7214
+ license: license,
7215
+ devDependencies: devDependencies,
7216
+ engines: engines,
7217
+ browser: browser
7218
+ };
7219
+
7220
+ const fs = fs__default;
7221
+ const path = require$$0;
7222
+ const os = require$$2;
7223
+ const crypto = require$$3;
7224
+ const packageJson = require$$4;
7225
+
7226
+ const version = packageJson.version;
7227
+
7228
+ const LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;
7229
+
7230
+ // Parse src into an Object
7231
+ function parse (src) {
7232
+ const obj = {};
7233
+
7234
+ // Convert buffer to string
7235
+ let lines = src.toString();
7236
+
7237
+ // Convert line breaks to same format
7238
+ lines = lines.replace(/\r\n?/mg, '\n');
7239
+
7240
+ let match;
7241
+ while ((match = LINE.exec(lines)) != null) {
7242
+ const key = match[1];
7243
+
7244
+ // Default undefined or null to empty string
7245
+ let value = (match[2] || '');
7246
+
7247
+ // Remove whitespace
7248
+ value = value.trim();
7249
+
7250
+ // Check if double quoted
7251
+ const maybeQuote = value[0];
7252
+
7253
+ // Remove surrounding quotes
7254
+ value = value.replace(/^(['"`])([\s\S]*)\1$/mg, '$2');
7255
+
7256
+ // Expand newlines if double quoted
7257
+ if (maybeQuote === '"') {
7258
+ value = value.replace(/\\n/g, '\n');
7259
+ value = value.replace(/\\r/g, '\r');
7260
+ }
7261
+
7262
+ // Add to object
7263
+ obj[key] = value;
7264
+ }
7265
+
7266
+ return obj
7267
+ }
7268
+
7269
+ function _parseVault (options) {
7270
+ const vaultPath = _vaultPath(options);
7271
+
7272
+ // Parse .env.vault
7273
+ const result = DotenvModule.configDotenv({ path: vaultPath });
7274
+ if (!result.parsed) {
7275
+ throw new Error(`MISSING_DATA: Cannot parse ${vaultPath} for an unknown reason`)
7276
+ }
7277
+
7278
+ // handle scenario for comma separated keys - for use with key rotation
7279
+ // example: DOTENV_KEY="dotenv://:key_1234@dotenv.org/vault/.env.vault?environment=prod,dotenv://:key_7890@dotenv.org/vault/.env.vault?environment=prod"
7280
+ const keys = _dotenvKey(options).split(',');
7281
+ const length = keys.length;
7282
+
7283
+ let decrypted;
7284
+ for (let i = 0; i < length; i++) {
7285
+ try {
7286
+ // Get full key
7287
+ const key = keys[i].trim();
7288
+
7289
+ // Get instructions for decrypt
7290
+ const attrs = _instructions(result, key);
7291
+
7292
+ // Decrypt
7293
+ decrypted = DotenvModule.decrypt(attrs.ciphertext, attrs.key);
7294
+
7295
+ break
7296
+ } catch (error) {
7297
+ // last key
7298
+ if (i + 1 >= length) {
7299
+ throw error
7300
+ }
7301
+ // try next key
7302
+ }
7303
+ }
7304
+
7305
+ // Parse decrypted .env string
7306
+ return DotenvModule.parse(decrypted)
7307
+ }
7308
+
7309
+ function _log (message) {
7310
+ console.log(`[dotenv@${version}][INFO] ${message}`);
7311
+ }
7312
+
7313
+ function _warn (message) {
7314
+ console.log(`[dotenv@${version}][WARN] ${message}`);
7315
+ }
7316
+
7317
+ function _debug (message) {
7318
+ console.log(`[dotenv@${version}][DEBUG] ${message}`);
7319
+ }
7320
+
7321
+ function _dotenvKey (options) {
7322
+ // prioritize developer directly setting options.DOTENV_KEY
7323
+ if (options && options.DOTENV_KEY && options.DOTENV_KEY.length > 0) {
7324
+ return options.DOTENV_KEY
7325
+ }
7326
+
7327
+ // secondary infra already contains a DOTENV_KEY environment variable
7328
+ if (process.env.DOTENV_KEY && process.env.DOTENV_KEY.length > 0) {
7329
+ return process.env.DOTENV_KEY
7330
+ }
7331
+
7332
+ // fallback to empty string
7333
+ return ''
7334
+ }
7335
+
7336
+ function _instructions (result, dotenvKey) {
7337
+ // Parse DOTENV_KEY. Format is a URI
7338
+ let uri;
7339
+ try {
7340
+ uri = new URL(dotenvKey);
7341
+ } catch (error) {
7342
+ if (error.code === 'ERR_INVALID_URL') {
7343
+ 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')
7344
+ }
7345
+
7346
+ throw error
7347
+ }
7348
+
7349
+ // Get decrypt key
7350
+ const key = uri.password;
7351
+ if (!key) {
7352
+ throw new Error('INVALID_DOTENV_KEY: Missing key part')
7353
+ }
7354
+
7355
+ // Get environment
7356
+ const environment = uri.searchParams.get('environment');
7357
+ if (!environment) {
7358
+ throw new Error('INVALID_DOTENV_KEY: Missing environment part')
7359
+ }
7360
+
7361
+ // Get ciphertext payload
7362
+ const environmentKey = `DOTENV_VAULT_${environment.toUpperCase()}`;
7363
+ const ciphertext = result.parsed[environmentKey]; // DOTENV_VAULT_PRODUCTION
7364
+ if (!ciphertext) {
7365
+ throw new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${environmentKey} in your .env.vault file.`)
7366
+ }
7367
+
7368
+ return { ciphertext, key }
7369
+ }
7370
+
7371
+ function _vaultPath (options) {
7372
+ let dotenvPath = path.resolve(process.cwd(), '.env');
7373
+
7374
+ if (options && options.path && options.path.length > 0) {
7375
+ dotenvPath = options.path;
7376
+ }
7377
+
7378
+ // Locate .env.vault
7379
+ return dotenvPath.endsWith('.vault') ? dotenvPath : `${dotenvPath}.vault`
7380
+ }
7381
+
7382
+ function _resolveHome (envPath) {
7383
+ return envPath[0] === '~' ? path.join(os.homedir(), envPath.slice(1)) : envPath
7384
+ }
7385
+
7386
+ function _configVault (options) {
7387
+ _log('Loading env from encrypted .env.vault');
7388
+
7389
+ const parsed = DotenvModule._parseVault(options);
7390
+
7391
+ let processEnv = process.env;
7392
+ if (options && options.processEnv != null) {
7393
+ processEnv = options.processEnv;
7394
+ }
7395
+
7396
+ DotenvModule.populate(processEnv, parsed, options);
7397
+
7398
+ return { parsed }
7399
+ }
7400
+
7401
+ function configDotenv (options) {
7402
+ let dotenvPath = path.resolve(process.cwd(), '.env');
7403
+ let encoding = 'utf8';
7404
+ const debug = Boolean(options && options.debug);
7405
+
7406
+ if (options) {
7407
+ if (options.path != null) {
7408
+ dotenvPath = _resolveHome(options.path);
7409
+ }
7410
+ if (options.encoding != null) {
7411
+ encoding = options.encoding;
7412
+ }
7413
+ }
7414
+
7415
+ try {
7416
+ // Specifying an encoding returns a string instead of a buffer
7417
+ const parsed = DotenvModule.parse(fs.readFileSync(dotenvPath, { encoding }));
7418
+
7419
+ let processEnv = process.env;
7420
+ if (options && options.processEnv != null) {
7421
+ processEnv = options.processEnv;
7422
+ }
7423
+
7424
+ DotenvModule.populate(processEnv, parsed, options);
7425
+
7426
+ return { parsed }
7427
+ } catch (e) {
7428
+ if (debug) {
7429
+ _debug(`Failed to load ${dotenvPath} ${e.message}`);
7430
+ }
7431
+
7432
+ return { error: e }
7433
+ }
7434
+ }
7435
+
7436
+ // Populates process.env from .env file
7437
+ function config (options) {
7438
+ const vaultPath = _vaultPath(options);
7439
+
7440
+ // fallback to original dotenv if DOTENV_KEY is not set
7441
+ if (_dotenvKey(options).length === 0) {
7442
+ return DotenvModule.configDotenv(options)
7443
+ }
7444
+
7445
+ // dotenvKey exists but .env.vault file does not exist
7446
+ if (!fs.existsSync(vaultPath)) {
7447
+ _warn(`You set DOTENV_KEY but you are missing a .env.vault file at ${vaultPath}. Did you forget to build it?`);
7448
+
7449
+ return DotenvModule.configDotenv(options)
7450
+ }
7451
+
7452
+ return DotenvModule._configVault(options)
7453
+ }
7454
+
7455
+ function decrypt (encrypted, keyStr) {
7456
+ const key = Buffer.from(keyStr.slice(-64), 'hex');
7457
+ let ciphertext = Buffer.from(encrypted, 'base64');
7458
+
7459
+ const nonce = ciphertext.slice(0, 12);
7460
+ const authTag = ciphertext.slice(-16);
7461
+ ciphertext = ciphertext.slice(12, -16);
7462
+
7463
+ try {
7464
+ const aesgcm = crypto.createDecipheriv('aes-256-gcm', key, nonce);
7465
+ aesgcm.setAuthTag(authTag);
7466
+ return `${aesgcm.update(ciphertext)}${aesgcm.final()}`
7467
+ } catch (error) {
7468
+ const isRange = error instanceof RangeError;
7469
+ const invalidKeyLength = error.message === 'Invalid key length';
7470
+ const decryptionFailed = error.message === 'Unsupported state or unable to authenticate data';
7471
+
7472
+ if (isRange || invalidKeyLength) {
7473
+ const msg = 'INVALID_DOTENV_KEY: It must be 64 characters long (or more)';
7474
+ throw new Error(msg)
7475
+ } else if (decryptionFailed) {
7476
+ const msg = 'DECRYPTION_FAILED: Please check your DOTENV_KEY';
7477
+ throw new Error(msg)
7478
+ } else {
7479
+ console.error('Error: ', error.code);
7480
+ console.error('Error: ', error.message);
7481
+ throw error
7482
+ }
7483
+ }
7484
+ }
7485
+
7486
+ // Populate process.env with parsed values
7487
+ function populate (processEnv, parsed, options = {}) {
7488
+ const debug = Boolean(options && options.debug);
7489
+ const override = Boolean(options && options.override);
7490
+
7491
+ if (typeof parsed !== 'object') {
7492
+ throw new Error('OBJECT_REQUIRED: Please check the processEnv argument being passed to populate')
7493
+ }
7494
+
7495
+ // Set process.env
7496
+ for (const key of Object.keys(parsed)) {
7497
+ if (Object.prototype.hasOwnProperty.call(processEnv, key)) {
7498
+ if (override === true) {
7499
+ processEnv[key] = parsed[key];
7500
+ }
7501
+
7502
+ if (debug) {
7503
+ if (override === true) {
7504
+ _debug(`"${key}" is already defined and WAS overwritten`);
7505
+ } else {
7506
+ _debug(`"${key}" is already defined and was NOT overwritten`);
7507
+ }
7508
+ }
7509
+ } else {
7510
+ processEnv[key] = parsed[key];
7511
+ }
7512
+ }
7513
+ }
7514
+
7515
+ const DotenvModule = {
7516
+ configDotenv,
7517
+ _configVault,
7518
+ _parseVault,
7519
+ config,
7520
+ decrypt,
7521
+ parse,
7522
+ populate
7523
+ };
7524
+
7525
+ main$1.exports.configDotenv = DotenvModule.configDotenv;
7526
+ main$1.exports._configVault = DotenvModule._configVault;
7527
+ main$1.exports._parseVault = DotenvModule._parseVault;
7528
+ main$1.exports.config = DotenvModule.config;
7529
+ main$1.exports.decrypt = DotenvModule.decrypt;
7530
+ main$1.exports.parse = DotenvModule.parse;
7531
+ main$1.exports.populate = DotenvModule.populate;
7532
+
7533
+ main$1.exports = DotenvModule;
6951
7534
 
6952
7535
  // @ts-check
6953
7536
  var _a, _b;
6954
- const { defineConfig, devices } = require("@playwright/test");
6955
- const dotenv = require("dotenv");
6956
- dotenv.config({
7537
+ main$1.exports.config({
6957
7538
  path: `./e2e/config/.env.${(_a = process.env.TEST_ENV) !== null && _a !== void 0 ? _a : "development"}`,
6958
7539
  });
6959
7540
  const storageState = "./e2e/auth/user.json";
@@ -7002,5 +7583,5 @@ const definePlaywrightConfig = (overrides) => {
7002
7583
  });
7003
7584
  };
7004
7585
 
7005
- export { BASE_URL, COMMON_SELECTORS$1 as COMMON_SELECTORS, COMMON_TEXTS, COUNTRIES_PATH, ENVIRONMENT, GLOBAL_TRANSLATIONS_PATTERN, IS_STAGING_ENV, LOGIN_PATH, NEETO_APPS_PATH, PROFILE_PATH, PROJECT_TRANSLATIONS_PATH, SIGNUP_PATH, SIGNUP_SELECTORS, STORAGE_STATE$1 as STORAGE_STATE, SUBDOMAIN_AVAILABILITY_PATH, clearCredentials, definePlaywrightConfig, initializeCredentials, joinString, readFileSyncIfExists$1 as readFileSyncIfExists, readTranslations, stagingData, test, updateCredentials, writeDataToFile };
7586
+ export { BASE_URL, COMMON_SELECTORS, COMMON_TEXTS, COUNTRIES_PATH, CREDENTIALS, CustomCommands, ENVIRONMENT, GLOBAL_TRANSLATIONS_PATTERN, IS_STAGING_ENV, LOGIN_PATH, LOGIN_SELECTORS, NEETO_APPS_PATH, NEETO_AUTH_URL, OrganizationPage, PROFILE_PATH, PROJECT_TRANSLATIONS_PATH, SIGNUP_PATH, SIGNUP_SELECTORS, STORAGE_STATE, SUBDOMAIN_AVAILABILITY_PATH, clearCredentials, commands, definePlaywrightConfig, i18n, initializeCredentials, joinString, login, loginWithoutSSO, readFileSyncIfExists, readTranslations, stagingData, updateCredentials, writeDataToFile };
7006
7587
  //# sourceMappingURL=index.js.map