@bigbinary/neeto-playwright-commons 2.1.5 → 2.2.0

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 CHANGED
@@ -130,6 +130,7 @@ import { COMMON_SELECTORS } from "@bigbinary/neeto-playwright-common";
130
130
  - [Routes](./docs/routes.md)
131
131
  - [Custom commands](./docs/custom-commands.md)
132
132
  - [MailerUtils](./docs/utils/mailer-utils.md)
133
+ - [NeetoAuthServer](./docs/utils/neeto-auth-server.md)
133
134
  - [Util functions](./docs/utils)
134
135
  - [POMs](./docs/poms)
135
136
  - [Integration](./docs/integration)
package/index.cjs.js CHANGED
@@ -3,29 +3,30 @@
3
3
  var child_process = require('child_process');
4
4
  var neetoCist = require('@bigbinary/neeto-cist');
5
5
  var faker = require('@faker-js/faker');
6
- var require$$0$4 = require('fs');
7
- var require$$0$5 = require('os');
6
+ var fs$4 = require('fs');
7
+ var require$$0$4 = require('os');
8
8
  var path$1 = require('path');
9
9
  var test = require('@playwright/test');
10
10
  var playwrightI18nextFixture = require('playwright-i18next-fixture');
11
11
  var require$$0$3 = require('util');
12
12
  var ramda = require('ramda');
13
13
  var dayjs = require('dayjs');
14
- var require$$0$8 = require('stream');
15
- var require$$0$7 = require('node:buffer');
16
- var require$$0$6 = require('buffer');
14
+ var require$$0$7 = require('stream');
15
+ var require$$0$6 = require('node:buffer');
16
+ var require$$0$5 = require('buffer');
17
17
  var require$$1$2 = require('string_decoder');
18
18
  var require$$1$3 = require('node:stream');
19
- var require$$0$9 = require('crypto');
19
+ var require$$0$8 = require('crypto');
20
20
  var require$$1$4 = require('zlib');
21
- var require$$0$a = require('assert');
22
- var require$$0$b = require('tty');
21
+ var require$$0$9 = require('assert');
22
+ var require$$0$a = require('tty');
23
23
  var stealth$1 = require('puppeteer-extra-plugin-stealth');
24
24
  var require$$1$5 = require('events');
25
25
  var customParseFormat = require('dayjs/plugin/customParseFormat');
26
26
  var timezone = require('dayjs/plugin/timezone');
27
27
  var utc = require('dayjs/plugin/utc');
28
28
  var https = require('https');
29
+ var http = require('http');
29
30
 
