@bigbinary/neeto-playwright-commons 2.1.4 → 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/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,17 +6268,14 @@ class CustomCommands {
6266
6268
  await test.expect(locator).toBeChecked({ checked: shouldBeChecked });
6267
6269
  }).toPass({ timeout: 15_000 });
6268
6270
  moveCursorAtBottom = async () => {
6269
- const platform = require$$0$5.platform();
6270
- if (platform === "darwin") {
6271
- await this.page.keyboard.press("Meta+ArrowRight");
6272
- await this.page.keyboard.press("Meta+ArrowDown");
6273
- }
6274
- else {
6275
- await this.page.keyboard.press("End");
6276
- await this.page.keyboard.press("PageDown");
6277
- }
6271
+ const isMacOS = require$$0$4.platform() === "darwin";
6272
+ const rightArrowKey = isMacOS ? "Meta+ArrowRight" : "End";
6273
+ const downArrowKey = isMacOS ? "Meta+ArrowDown" : "PageDown";
6274
+ await this.page.keyboard.press(rightArrowKey);
6275
+ await this.page.keyboard.press(rightArrowKey);
6276
+ await this.page.keyboard.press(downArrowKey);
6278
6277
  // eslint-disable-next-line playwright/no-wait-for-timeout
6279
- await this.page.waitForTimeout(100); // Adding some delay for DOM to react
6278
+ await this.page.waitForTimeout(150); // Adding some delay for DOM to react
6280
6279
  await this.page.keyboard.press("Enter");
6281
6280
  };
6282
6281
  }