30
31
  function _interopNamespaceDefault(e) {
31
32
  var n = Object.create(null);
@@ -44,8 +45,9 @@ function _interopNamespaceDefault(e) {
44
45
  return Object.freeze(n);
45
46
  }
46
47
 
47
- var require$$0__namespace = /*#__PURE__*/_interopNamespaceDefault(require$$0$4);
48
+ var fs__namespace = /*#__PURE__*/_interopNamespaceDefault(fs$4);
48
49
  var path__namespace = /*#__PURE__*/_interopNamespaceDefault(path$1);
50
+ var http__namespace = /*#__PURE__*/_interopNamespaceDefault(http);
49
51
 
50
52
  const BASE_URL = "/api/v1";
51
53
  const NEETO_AUTH_BASE_URL = (subdomain = "app") => `https://${subdomain}.neetoauth.net`;
@@ -5094,7 +5096,7 @@ const joinString = (string1, string2, string3 = "", separator = " ") => {
5094
5096
  };
5095
5097
  const readFileSyncIfExists = (path = STORAGE_STATE) => {
5096
5098
  try {
5097
- return JSON.parse(require$$0__namespace.readFileSync(path, "utf8"));
5099
+ return JSON.parse(fs__namespace.readFileSync(path, "utf8"));
5098
5100
  }
5099
5101
  catch {
5100
5102
  return {};
@@ -5103,7 +5105,7 @@ const readFileSyncIfExists = (path = STORAGE_STATE) => {
5103
5105
  const getGlobalUserState = () => readFileSyncIfExists()?.user;
5104
5106
  const writeDataToFile = data => {
5105
5107
  try {
5106
- require$$0__namespace.writeFileSync(STORAGE_STATE, data, "utf8");
5108
+ fs__namespace.writeFileSync(STORAGE_STATE, data, "utf8");
5107
5109
  }
5108
5110
  catch (error) {
5109
5111
  console.log(error);
@@ -5116,7 +5118,7 @@ const updateCredentials = ({ key, value }) => {
5116
5118
  return writeDataToFile(JSON.stringify(data));
5117
5119
  };
5118
5120
  const removeCredentialFile = () => {
5119
- require$$0__namespace.unlink(STORAGE_STATE, error => {
5121
+ fs__namespace.unlink(STORAGE_STATE, error => {
5120
5122
  if (!error)
5121
5123
  return;
5122
5124
  console.log(error);
@@ -6079,7 +6081,7 @@ class CustomCommands {
6079
6081
  };
6080
6082
  uploadFileViaDispatch = async ({ fileNameWithType, assetsPath = "../../../e2e/assets/", dispatchEvent = "drop", droppableZone = this.page.getByTestId(COMMON_SELECTORS.fileUploadBody), }) => {
6081
6083
  const filePath = path$1.join(__dirname, `${assetsPath}/${fileNameWithType}`);
6082
- const buffer = require$$0$4.readFileSync(filePath).toString("base64");
6084
+ const buffer = fs$4.readFileSync(filePath).toString("base64");
6083
6085
  const dataTransfer = await droppableZone.evaluateHandle((_, { buffer, fileNameWithType }) => {
6084
6086
  const dataTransfer = new DataTransfer();
6085
6087
  const fileName = fileNameWithType.split("/")?.[1];
@@ -6266,7 +6268,7 @@ class CustomCommands {
6266
6268
  await test.expect(locator).toBeChecked({ checked: shouldBeChecked });
6267
6269
  }).toPass({ timeout: 15_000 });
6268
6270
  moveCursorAtBottom = async () => {
6269
- const isMacOS = require$$0$5.platform() === "darwin";
6271
+ const isMacOS = require$$0$4.platform() === "darwin";
6270
6272
  const rightArrowKey = isMacOS ? "Meta+ArrowRight" : "End";
6271
6273
  const downArrowKey = isMacOS ? "Meta+ArrowDown" : "PageDown";
6272
6274
  await this.page.keyboard.press(rightArrowKey);
@@ -8907,7 +8909,7 @@ function requireSafer () {
8907
8909
  if (hasRequiredSafer) return safer_1;
8908
8910
  hasRequiredSafer = 1;
8909
8911
 
8910
- var buffer = require$$0$6;
8912
+ var buffer = require$$0$5;
8911
8913
  var Buffer = buffer.Buffer;
8912
8914
 
8913
8915
  var safer = {};
@@ -26602,7 +26604,7 @@ function requireCharset () {
26602
26604
  if (hasRequiredCharset) return charset.exports;
26603
26605
  hasRequiredCharset = 1;
26604
26606
 
26605
- const { Buffer } = require$$0$7;
26607
+ const { Buffer } = require$$0$6;
26606
26608
  const iconv = requireLib$b();
26607
26609
  const encodingJapanese = requireSrc$2();
26608
26610
  const charsets = requireCharsets();
@@ -26728,7 +26730,7 @@ function requireLibbase64 () {
26728
26730
  if (hasRequiredLibbase64) return libbase64;
26729
26731
  hasRequiredLibbase64 = 1;
26730
26732
 
26731
- const { Buffer } = require$$0$7;
26733
+ const { Buffer } = require$$0$6;
26732
26734
  const stream = require$$1$3;
26733
26735
  const Transform = stream.Transform;
26734
26736
 
@@ -26989,7 +26991,7 @@ function requireLibqp () {
26989
26991
  if (hasRequiredLibqp) return libqp;
26990
26992
  hasRequiredLibqp = 1;
26991
26993
 
26992
- const { Buffer } = require$$0$7;
26994
+ const { Buffer } = require$$0$6;
26993
26995
  const stream = require$$1$3;
26994
26996
  const Transform = stream.Transform;
26995
26997
 
@@ -29364,7 +29366,7 @@ function requireLibmime () {
29364
29366
  if (hasRequiredLibmime) return libmime.exports;
29365
29367
  hasRequiredLibmime = 1;
29366
29368
 
29367
- const { Buffer } = require$$0$7;
29369
+ const { Buffer } = require$$0$6;
29368
29370
  const libcharset = requireCharset();
29369
29371
  const libbase64 = requireLibbase64();
29370
29372
  const libqp = requireLibqp();
@@ -30545,7 +30547,7 @@ function requireMimeNode () {
30545
30547
  const libmime = requireLibmime();
30546
30548
  const libqp = requireLibqp();
30547
30549
  const libbase64 = requireLibbase64();
30548
- const PassThrough = require$$0$8.PassThrough;
30550
+ const PassThrough = require$$0$7.PassThrough;
30549
30551
  const pathlib = path$1;
30550
30552
 
30551
30553
  class MimeNode {
@@ -30814,7 +30816,7 @@ function requireMessageSplitter () {
30814
30816
  if (hasRequiredMessageSplitter) return messageSplitter;
30815
30817
  hasRequiredMessageSplitter = 1;
30816
30818
 
30817
- const Transform = require$$0$8.Transform;
30819
+ const Transform = require$$0$7.Transform;
30818
30820
  const MimeNode = requireMimeNode();
30819
30821
 
30820
30822
  const MAX_HEAD_SIZE = 1 * 1024 * 1024;
@@ -31244,7 +31246,7 @@ function requireMessageJoiner () {
31244
31246
  if (hasRequiredMessageJoiner) return messageJoiner;
31245
31247
  hasRequiredMessageJoiner = 1;
31246
31248
 
31247
- const Transform = require$$0$8.Transform;
31249
+ const Transform = require$$0$7.Transform;
31248
31250
 
31249
31251
  class MessageJoiner extends Transform {
31250
31252
  constructor() {
@@ -31284,7 +31286,7 @@ function requireFlowedDecoder () {
31284
31286
 
31285
31287
  // Helper class to rewrite nodes with specific mime type
31286
31288
 
31287
- const Transform = require$$0$8.Transform;
31289
+ const Transform = require$$0$7.Transform;
31288
31290
  const libmime = requireLibmime();
31289
31291
 
31290
31292
  /**
@@ -31347,7 +31349,7 @@ function requireNodeRewriter () {
31347
31349
 
31348
31350
  // Helper class to rewrite nodes with specific mime type
31349
31351
 
31350
- const Transform = require$$0$8.Transform;
31352
+ const Transform = require$$0$7.Transform;
31351
31353
  const FlowedDecoder = requireFlowedDecoder();
31352
31354
 
31353
31355
  /**
@@ -31549,7 +31551,7 @@ function requireNodeStreamer () {
31549
31551
 
31550
31552
  // Helper class to rewrite nodes with specific mime type
31551
31553
 
31552
- const Transform = require$$0$8.Transform;
31554
+ const Transform = require$$0$7.Transform;
31553
31555
  const FlowedDecoder = requireFlowedDecoder();
31554
31556
 
31555
31557
  /**
@@ -31676,7 +31678,7 @@ function requireChunkedPassthrough () {
31676
31678
  if (hasRequiredChunkedPassthrough) return chunkedPassthrough;
31677
31679
  hasRequiredChunkedPassthrough = 1;
31678
31680
 
31679
- const { Transform } = require$$0$8;
31681
+ const { Transform } = require$$0$7;
31680
31682
 
31681
31683
  class ChunkedPassthrough extends Transform {
31682
31684
  constructor(options = {}) {
@@ -32602,8 +32604,8 @@ function requireStreamHash () {
32602
32604
  if (hasRequiredStreamHash) return streamHash;
32603
32605
  hasRequiredStreamHash = 1;
32604
32606
 
32605
- const crypto = require$$0$9;
32606
- const Transform = require$$0$8.Transform;
32607
+ const crypto = require$$0$8;
32608
+ const Transform = require$$0$7.Transform;
32607
32609
 
32608
32610
  class StreamHash extends Transform {
32609
32611
  constructor(attachment, algo) {
@@ -54986,7 +54988,7 @@ function requireMailParser () {
54986
54988
  const mailsplit = requireMailsplit();
54987
54989
  const libmime = requireLibmime();
54988
54990
  const addressparser = requireAddressparser();
54989
- const Transform = require$$0$8.Transform;
54991
+ const Transform = require$$0$7.Transform;
54990
54992
  const Splitter = mailsplit.Splitter;
54991
54993
  const ChunkedPassthrough = mailsplit.ChunkedPassthrough;
54992
54994
  const punycode = require$$4$2;
@@ -60620,9 +60622,7 @@ class MailerUtils {
60620
60622
  const { html: { codes }, } = await this.findMessage({ to: email, subject: subjectSubstring }, { timeout, receivedAfter, expectedEmailCount });
60621
60623
  return codes?.[0];
60622
60624
  };
60623
- generateRandomEmail = (shouldUseBypassEmail = false) => shouldUseBypassEmail
60624
- ? generateRandomBypassEmail()
60625
- : faker.faker.internet.email({ provider: process.env.FASTMAIL_DOMAIN_NAME });
60625
+ generateRandomEmail = () => faker.faker.internet.email({ provider: process.env.FASTMAIL_DOMAIN_NAME });
60626
60626
  getEmailAttachment = async (attachmentName, messageSearchCriteria = {}, { timeout = 10_000, receivedAfter = dateTimeOneHourAgo(), expectedEmailCount = 1, } = {}, shouldThrowErrorOnTimeout = true) => {
60627
60627
  if (IS_DEV_ENV) {
60628
60628
  return this.railsEmailUtils.getEmailAttachment(attachmentName, messageSearchCriteria, { receivedAfter, expectedEmailCount, timeout: timeout / 3 }, shouldThrowErrorOnTimeout);
@@ -67006,7 +67006,7 @@ function requireGifutil () {
67006
67006
 
67007
67007
  /** @namespace GifUtil */
67008
67008
 
67009
- const fs = require$$0$4;
67009
+ const fs = fs$4;
67010
67010
  const ImageQ = requireImageQ();
67011
67011
 
67012
67012
  const BitmapImage = requireBitmapimage();
@@ -69823,7 +69823,7 @@ function requireChunkstream () {
69823
69823
  hasRequiredChunkstream = 1;
69824
69824
 
69825
69825
  let util = require$$0$3;
69826
- let Stream = require$$0$8;
69826
+ let Stream = require$$0$7;
69827
69827
 
69828
69828
  let ChunkStream = (chunkstream.exports = function () {
69829
69829
  Stream.call(this);
@@ -71792,7 +71792,7 @@ function requirePackerAsync () {
71792
71792
  hasRequiredPackerAsync = 1;
71793
71793
 
71794
71794
  let util = require$$0$3;
71795
- let Stream = require$$0$8;
71795
+ let Stream = require$$0$7;
71796
71796
  let constants = requireConstants$4();
71797
71797
  let Packer = requirePacker();
71798
71798
 
@@ -71853,11 +71853,11 @@ function requireSyncInflate () {
71853
71853
  hasRequiredSyncInflate = 1;
71854
71854
  (function (module, exports$1) {
71855
71855
 
71856
- let assert = require$$0$a.ok;
71856
+ let assert = require$$0$9.ok;
71857
71857
  let zlib = require$$1$4;
71858
71858
  let util = require$$0$3;
71859
71859
 
71860
- let kMaxLength = require$$0$6.kMaxLength;
71860
+ let kMaxLength = require$$0$5.kMaxLength;
71861
71861
 
71862
71862
  function Inflate(opts) {
71863
71863
  if (!(this instanceof Inflate)) {
@@ -72314,7 +72314,7 @@ function requirePng () {
72314
72314
  hasRequiredPng = 1;
72315
72315
 
72316
72316
  let util = require$$0$3;
72317
- let Stream = require$$0$8;
72317
+ let Stream = require$$0$7;
72318
72318
  let Parser = requireParserAsync();
72319
72319
  let Packer = requirePackerAsync();
72320
72320
  let PNGSync = requirePngSync();
@@ -89472,8 +89472,8 @@ function to(promise, errorExt) {
89472
89472
  });
89473
89473
  }
89474
89474
 
89475
- const readFile = require$$0$4.promises.readFile;
89476
- const writeFile = require$$0$4.promises.writeFile;
89475
+ const readFile = fs$4.promises.readFile;
89476
+ const writeFile = fs$4.promises.writeFile;
89477
89477
 
89478
89478
  var Mime_1;
89479
89479
  var hasRequiredMime;
@@ -91544,7 +91544,7 @@ function createJimp({ plugins: pluginsArg, formats: formatsArg, } = {}) {
91544
91544
  if (Buffer.isBuffer(url) || url instanceof ArrayBuffer) {
91545
91545
  return this.fromBuffer(url);
91546
91546
  }
91547
- if (require$$0$4.existsSync(url)) {
91547
+ if (fs$4.existsSync(url)) {
91548
91548
  return this.fromBuffer(await readFile(url));
91549
91549
  }
91550
91550
  const [fetchErr, response] = await to(fetch(url));
@@ -107148,7 +107148,7 @@ var jsQR = /*@__PURE__*/getDefaultExportFromCjs(jsQRExports);
107148
107148
  const decodeQRCodeFromFile = async (filePath) => {
107149
107149
  let decodedString;
107150
107150
  try {
107151
- const buffer = require$$0$4.readFileSync(filePath);
107151
+ const buffer = fs$4.readFileSync(filePath);
107152
107152
  const image = await Jimp.read(buffer);
107153
107153
  const bitmapData = new Uint8ClampedArray(image.bitmap.data);
107154
107154
  const qrData = jsQR(bitmapData, image.bitmap.width, image.bitmap.height);
@@ -107185,7 +107185,7 @@ class QRCodeUtils {
107185
107185
  decodeQRCodeFromFile = async (filePath) => {
107186
107186
  let decodedString;
107187
107187
  try {
107188
- const buffer = require$$0$4.readFileSync(filePath);
107188
+ const buffer = fs$4.readFileSync(filePath);
107189
107189
  const image = await Jimp.read(buffer);
107190
107190
  const bitmapData = new Uint8ClampedArray(image.bitmap.data);
107191
107191
  const qrData = jsQR(bitmapData, image.bitmap.width, image.bitmap.height);
@@ -108041,7 +108041,7 @@ var hasRequiredSupportsColor;
108041
108041
  function requireSupportsColor () {
108042
108042
  if (hasRequiredSupportsColor) return supportsColor_1;
108043
108043
  hasRequiredSupportsColor = 1;
108044
- const os = require$$0$5;
108044
+ const os = require$$0$4;
108045
108045
  const hasFlag = requireHasFlag();
108046
108046
 
108047
108047
  const env = process.env;
@@ -108184,7 +108184,7 @@ function requireNode () {
108184
108184
  if (hasRequiredNode) return node.exports;
108185
108185
  hasRequiredNode = 1;
108186
108186
  (function (module, exports$1) {
108187
- const tty = require$$0$b;
108187
+ const tty = require$$0$a;
108188
108188
  const util = require$$0$3;
108189
108189
 
108190
108190
  /**
@@ -109511,7 +109511,7 @@ function requirePath () {
109511
109511
  hasRequiredPath = 1;
109512
109512
  Object.defineProperty(path, "__esModule", { value: true });
109513
109513
  path.convertPosixPathToPattern = path.convertWindowsPathToPattern = path.convertPathToPattern = path.escapePosixPath = path.escapeWindowsPath = path.escape = path.removeLeadingDotSegment = path.makeAbsolute = path.unixify = void 0;
109514
- const os = require$$0$5;
109514
+ const os = require$$0$4;
109515
109515
  const path$2 = path$1;
109516
109516
  const IS_WINDOWS_PLATFORM = os.platform() === 'win32';
109517
109517
  const LEADING_DOT_SEGMENT_CHARACTERS_COUNT = 2; // ./ or .\\
@@ -109778,7 +109778,7 @@ function requireGlobParent () {
109778
109778
 
109779
109779
  var isGlob = requireIsGlob();
109780
109780
  var pathPosixDirname = path$1.posix.dirname;
109781
- var isWin32 = require$$0$5.platform() === 'win32';
109781
+ var isWin32 = require$$0$4.platform() === 'win32';
109782
109782
 
109783
109783
  var slash = '/';
109784
109784
  var backslash = /\\/g;
@@ -114171,7 +114171,7 @@ function requireMerge2 () {
114171
114171
  * Copyright (c) 2014-2020 Teambition
114172
114172
  * Licensed under the MIT license.
114173
114173
  */
114174
- const Stream = require$$0$8;
114174
+ const Stream = require$$0$7;
114175
114175
  const PassThrough = Stream.PassThrough;
114176
114176
  const slice = Array.prototype.slice;
114177
114177
 
@@ -114600,7 +114600,7 @@ function requireFs$2 () {
114600
114600
  (function (exports$1) {
114601
114601
  Object.defineProperty(exports$1, "__esModule", { value: true });
114602
114602
  exports$1.createFileSystemAdapter = exports$1.FILE_SYSTEM_ADAPTER = void 0;
114603
- const fs = require$$0$4;
114603
+ const fs = fs$4;
114604
114604
  exports$1.FILE_SYSTEM_ADAPTER = {
114605
114605
  lstat: fs.lstat,
114606
114606
  stat: fs.stat,
@@ -115030,7 +115030,7 @@ function requireFs () {
115030
115030
  (function (exports$1) {
115031
115031
  Object.defineProperty(exports$1, "__esModule", { value: true });
115032
115032
  exports$1.createFileSystemAdapter = exports$1.FILE_SYSTEM_ADAPTER = void 0;
115033
- const fs = require$$0$4;
115033
+ const fs = fs$4;
115034
115034
  exports$1.FILE_SYSTEM_ADAPTER = {
115035
115035
  lstat: fs.lstat,
115036
115036
  stat: fs.stat,
@@ -115663,7 +115663,7 @@ function requireStream$2 () {
115663
115663
  if (hasRequiredStream$2) return stream$2;
115664
115664
  hasRequiredStream$2 = 1;
115665
115665
  Object.defineProperty(stream$2, "__esModule", { value: true });
115666
- const stream_1 = require$$0$8;
115666
+ const stream_1 = require$$0$7;
115667
115667
  const async_1 = requireAsync$3();
115668
115668
  class StreamProvider {
115669
115669
  constructor(_root, _settings) {
@@ -115915,7 +115915,7 @@ function requireStream$1 () {
115915
115915
  if (hasRequiredStream$1) return stream$1;
115916
115916
  hasRequiredStream$1 = 1;
115917
115917
  Object.defineProperty(stream$1, "__esModule", { value: true });
115918
- const stream_1 = require$$0$8;
115918
+ const stream_1 = require$$0$7;
115919
115919
  const fsStat = requireOut$3();
115920
115920
  const fsWalk = requireOut$1();
115921
115921
  const reader_1 = requireReader();
@@ -116433,7 +116433,7 @@ function requireStream () {
116433
116433
  if (hasRequiredStream) return stream;
116434
116434
  hasRequiredStream = 1;
116435
116435
  Object.defineProperty(stream, "__esModule", { value: true });
116436
- const stream_1 = require$$0$8;
116436
+ const stream_1 = require$$0$7;
116437
116437
  const stream_2 = requireStream$1();
116438
116438
  const provider_1 = requireProvider();
116439
116439
  class ProviderStream extends provider_1.default {
@@ -116559,8 +116559,8 @@ function requireSettings () {
116559
116559
  (function (exports$1) {
116560
116560
  Object.defineProperty(exports$1, "__esModule", { value: true });
116561
116561
  exports$1.DEFAULT_FILE_SYSTEM_ADAPTER = void 0;
116562
- const fs = require$$0$4;
116563
- const os = require$$0$5;
116562
+ const fs = fs$4;
116563
+ const os = require$$0$4;
116564
116564
  /**
116565
116565
  * The `os.cpus` method can return zero. We expect the number of cores to be greater than zero.
116566
116566
  * https://github.com/nodejs/node/blob/7faeddf23a98c53896f8b574a6e66589e8fb1eb8/lib/os.js#L106-L107
@@ -116916,7 +116916,7 @@ class EmbedBase {
116916
116916
  ? `${embedCode}<a href='#' id='open-popup-button'>${customElementText}</a>`
116917
116917
  : embedCode);
116918
116918
  this.filePath = `tmp/${faker.faker.word.noun()}.html`;
116919
- require$$0$4.writeFileSync(this.filePath, fileContent, "utf8");
116919
+ fs$4.writeFileSync(this.filePath, fileContent, "utf8");
116920
116920
  await this.embedTestPage.goto(`file://${path$1.resolve(this.filePath)}`, {
116921
116921
  timeout: 20_000,
116922
116922
  });
@@ -116936,7 +116936,7 @@ class EmbedBase {
116936
116936
  }
116937
116937
  await this.embedTestPage.close();
116938
116938
  await this.context.close();
116939
- require$$0$4.unlinkSync(this.filePath);
116939
+ fs$4.unlinkSync(this.filePath);
116940
116940
  };
116941
116941
  clickOnPopupButton = async (popUpButtonSelectorOptions) => {
116942
116942
  const popUpButton = this.embedTestPage.getByRole(this.embedTestPageType === "floatingPopup" ? "button" : "link", popUpButtonSelectorOptions);
@@ -120030,7 +120030,7 @@ class EditorPage {
120030
120030
  }).toPass({ timeout: 30_000 });
120031
120031
  focusText = (textLocator) => test.expect(async () => {
120032
120032
  await textLocator.click();
120033
- await this.page.keyboard.press(require$$0$5.platform() === "darwin" ? "Meta+ArrowRight" : "End");
120033
+ await this.page.keyboard.press(require$$0$4.platform() === "darwin" ? "Meta+ArrowRight" : "End");
120034
120034
  await test.expect(textLocator.locator("..")).toHaveClass(/has-focus/, {
120035
120035
  timeout: 5_000,
120036
120036
  });
@@ -124970,6 +124970,160 @@ const generatePhoneNumberDetails = () => {
124970
124970
  return { flag: country.flag, name: country.name, code: country.code, number };
124971
124971
  };
124972
124972
 
124973
+ const CONFIG = {
124974
+ DIR: "/tmp/neeto-auth-web",
124975
+ LOG: "/tmp/neeto-auth-server.log",
124976
+ PORT: 9000,
124977
+ MAX_WAIT_MS: 120_000,
124978
+ EMAIL_INIT: "/tmp/neeto-auth-web/config/initializers/playwright_email_capture.rb",
124979
+ };
124980
+ const SCRIPTS_DIR = path__namespace.join(__dirname, "scripts", "neeto-auth");
124981
+ const escapeRubyString = (value) => value.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
124982
+ const buildEmailCaptureInitializer = (targetApp) => {
124983
+ const template = fs__namespace.readFileSync(path__namespace.join(SCRIPTS_DIR, "playwright_email_capture.rb.template"), "utf-8");
124984
+ return template.replace("{{TARGET_APP}}", escapeRubyString(targetApp));
124985
+ };
124986
+ const log = (msg) => console.log(`[NeetoAuth] ${msg}`);
124987
+ const sleep = (ms) => new Promise(resolve => setTimeout(resolve, ms));
124988
+ const httpCheck = (port, timeout = 3000) => new Promise(resolve => {
124989
+ const req = http__namespace.get(`http://localhost:${port}/`, () => resolve(true));
124990
+ req.on("error", () => resolve(false));
124991
+ req.setTimeout(timeout, () => {
124992
+ req.destroy();
124993
+ resolve(false);
124994
+ });
124995
+ });
124996
+ class NeetoAuthServer {
124997
+ process = null;
124998
+ targetApp;
124999
+ constructor(appName) {
125000
+ this.targetApp = STATUS_TEXTS.appName(appName);
125001
+ }
125002
+ get serverEnv() {
125003
+ return {
125004
+ ...process.env,
125005
+ BUNDLE_PATH: undefined,
125006
+ RAILS_ENV: "development",
125007
+ POSTGRES_USER: process.env.POSTGRES_USER ?? process.env.USER ?? "postgres",
125008
+ };
125009
+ }
125010
+ waitForProcessExit = async (pid) => {
125011
+ const deadline = Date.now() + 10_000;
125012
+ while (Date.now() < deadline) {
125013
+ try {
125014
+ process.kill(pid, 0);
125015
+ await sleep(500);
125016
+ }
125017
+ catch {
125018
+ return;
125019
+ }
125020
+ }
125021
+ };
125022
+ killServerOnPort = async () => {
125023
+ try {
125024
+ child_process.execSync(`lsof -ti tcp:${CONFIG.PORT} | xargs kill -9`, {
125025
+ stdio: "ignore",
125026
+ });
125027
+ await sleep(1000);
125028
+ }
125029
+ catch {
125030
+ // No process on that port — nothing to kill.
125031
+ }
125032
+ };
125033
+ ensureSetup = () => {
125034
+ if (fs__namespace.existsSync(`${CONFIG.DIR}/Gemfile`)) {
125035
+ log("Already set up, skipping.");
125036
+ return;
125037
+ }
125038
+ if (!process.env.GITHUB_TOKEN) {
125039
+ throw new Error("[NeetoAuth] GITHUB_TOKEN is not set. Cannot clone neeto-auth-web.");
125040
+ }
125041
+ log("Running first-time setup...");
125042
+ const setupScript = path__namespace.join(SCRIPTS_DIR, "setup.sh");
125043
+ try {
125044
+ child_process.execSync(`bash "${setupScript}" "${CONFIG.DIR}"`, {
125045
+ stdio: "inherit",
125046
+ env: this.serverEnv,
125047
+ });
125048
+ }
125049
+ catch {
125050
+ throw new Error("[NeetoAuth] First-time setup failed. Check the output above for details.");
125051
+ }
125052
+ log("Setup complete.");
125053
+ };
125054
+ waitForServer = async (timeoutMs = CONFIG.MAX_WAIT_MS) => {
125055
+ const startTime = Date.now();
125056
+ while (Date.now() - startTime < timeoutMs) {
125057
+ if (this.process !== null && this.process.exitCode !== null) {
125058
+ const logContent = fs__namespace.existsSync(CONFIG.LOG)
125059
+ ? fs__namespace.readFileSync(CONFIG.LOG, "utf-8")
125060
+ : "<no log file>";
125061
+ throw new Error(`[NeetoAuth] Server process exited unexpectedly with code ${this.process.exitCode}.\nLog:\n${logContent}`);
125062
+ }
125063
+ if (await httpCheck(CONFIG.PORT))
125064
+ return;
125065
+ await sleep(3000);
125066
+ }
125067
+ const logContent = fs__namespace.existsSync(CONFIG.LOG)
125068
+ ? fs__namespace.readFileSync(CONFIG.LOG, "utf-8")
125069
+ : "<no log file>";
125070
+ throw new Error(`[NeetoAuth] Server did not start within ${timeoutMs / 1000}s.\nLog:\n${logContent}`);
125071
+ };
125072
+ injectEmailCaptureInitializer = () => {
125073
+ fs__namespace.writeFileSync(CONFIG.EMAIL_INIT, buildEmailCaptureInitializer(this.targetApp));
125074
+ };
125075
+ isRunningForCurrentApp = () => {
125076
+ if (!fs__namespace.existsSync(CONFIG.EMAIL_INIT))
125077
+ return false;
125078
+ const currentContent = fs__namespace.readFileSync(CONFIG.EMAIL_INIT, "utf-8");
125079
+ return currentContent === buildEmailCaptureInitializer(this.targetApp);
125080
+ };
125081
+ start = async () => {
125082
+ if (IS_STAGING_ENV)
125083
+ return;
125084
+ if (await httpCheck(CONFIG.PORT)) {
125085
+ if (this.isRunningForCurrentApp()) {
125086
+ log("Server already running for this app.");
125087
+ return;
125088
+ }
125089
+ log("Server running for a different app — restarting...");
125090
+ await this.killServerOnPort();
125091
+ }
125092
+ this.ensureSetup();
125093
+ this.injectEmailCaptureInitializer();
125094
+ log("Starting server...");
125095
+ const logStream = fs__namespace.createWriteStream(CONFIG.LOG);
125096
+ this.process = child_process.spawn("bundle", [
125097
+ "exec",
125098
+ "rails",
125099
+ "server",
125100
+ "-p",
125101
+ CONFIG.PORT.toString(),
125102
+ "-b",
125103
+ "0.0.0.0",
125104
+ ], {
125105
+ cwd: CONFIG.DIR,
125106
+ stdio: ["ignore", "pipe", "pipe"],
125107
+ env: this.serverEnv,
125108
+ });
125109
+ this.process.stdout?.pipe(logStream);
125110
+ this.process.stderr?.pipe(logStream);
125111
+ await this.waitForServer();
125112
+ log("Server ready.");
125113
+ };
125114
+ stop = async () => {
125115
+ if (IS_STAGING_ENV || !this.process)
125116
+ return;
125117
+ const pid = this.process.pid;
125118
+ log("Stopping server...");
125119
+ this.process.kill("SIGTERM");
125120
+ this.process = null;
125121
+ if (pid) {
125122
+ await this.waitForProcessExit(pid);
125123
+ }
125124
+ };
125125
+ }
125126
+
124973
125127
  var main$1 = {exports: {}};
124974
125128
 
124975
125129
  var version = "17.3.1";
@@ -124981,10 +125135,10 @@ var hasRequiredMain$1;
124981
125135
  function requireMain$1 () {
124982
125136
  if (hasRequiredMain$1) return main$1.exports;
124983
125137
  hasRequiredMain$1 = 1;
124984
- const fs = require$$0$4;
125138
+ const fs = fs$4;
124985
125139
  const path = path$1;
124986
- const os = require$$0$5;
124987
- const crypto = require$$0$9;
125140
+ const os = require$$0$4;
125141
+ const crypto = require$$0$8;
124988
125142
  const packageJson = require$$4;
124989
125143
 
124990
125144
  const version = packageJson.version;
@@ -125535,7 +125689,7 @@ const envLocalPath = `${envBasePath}.local`;
125535
125689
  const reporterPackageName = "@bigbinary/neeto-playwright-reporter";
125536
125690
  process.env.TEST_ENV = process.env.TEST_ENV ?? ENVIRONMENT.development;
125537
125691
  loadEnv(`${envBasePath}.${process.env.TEST_ENV}`);
125538
- require$$0__namespace.existsSync(envLocalPath) && loadEnv(envLocalPath);
125692
+ fs__namespace.existsSync(envLocalPath) && loadEnv(envLocalPath);
125539
125693
  const playdashStagingConfig = {
125540
125694
  apiKey: process.env.PLAYDASH_STAGING_API_KEY,
125541
125695
  ciBuildId: process.env.NEETO_CI_JOB_ID,
@@ -125816,6 +125970,7 @@ exports.NEETO_IMAGE_UPLOADER_SELECTORS = NEETO_IMAGE_UPLOADER_SELECTORS;
125816
125970
  exports.NEETO_ROUTES = NEETO_ROUTES;
125817
125971
  exports.NEETO_SEO_SELECTORS = NEETO_SEO_SELECTORS;
125818
125972
  exports.NEETO_TEXT_MODIFIER_SELECTORS = NEETO_TEXT_MODIFIER_SELECTORS;
125973
+ exports.NeetoAuthServer = NeetoAuthServer;
125819
125974
  exports.NeetoTowerApi = NeetoTowerApi;
125820
125975
  exports.ONBOARDING_SELECTORS = ONBOARDING_SELECTORS;
125821
125976
  exports.ORGANIZATION_TEXTS = ORGANIZATION_TEXTS;