@@ -8910,7 +8909,7 @@ function requireSafer () {
8910
8909
  if (hasRequiredSafer) return safer_1;
8911
8910
  hasRequiredSafer = 1;
8912
8911
 
8913
- var buffer = require$$0$6;
8912
+ var buffer = require$$0$5;
8914
8913
  var Buffer = buffer.Buffer;
8915
8914
 
8916
8915
  var safer = {};
@@ -26605,7 +26604,7 @@ function requireCharset () {
26605
26604
  if (hasRequiredCharset) return charset.exports;
26606
26605
  hasRequiredCharset = 1;
26607
26606
 
26608
- const { Buffer } = require$$0$7;
26607
+ const { Buffer } = require$$0$6;
26609
26608
  const iconv = requireLib$b();
26610
26609
  const encodingJapanese = requireSrc$2();
26611
26610
  const charsets = requireCharsets();
@@ -26731,7 +26730,7 @@ function requireLibbase64 () {
26731
26730
  if (hasRequiredLibbase64) return libbase64;
26732
26731
  hasRequiredLibbase64 = 1;
26733
26732
 
26734
- const { Buffer } = require$$0$7;
26733
+ const { Buffer } = require$$0$6;
26735
26734
  const stream = require$$1$3;
26736
26735
  const Transform = stream.Transform;
26737
26736
 
@@ -26992,7 +26991,7 @@ function requireLibqp () {
26992
26991
  if (hasRequiredLibqp) return libqp;
26993
26992
  hasRequiredLibqp = 1;
26994
26993
 
26995
- const { Buffer } = require$$0$7;
26994
+ const { Buffer } = require$$0$6;
26996
26995
  const stream = require$$1$3;
26997
26996
  const Transform = stream.Transform;
26998
26997
 
@@ -29367,7 +29366,7 @@ function requireLibmime () {
29367
29366
  if (hasRequiredLibmime) return libmime.exports;
29368
29367
  hasRequiredLibmime = 1;
29369
29368
 
29370
- const { Buffer } = require$$0$7;
29369
+ const { Buffer } = require$$0$6;
29371
29370
  const libcharset = requireCharset();
29372
29371
  const libbase64 = requireLibbase64();
29373
29372
  const libqp = requireLibqp();
@@ -30548,7 +30547,7 @@ function requireMimeNode () {
30548
30547
  const libmime = requireLibmime();
30549
30548
  const libqp = requireLibqp();
30550
30549
  const libbase64 = requireLibbase64();
30551
- const PassThrough = require$$0$8.PassThrough;
30550
+ const PassThrough = require$$0$7.PassThrough;
30552
30551
  const pathlib = path$1;
30553
30552
 
30554
30553
  class MimeNode {
@@ -30817,7 +30816,7 @@ function requireMessageSplitter () {
30817
30816
  if (hasRequiredMessageSplitter) return messageSplitter;
30818
30817
  hasRequiredMessageSplitter = 1;
30819
30818
 
30820
- const Transform = require$$0$8.Transform;
30819
+ const Transform = require$$0$7.Transform;
30821
30820
  const MimeNode = requireMimeNode();
30822
30821
 
30823
30822
  const MAX_HEAD_SIZE = 1 * 1024 * 1024;
@@ -31247,7 +31246,7 @@ function requireMessageJoiner () {
31247
31246
  if (hasRequiredMessageJoiner) return messageJoiner;
31248
31247
  hasRequiredMessageJoiner = 1;
31249
31248
 
31250
- const Transform = require$$0$8.Transform;
31249
+ const Transform = require$$0$7.Transform;
31251
31250
 
31252
31251
  class MessageJoiner extends Transform {
31253
31252
  constructor() {
@@ -31287,7 +31286,7 @@ function requireFlowedDecoder () {
31287
31286
 
31288
31287
  // Helper class to rewrite nodes with specific mime type
31289
31288
 
31290
- const Transform = require$$0$8.Transform;
31289
+ const Transform = require$$0$7.Transform;
31291
31290
  const libmime = requireLibmime();
31292
31291
 
31293
31292
  /**
@@ -31350,7 +31349,7 @@ function requireNodeRewriter () {
31350
31349
 
31351
31350
  // Helper class to rewrite nodes with specific mime type
31352
31351
 
31353
- const Transform = require$$0$8.Transform;
31352
+ const Transform = require$$0$7.Transform;
31354
31353
  const FlowedDecoder = requireFlowedDecoder();
31355
31354
 
31356
31355
  /**
@@ -31552,7 +31551,7 @@ function requireNodeStreamer () {
31552
31551
 
31553
31552
  // Helper class to rewrite nodes with specific mime type
31554
31553
 
31555
- const Transform = require$$0$8.Transform;
31554
+ const Transform = require$$0$7.Transform;
31556
31555
  const FlowedDecoder = requireFlowedDecoder();
31557
31556
 
31558
31557
  /**
@@ -31679,7 +31678,7 @@ function requireChunkedPassthrough () {
31679
31678
  if (hasRequiredChunkedPassthrough) return chunkedPassthrough;
31680
31679
  hasRequiredChunkedPassthrough = 1;
31681
31680
 
31682
- const { Transform } = require$$0$8;
31681
+ const { Transform } = require$$0$7;
31683
31682
 
31684
31683
  class ChunkedPassthrough extends Transform {
31685
31684
  constructor(options = {}) {
@@ -32605,8 +32604,8 @@ function requireStreamHash () {
32605
32604
  if (hasRequiredStreamHash) return streamHash;
32606
32605
  hasRequiredStreamHash = 1;
32607
32606
 
32608
- const crypto = require$$0$9;
32609
- const Transform = require$$0$8.Transform;
32607
+ const crypto = require$$0$8;
32608
+ const Transform = require$$0$7.Transform;
32610
32609
 
32611
32610
  class StreamHash extends Transform {
32612
32611
  constructor(attachment, algo) {
@@ -54989,7 +54988,7 @@ function requireMailParser () {
54989
54988
  const mailsplit = requireMailsplit();
54990
54989
  const libmime = requireLibmime();
54991
54990
  const addressparser = requireAddressparser();
54992
- const Transform = require$$0$8.Transform;
54991
+ const Transform = require$$0$7.Transform;
54993
54992
  const Splitter = mailsplit.Splitter;
54994
54993
  const ChunkedPassthrough = mailsplit.ChunkedPassthrough;
54995
54994
  const punycode = require$$4$2;
@@ -60623,9 +60622,7 @@ class MailerUtils {
60623
60622
  const { html: { codes }, } = await this.findMessage({ to: email, subject: subjectSubstring }, { timeout, receivedAfter, expectedEmailCount });
60624
60623
  return codes?.[0];
60625
60624
  };
60626
- generateRandomEmail = (shouldUseBypassEmail = false) => shouldUseBypassEmail
60627
- ? generateRandomBypassEmail()
60628
- : faker.faker.internet.email({ provider: process.env.FASTMAIL_DOMAIN_NAME });
60625
+ generateRandomEmail = () => faker.faker.internet.email({ provider: process.env.FASTMAIL_DOMAIN_NAME });
60629
60626
  getEmailAttachment = async (attachmentName, messageSearchCriteria = {}, { timeout = 10_000, receivedAfter = dateTimeOneHourAgo(), expectedEmailCount = 1, } = {}, shouldThrowErrorOnTimeout = true) => {
60630
60627
  if (IS_DEV_ENV) {
60631
60628
  return this.railsEmailUtils.getEmailAttachment(attachmentName, messageSearchCriteria, { receivedAfter, expectedEmailCount, timeout: timeout / 3 }, shouldThrowErrorOnTimeout);
@@ -67009,7 +67006,7 @@ function requireGifutil () {
67009
67006
 
67010
67007
  /** @namespace GifUtil */
67011
67008
 
67012
- const fs = require$$0$4;
67009
+ const fs = fs$4;
67013
67010
  const ImageQ = requireImageQ();
67014
67011
 
67015
67012
  const BitmapImage = requireBitmapimage();
@@ -69826,7 +69823,7 @@ function requireChunkstream () {
69826
69823
  hasRequiredChunkstream = 1;
69827
69824
 
69828
69825
  let util = require$$0$3;
69829
- let Stream = require$$0$8;
69826
+ let Stream = require$$0$7;
69830
69827
 
69831
69828
  let ChunkStream = (chunkstream.exports = function () {
69832
69829
  Stream.call(this);
@@ -71795,7 +71792,7 @@ function requirePackerAsync () {
71795
71792
  hasRequiredPackerAsync = 1;
71796
71793
 
71797
71794
  let util = require$$0$3;
71798
- let Stream = require$$0$8;
71795
+ let Stream = require$$0$7;
71799
71796
  let constants = requireConstants$4();
71800
71797
  let Packer = requirePacker();
71801
71798
 
@@ -71856,11 +71853,11 @@ function requireSyncInflate () {
71856
71853
  hasRequiredSyncInflate = 1;
71857
71854
  (function (module, exports$1) {
71858
71855
 
71859
- let assert = require$$0$a.ok;
71856
+ let assert = require$$0$9.ok;
71860
71857
  let zlib = require$$1$4;
71861
71858
  let util = require$$0$3;
71862
71859
 
71863
- let kMaxLength = require$$0$6.kMaxLength;
71860
+ let kMaxLength = require$$0$5.kMaxLength;
71864
71861
 
71865
71862
  function Inflate(opts) {
71866
71863
  if (!(this instanceof Inflate)) {
@@ -72317,7 +72314,7 @@ function requirePng () {
72317
72314
  hasRequiredPng = 1;
72318
72315
 
72319
72316
  let util = require$$0$3;
72320
- let Stream = require$$0$8;
72317
+ let Stream = require$$0$7;
72321
72318
  let Parser = requireParserAsync();
72322
72319
  let Packer = requirePackerAsync();
72323
72320
  let PNGSync = requirePngSync();
@@ -89475,8 +89472,8 @@ function to(promise, errorExt) {
89475
89472
  });
89476
89473
  }
89477
89474
 
89478
- const readFile = require$$0$4.promises.readFile;
89479
- const writeFile = require$$0$4.promises.writeFile;
89475
+ const readFile = fs$4.promises.readFile;
89476
+ const writeFile = fs$4.promises.writeFile;
89480
89477
 
89481
89478
  var Mime_1;
89482
89479
  var hasRequiredMime;
@@ -91547,7 +91544,7 @@ function createJimp({ plugins: pluginsArg, formats: formatsArg, } = {}) {
91547
91544
  if (Buffer.isBuffer(url) || url instanceof ArrayBuffer) {
91548
91545
  return this.fromBuffer(url);
91549
91546
  }
91550
- if (require$$0$4.existsSync(url)) {
91547
+ if (fs$4.existsSync(url)) {
91551
91548
  return this.fromBuffer(await readFile(url));
91552
91549
  }
91553
91550
  const [fetchErr, response] = await to(fetch(url));
@@ -107151,7 +107148,7 @@ var jsQR = /*@__PURE__*/getDefaultExportFromCjs(jsQRExports);
107151
107148
  const decodeQRCodeFromFile = async (filePath) => {
107152
107149
  let decodedString;
107153
107150
  try {
107154
- const buffer = require$$0$4.readFileSync(filePath);
107151
+ const buffer = fs$4.readFileSync(filePath);
107155
107152
  const image = await Jimp.read(buffer);
107156
107153
  const bitmapData = new Uint8ClampedArray(image.bitmap.data);
107157
107154
  const qrData = jsQR(bitmapData, image.bitmap.width, image.bitmap.height);
@@ -107188,7 +107185,7 @@ class QRCodeUtils {
107188
107185
  decodeQRCodeFromFile = async (filePath) => {
107189
107186
  let decodedString;
107190
107187
  try {
107191
- const buffer = require$$0$4.readFileSync(filePath);
107188
+ const buffer = fs$4.readFileSync(filePath);
107192
107189
  const image = await Jimp.read(buffer);
107193
107190
  const bitmapData = new Uint8ClampedArray(image.bitmap.data);
107194
107191
  const qrData = jsQR(bitmapData, image.bitmap.width, image.bitmap.height);
@@ -108044,7 +108041,7 @@ var hasRequiredSupportsColor;
108044
108041
  function requireSupportsColor () {
108045
108042
  if (hasRequiredSupportsColor) return supportsColor_1;
108046
108043
  hasRequiredSupportsColor = 1;
108047
- const os = require$$0$5;
108044
+ const os = require$$0$4;
108048
108045
  const hasFlag = requireHasFlag();
108049
108046
 
108050
108047
  const env = process.env;
@@ -108187,7 +108184,7 @@ function requireNode () {
108187
108184
  if (hasRequiredNode) return node.exports;
108188
108185
  hasRequiredNode = 1;
108189
108186
  (function (module, exports$1) {
108190
- const tty = require$$0$b;
108187
+ const tty = require$$0$a;
108191
108188
  const util = require$$0$3;
108192
108189
 
108193
108190
  /**
@@ -109514,7 +109511,7 @@ function requirePath () {
109514
109511
  hasRequiredPath = 1;
109515
109512
  Object.defineProperty(path, "__esModule", { value: true });
109516
109513
  path.convertPosixPathToPattern = path.convertWindowsPathToPattern = path.convertPathToPattern = path.escapePosixPath = path.escapeWindowsPath = path.escape = path.removeLeadingDotSegment = path.makeAbsolute = path.unixify = void 0;
109517
- const os = require$$0$5;
109514
+ const os = require$$0$4;
109518
109515
  const path$2 = path$1;
109519
109516
  const IS_WINDOWS_PLATFORM = os.platform() === 'win32';
109520
109517
  const LEADING_DOT_SEGMENT_CHARACTERS_COUNT = 2; // ./ or .\\
@@ -109781,7 +109778,7 @@ function requireGlobParent () {
109781
109778
 
109782
109779
  var isGlob = requireIsGlob();
109783
109780
  var pathPosixDirname = path$1.posix.dirname;
109784
- var isWin32 = require$$0$5.platform() === 'win32';
109781
+ var isWin32 = require$$0$4.platform() === 'win32';
109785
109782
 
109786
109783
  var slash = '/';
109787
109784
  var backslash = /\\/g;
@@ -114174,7 +114171,7 @@ function requireMerge2 () {
114174
114171
  * Copyright (c) 2014-2020 Teambition
114175
114172
  * Licensed under the MIT license.
114176
114173
  */
114177
- const Stream = require$$0$8;
114174
+ const Stream = require$$0$7;
114178
114175
  const PassThrough = Stream.PassThrough;
114179
114176
  const slice = Array.prototype.slice;
114180
114177
 
@@ -114603,7 +114600,7 @@ function requireFs$2 () {
114603
114600
  (function (exports$1) {
114604
114601
  Object.defineProperty(exports$1, "__esModule", { value: true });
114605
114602
  exports$1.createFileSystemAdapter = exports$1.FILE_SYSTEM_ADAPTER = void 0;
114606
- const fs = require$$0$4;
114603
+ const fs = fs$4;
114607
114604
  exports$1.FILE_SYSTEM_ADAPTER = {
114608
114605
  lstat: fs.lstat,
114609
114606
  stat: fs.stat,
@@ -115033,7 +115030,7 @@ function requireFs () {
115033
115030
  (function (exports$1) {
115034
115031
  Object.defineProperty(exports$1, "__esModule", { value: true });
115035
115032
  exports$1.createFileSystemAdapter = exports$1.FILE_SYSTEM_ADAPTER = void 0;
115036
- const fs = require$$0$4;
115033
+ const fs = fs$4;
115037
115034
  exports$1.FILE_SYSTEM_ADAPTER = {
115038
115035
  lstat: fs.lstat,
115039
115036
  stat: fs.stat,
@@ -115666,7 +115663,7 @@ function requireStream$2 () {
115666
115663
  if (hasRequiredStream$2) return stream$2;
115667
115664
  hasRequiredStream$2 = 1;
115668
115665
  Object.defineProperty(stream$2, "__esModule", { value: true });
115669
- const stream_1 = require$$0$8;
115666
+ const stream_1 = require$$0$7;
115670
115667
  const async_1 = requireAsync$3();
115671
115668
  class StreamProvider {
115672
115669
  constructor(_root, _settings) {
@@ -115918,7 +115915,7 @@ function requireStream$1 () {
115918
115915
  if (hasRequiredStream$1) return stream$1;
115919
115916
  hasRequiredStream$1 = 1;
115920
115917
  Object.defineProperty(stream$1, "__esModule", { value: true });
115921
- const stream_1 = require$$0$8;
115918
+ const stream_1 = require$$0$7;
115922
115919
  const fsStat = requireOut$3();
115923
115920
  const fsWalk = requireOut$1();
115924
115921
  const reader_1 = requireReader();
@@ -116436,7 +116433,7 @@ function requireStream () {
116436
116433
  if (hasRequiredStream) return stream;
116437
116434
  hasRequiredStream = 1;
116438
116435
  Object.defineProperty(stream, "__esModule", { value: true });
116439
- const stream_1 = require$$0$8;
116436
+ const stream_1 = require$$0$7;
116440
116437
  const stream_2 = requireStream$1();
116441
116438
  const provider_1 = requireProvider();
116442
116439
  class ProviderStream extends provider_1.default {
@@ -116562,8 +116559,8 @@ function requireSettings () {
116562
116559
  (function (exports$1) {
116563
116560
  Object.defineProperty(exports$1, "__esModule", { value: true });
116564
116561
  exports$1.DEFAULT_FILE_SYSTEM_ADAPTER = void 0;
116565
- const fs = require$$0$4;
116566
- const os = require$$0$5;
116562
+ const fs = fs$4;
116563
+ const os = require$$0$4;
116567
116564
  /**
116568
116565
  * The `os.cpus` method can return zero. We expect the number of cores to be greater than zero.
116569
116566
  * https://github.com/nodejs/node/blob/7faeddf23a98c53896f8b574a6e66589e8fb1eb8/lib/os.js#L106-L107
@@ -116919,7 +116916,7 @@ class EmbedBase {
116919
116916
  ? `${embedCode}<a href='#' id='open-popup-button'>${customElementText}</a>`
116920
116917
  : embedCode);
116921
116918
  this.filePath = `tmp/${faker.faker.word.noun()}.html`;
116922
- require$$0$4.writeFileSync(this.filePath, fileContent, "utf8");
116919
+ fs$4.writeFileSync(this.filePath, fileContent, "utf8");
116923
116920
  await this.embedTestPage.goto(`file://${path$1.resolve(this.filePath)}`, {
116924
116921
  timeout: 20_000,
116925
116922
  });
@@ -116939,7 +116936,7 @@ class EmbedBase {
116939
116936
  }
116940
116937
  await this.embedTestPage.close();
116941
116938
  await this.context.close();
116942
- require$$0$4.unlinkSync(this.filePath);
116939
+ fs$4.unlinkSync(this.filePath);
116943
116940
  };
116944
116941
  clickOnPopupButton = async (popUpButtonSelectorOptions) => {
116945
116942
  const popUpButton = this.embedTestPage.getByRole(this.embedTestPageType === "floatingPopup" ? "button" : "link", popUpButtonSelectorOptions);
@@ -118876,7 +118873,7 @@ class HelpAndProfilePage {
118876
118873
  test.expect(bodyElement).not.toHaveClass(THEMES_TEXTS.lightThemeClass),
118877
118874
  ]);
118878
118875
  await test.expect(this.page.getByTestId(COMMON_SELECTORS.dropdownContainer).filter({
118879
- has: this.page.getByTestId(PROFILE_SECTION_SELECTORS.myProfileButton),
118876
+ has: this.page.getByTestId(PROFILE_SECTION_SELECTORS.profileExpandMenuBtn),
118880
118877
  })).toHaveScreenshot(expectedScreenshot, { maxDiffPixelRatio: 0.1 });
118881
118878
  });
118882
118879
  };
@@ -119899,7 +119896,7 @@ class EditorPage {
119899
119896
  calloutSelector;
119900
119897
  videoUploadOption;
119901
119898
  todoListSelector;
119902
- filePath = "../../../e2e/assets/images/BigBinary.png";
119899
+ filePath = "../../../e2e/assets/images/sample.png";
119903
119900
  videoPath = "../../../e2e/assets/files/sample.mp4";
119904
119901
  linkUrl = faker.faker.internet.url();
119905
119902
  imageUrl = "https://picsum.photos/200/300";
@@ -119964,10 +119961,9 @@ class EditorPage {
119964
119961
  };
119965
119962
  verifyFontSize = async () => {
119966
119963
  const fontsAndTexts = [];
119967
- const fontSizeDropdownButton = this.page.getByTestId(NEETO_EDITOR_SELECTORS.neetoEditorFixedMenuFontSize);
119968
- await this.contentField.focus();
119969
- await this.contentField.press("Enter");
119970
- await fontSizeDropdownButton.click();
119964
+ await this.page
119965
+ .getByTestId(NEETO_EDITOR_SELECTORS.neetoEditorFixedMenuFontSize)
119966
+ .click();
119971
119967
  const headingButtons = await this.page
119972
119968
  .getByTestId(COMMON_SELECTORS.dropdownContainer)
119973
119969
  .getByRole("button")
@@ -119989,10 +119985,7 @@ class EditorPage {
119989
119985
  level: Number(headingLevel?.slice(1)),
119990
119986
  name: randomText,
119991
119987
  })).toBeVisible();
119992
- fontsAndTexts.push({
119993
- key: fontKey,
119994
- value: randomText,
119995
- });
119988
+ fontsAndTexts.push({ key: fontKey, value: randomText });
119996
119989
  }
119997
119990
  return fontsAndTexts;
119998
119991
  };
@@ -120035,18 +120028,13 @@ class EditorPage {
120035
120028
  .click();
120036
120029
  await test.expect(this.page.getByTestId(COMMON_SELECTORS.customDropdownContainer())).toBeVisible({ timeout: 5_000 });
120037
120030
  }).toPass({ timeout: 30_000 });
120038
- focusText = (textLocator) => {
120039
- const platform = require$$0$5.platform();
120040
- return test.expect(async () => {
120041
- await textLocator.click();
120042
- platform === "darwin"
120043
- ? await this.page.keyboard.press("Meta+ArrowRight")
120044
- : await this.page.keyboard.press("End");
120045
- await test.expect(textLocator.locator("..")).toHaveClass(/has-focus/, {
120046
- timeout: 5_000,
120047
- });
120048
- }).toPass({ timeout: 20_000 });
120049
- };
120031
+ focusText = (textLocator) => test.expect(async () => {
120032
+ await textLocator.click();
120033
+ await this.page.keyboard.press(require$$0$4.platform() === "darwin" ? "Meta+ArrowRight" : "End");
120034
+ await test.expect(textLocator.locator("..")).toHaveClass(/has-focus/, {
120035
+ timeout: 5_000,
120036
+ });
120037
+ }).toPass({ timeout: 20_000 });
120050
120038
  highlightText = async (isButtonInMoreMenu, colorIndex) => {
120051
120039
  const randomText = await this.fillRandomText();
120052
120040
  await this.openHighlighterContainer(isButtonInMoreMenu);
@@ -120145,9 +120133,7 @@ class EditorPage {
120145
120133
  .getByTestId(COMMON_SELECTORS.dropdownIcon)
120146
120134
  .click();
120147
120135
  await this.uploadDeleteButton.click();
120148
- await test.expect(this.imageWrapper).toBeHidden({
120149
- timeout: 15_000,
120150
- });
120136
+ await test.expect(this.imageWrapper).toBeHidden({ timeout: 15_000 });
120151
120137
  }
120152
120138
  return [{ key: "image-upload", value: imagePath }];
120153
120139
  };
@@ -120193,9 +120179,7 @@ class EditorPage {
120193
120179
  isButtonInMoreMenu && (await this.moreMenuSelector.click());
120194
120180
  await this.emojiSelector.click();
120195
120181
  const emojiContainer = this.page.getByTestId(NEETO_EDITOR_SELECTORS.emojiContainer);
120196
- await test.expect(emojiContainer).toBeVisible({
120197
- timeout: 10_000,
120198
- });
120182
+ await test.expect(emojiContainer).toBeVisible({ timeout: 10_000 });
120199
120183
  await emojiContainer
120200
120184
  .getByPlaceholder(DESCRIPTION_EDITOR_TEXTS.search)
120201
120185
  .fill(EMOJI_LABEL);
@@ -120259,9 +120243,7 @@ class EditorPage {
120259
120243
  .getByTestId(COMMON_SELECTORS.dropdownIcon)
120260
120244
  .click();
120261
120245
  await this.uploadDeleteButton.click();
120262
- await test.expect(this.imageWrapper).toBeHidden({
120263
- timeout: 15_000,
120264
- });
120246
+ await test.expect(this.imageWrapper).toBeHidden({ timeout: 15_000 });
120265
120247
  }
120266
120248
  return [{ key: "video-upload", value: this.videoPath }];
120267
120249
  };
@@ -120354,9 +120336,44 @@ class EditorPage {
120354
120336
  this.wordsUsedInEditor.push(randomText);
120355
120337
  const randomTextLocator = this.contentField.getByText(randomText);
120356
120338
  await randomTextLocator.scrollIntoViewIfNeeded();
120357
- await randomTextLocator.click({ clickCount: 3 });
120339
+ const box = await randomTextLocator.boundingBox();
120340
+ await randomTextLocator.click({
120341
+ clickCount: 3,
120342
+ ...(box && { position: { x: box.width * 0.99, y: box.height / 2 } }),
120343
+ });
120358
120344
  return randomText;
120359
120345
  };
120346
+ verifyDescriptionPreview = (previewLocator, keyValuePairs) => Promise.all(keyValuePairs.flatMap(({ key, value }) => {
120347
+ const elementReplacement = {
120348
+ bold: "strong",
120349
+ italic: "em",
120350
+ underline: "u",
120351
+ link: "a",
120352
+ strike: "s",
120353
+ bulletList: "ul li",
120354
+ orderedList: "ol li",
120355
+ codeBlock: "pre",
120356
+ emoji: "span",
120357
+ };
120358
+ if (key.includes("highlight")) {
120359
+ const highlightIndex = key.split("-")[1];
120360
+ return test.expect(previewLocator.locator(`span[style*="background-color: var(${NEETO_EDITOR_SELECTORS.highlightBg(Number(highlightIndex))})"][style*="color: var(${NEETO_EDITOR_SELECTORS.highlightText(Number(highlightIndex))})"]`, { hasText: value })).toBeVisible();
120361
+ }
120362
+ if (key === "todoList") {
120363
+ return test.expect(previewLocator.locator(NEETO_EDITOR_SELECTORS.todoList, {
120364
+ hasText: value,
120365
+ })).toBeVisible();
120366
+ }
120367
+ const replacement = elementReplacement?.[key] ?? key;
120368
+ if (value === undefined) {
120369
+ return test.expect(
120370
+ // eslint-disable-next-line playwright/no-nth-methods
120371
+ previewLocator.locator(replacement).first()).toBeVisible();
120372
+ }
120373
+ return test.expect(previewLocator.locator(key === "image-upload"
120374
+ ? `img[src*="sample"]`
120375
+ : `${replacement}:has-text("${value}")`)).toBeVisible();
120376
+ }));
120360
120377
  verifyDescriptionEditor = async ({ dynamicVariables, linkUrl, videoPath, filePath, imageUrl, videoUrl, highlighterCount, cannedResponseSuccessMessage, } = {}) => {
120361
120378
  this.linkUrl = linkUrl || this.linkUrl;
120362
120379
  this.filePath = filePath || this.filePath;
@@ -124953,6 +124970,160 @@ const generatePhoneNumberDetails = () => {
124953
124970
  return { flag: country.flag, name: country.name, code: country.code, number };
124954
124971
  };
124955
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
+
124956
125127
  var main$1 = {exports: {}};
124957
125128
 
124958
125129
  var version = "17.3.1";
@@ -124964,10 +125135,10 @@ var hasRequiredMain$1;
124964
125135
  function requireMain$1 () {
124965
125136
  if (hasRequiredMain$1) return main$1.exports;
124966
125137
  hasRequiredMain$1 = 1;
124967
- const fs = require$$0$4;
125138
+ const fs = fs$4;
124968
125139
  const path = path$1;
124969
- const os = require$$0$5;
124970
- const crypto = require$$0$9;
125140
+ const os = require$$0$4;
125141
+ const crypto = require$$0$8;
124971
125142
  const packageJson = require$$4;
124972
125143
 
124973
125144
  const version = packageJson.version;
@@ -125518,7 +125689,7 @@ const envLocalPath = `${envBasePath}.local`;
125518
125689
  const reporterPackageName = "@bigbinary/neeto-playwright-reporter";
125519
125690
  process.env.TEST_ENV = process.env.TEST_ENV ?? ENVIRONMENT.development;
125520
125691
  loadEnv(`${envBasePath}.${process.env.TEST_ENV}`);
125521
- require$$0__namespace.existsSync(envLocalPath) && loadEnv(envLocalPath);
125692
+ fs__namespace.existsSync(envLocalPath) && loadEnv(envLocalPath);
125522
125693
  const playdashStagingConfig = {
125523
125694
  apiKey: process.env.PLAYDASH_STAGING_API_KEY,
125524
125695
  ciBuildId: process.env.NEETO_CI_JOB_ID,
@@ -125799,6 +125970,7 @@ exports.NEETO_IMAGE_UPLOADER_SELECTORS = NEETO_IMAGE_UPLOADER_SELECTORS;
125799
125970
  exports.NEETO_ROUTES = NEETO_ROUTES;
125800
125971
  exports.NEETO_SEO_SELECTORS = NEETO_SEO_SELECTORS;
125801
125972
  exports.NEETO_TEXT_MODIFIER_SELECTORS = NEETO_TEXT_MODIFIER_SELECTORS;
125973
+ exports.NeetoAuthServer = NeetoAuthServer;
125802
125974
  exports.NeetoTowerApi = NeetoTowerApi;
125803
125975
  exports.ONBOARDING_SELECTORS = ONBOARDING_SELECTORS;
125804
125976
  exports.ORGANIZATION_TEXTS = ORGANIZATION_TEXTS;