@bigbinary/neeto-playwright-commons 2.1.5 → 2.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/index.cjs.js +332 -146
- package/index.cjs.js.map +1 -1
- package/index.d.ts +43 -22
- package/index.js +332 -149
- package/index.js.map +1 -1
- package/package.json +3 -2
- package/scripts/neeto-auth/playwright_email_capture.rb.template +59 -0
- package/scripts/neeto-auth/setup.sh +24 -0
package/index.js
CHANGED
|
@@ -1,31 +1,32 @@
|
|
|
1
|
-
import { spawn, execSync } from 'child_process';
|
|
2
1
|
import { keysToSnakeCase, hyphenate, isNotPresent, humanize, isPresent, dynamicArray, findBy, truncate, isNotEmpty, isNotEqualDeep, randomPick } from '@bigbinary/neeto-cist';
|
|
3
2
|
import { faker } from '@faker-js/faker';
|
|
4
|
-
import * as
|
|
5
|
-
import
|
|
6
|
-
import require$$0$
|
|
3
|
+
import * as fs$4 from 'fs';
|
|
4
|
+
import fs__default, { readFileSync, promises, existsSync, writeFileSync, unlinkSync } from 'fs';
|
|
5
|
+
import require$$0$4 from 'os';
|
|
7
6
|
import * as path$1 from 'path';
|
|
8
7
|
import path__default from 'path';
|
|
9
8
|
import test, { expect, test as test$1, chromium as chromium$1, defineConfig, devices } from '@playwright/test';
|
|
10
9
|
import { getI18nInstance, initI18n } from 'playwright-i18next-fixture';
|
|
11
|
-
import require$$0$
|
|
10
|
+
import require$$0$3 from 'util';
|
|
12
11
|
import { curry, isNotNil, not, isEmpty, pluck, mergeAll, isNil, mergeDeepLeft } from 'ramda';
|
|
12
|
+
import { execSync, spawn } from 'child_process';
|
|
13
13
|
import dayjs from 'dayjs';
|
|
14
|
-
import require$$0$
|
|
15
|
-
import require$$0$
|
|
16
|
-
import require$$0$
|
|
14
|
+
import require$$0$7 from 'stream';
|
|
15
|
+
import require$$0$6 from 'node:buffer';
|
|
16
|
+
import require$$0$5 from 'buffer';
|
|
17
17
|
import require$$1$2 from 'string_decoder';
|
|
18
18
|
import require$$1$3 from 'node:stream';
|
|
19
|
-
import require$$0$
|
|
19
|
+
import require$$0$8 from 'crypto';
|
|
20
20
|
import require$$1$4 from 'zlib';
|
|
21
|
-
import require$$0$
|
|
22
|
-
import require$$0$
|
|
21
|
+
import require$$0$9 from 'assert';
|
|
22
|
+
import require$$0$a from 'tty';
|
|
23
23
|
import stealth$1 from 'puppeteer-extra-plugin-stealth';
|
|
24
24
|
import require$$1$5 from 'events';
|
|
25
25
|
import customParseFormat from 'dayjs/plugin/customParseFormat';
|
|
26
26
|
import timezone from 'dayjs/plugin/timezone';
|
|
27
27
|
import utc from 'dayjs/plugin/utc';
|
|
28
28
|
import https from 'https';
|
|
29
|
+
import * as http from 'http';
|
|
29
30
|
|
|
30
31
|
const BASE_URL = "/api/v1";
|
|
31
32
|
const NEETO_AUTH_BASE_URL = (subdomain = "app") => `https://${subdomain}.neetoauth.net`;
|
|
@@ -225,86 +226,63 @@ class MemberApis {
|
|
|
225
226
|
});
|
|
226
227
|
}
|
|
227
228
|
|
|
228
|
-
class
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
229
|
+
class RailsEmailApiClient {
|
|
230
|
+
port = process.env.RAILS_SERVER_PORT;
|
|
231
|
+
subdomain = process.env.SUBDOMAIN ?? "spinkart";
|
|
232
|
+
baseUrl = `http://${this.subdomain}.lvh.me:${this.port}`;
|
|
233
|
+
emailsEndpoint = `${this.baseUrl}/api/v1/testing/emails`;
|
|
234
|
+
constructor() { }
|
|
235
|
+
convertRawEmail = (raw) => ({
|
|
236
|
+
from: raw.from,
|
|
237
|
+
to: raw.to,
|
|
238
|
+
cc: raw.cc,
|
|
239
|
+
bcc: raw.bcc,
|
|
240
|
+
replyTo: raw.reply_to,
|
|
241
|
+
subject: raw.subject,
|
|
242
|
+
htmlBody: raw.html_body,
|
|
243
|
+
textBody: raw.text_body,
|
|
244
|
+
receivedAt: raw.received_at,
|
|
245
|
+
attachments: raw.attachments?.map(({ filename, mime_type, data }) => ({
|
|
246
|
+
name: filename,
|
|
247
|
+
type: mime_type,
|
|
248
|
+
content: data,
|
|
247
249
|
})),
|
|
248
250
|
});
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
stdout += data.toString();
|
|
258
|
-
});
|
|
259
|
-
childProcess.stderr?.on("data", data => {
|
|
260
|
-
stderr += data.toString();
|
|
261
|
-
});
|
|
262
|
-
const exitCode = await new Promise((resolve, reject) => {
|
|
263
|
-
childProcess.on("error", reject);
|
|
264
|
-
childProcess.on("close", resolve);
|
|
265
|
-
});
|
|
266
|
-
if (exitCode !== 0) {
|
|
267
|
-
throw new Error(`Rake task ${taskName} failed: ${stderr || stdout || `Exit code ${exitCode}`}`);
|
|
268
|
-
}
|
|
269
|
-
return this.extractJsonFromOutput(stdout);
|
|
270
|
-
};
|
|
271
|
-
extractJsonFromOutput = (output) => {
|
|
272
|
-
const delimiterMatch = output.match(/<-- Captured Emails Start-->([\s\S]*?)<-- Captured Emails End-->/);
|
|
273
|
-
return delimiterMatch ? delimiterMatch[1].trim() : output.trim();
|
|
251
|
+
buildQueryString = (params) => {
|
|
252
|
+
if (!params)
|
|
253
|
+
return "";
|
|
254
|
+
const filtered = Object.fromEntries(Object.entries(keysToSnakeCase(params))
|
|
255
|
+
.filter(([, v]) => v != null && v !== "")
|
|
256
|
+
.map(([k, v]) => [k, String(v)]));
|
|
257
|
+
const query = new URLSearchParams(filtered).toString();
|
|
258
|
+
return query ? `?${query}` : "";
|
|
274
259
|
};
|
|
275
|
-
|
|
260
|
+
fetchJson = async (url, options) => {
|
|
276
261
|
try {
|
|
277
|
-
const
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
const rawEmails = JSON.parse(output);
|
|
282
|
-
return rawEmails.map(this.convertRawEmail);
|
|
262
|
+
const res = await fetch(url, options);
|
|
263
|
+
if (!res.ok)
|
|
264
|
+
return null;
|
|
265
|
+
return (await res.json());
|
|
283
266
|
}
|
|
284
|
-
catch (
|
|
285
|
-
console.error("
|
|
286
|
-
return
|
|
267
|
+
catch (err) {
|
|
268
|
+
console.error("API error:", err);
|
|
269
|
+
return null;
|
|
287
270
|
}
|
|
288
271
|
};
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
272
|
+
listEmails = async (searchParams) => {
|
|
273
|
+
const query = this.buildQueryString(searchParams);
|
|
274
|
+
const data = await this.fetchJson(`${this.emailsEndpoint}${query}`);
|
|
275
|
+
return data?.map(this.convertRawEmail) ?? [];
|
|
276
|
+
};
|
|
292
277
|
getLatestEmail = async (searchParams) => {
|
|
293
278
|
const emails = await this.listEmails(searchParams);
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
? current
|
|
298
|
-
: latest);
|
|
299
|
-
};
|
|
300
|
-
clearEmails = async () => {
|
|
301
|
-
try {
|
|
302
|
-
await this.executeRakeTask("playwright:clear_captured_emails");
|
|
303
|
-
}
|
|
304
|
-
catch (error) {
|
|
305
|
-
console.error("Failed to clear emails:", error);
|
|
306
|
-
}
|
|
279
|
+
return emails.reduce((latest, curr) => !latest || new Date(curr.receivedAt) > new Date(latest.receivedAt)
|
|
280
|
+
? curr
|
|
281
|
+
: latest, null);
|
|
307
282
|
};
|
|
283
|
+
clearEmails = () => this.fetchJson(this.emailsEndpoint, {
|
|
284
|
+
method: "DELETE",
|
|
285
|
+
});
|
|
308
286
|
}
|
|
309
287
|
|
|
310
288
|
class RoleApis {
|
|
@@ -668,7 +646,7 @@ var hasRequiredUtil_inspect;
|
|
|
668
646
|
function requireUtil_inspect () {
|
|
669
647
|
if (hasRequiredUtil_inspect) return util_inspect;
|
|
670
648
|
hasRequiredUtil_inspect = 1;
|
|
671
|
-
util_inspect = require$$0$
|
|
649
|
+
util_inspect = require$$0$3.inspect;
|
|
672
650
|
return util_inspect;
|
|
673
651
|
}
|
|
674
652
|
|
|
@@ -5074,7 +5052,7 @@ const joinString = (string1, string2, string3 = "", separator = " ") => {
|
|
|
5074
5052
|
};
|
|
5075
5053
|
const readFileSyncIfExists = (path = STORAGE_STATE) => {
|
|
5076
5054
|
try {
|
|
5077
|
-
return JSON.parse(
|
|
5055
|
+
return JSON.parse(fs$4.readFileSync(path, "utf8"));
|
|
5078
5056
|
}
|
|
5079
5057
|
catch {
|
|
5080
5058
|
return {};
|
|
@@ -5083,7 +5061,7 @@ const readFileSyncIfExists = (path = STORAGE_STATE) => {
|
|
|
5083
5061
|
const getGlobalUserState = () => readFileSyncIfExists()?.user;
|
|
5084
5062
|
const writeDataToFile = data => {
|
|
5085
5063
|
try {
|
|
5086
|
-
|
|
5064
|
+
fs$4.writeFileSync(STORAGE_STATE, data, "utf8");
|
|
5087
5065
|
}
|
|
5088
5066
|
catch (error) {
|
|
5089
5067
|
console.log(error);
|
|
@@ -5096,7 +5074,7 @@ const updateCredentials = ({ key, value }) => {
|
|
|
5096
5074
|
return writeDataToFile(JSON.stringify(data));
|
|
5097
5075
|
};
|
|
5098
5076
|
const removeCredentialFile = () => {
|
|
5099
|
-
|
|
5077
|
+
fs$4.unlink(STORAGE_STATE, error => {
|
|
5100
5078
|
if (!error)
|
|
5101
5079
|
return;
|
|
5102
5080
|
console.log(error);
|
|
@@ -6246,7 +6224,7 @@ class CustomCommands {
|
|
|
6246
6224
|
await expect(locator).toBeChecked({ checked: shouldBeChecked });
|
|
6247
6225
|
}).toPass({ timeout: 15_000 });
|
|
6248
6226
|
moveCursorAtBottom = async () => {
|
|
6249
|
-
const isMacOS = require$$0$
|
|
6227
|
+
const isMacOS = require$$0$4.platform() === "darwin";
|
|
6250
6228
|
const rightArrowKey = isMacOS ? "Meta+ArrowRight" : "End";
|
|
6251
6229
|
const downArrowKey = isMacOS ? "Meta+ArrowDown" : "PageDown";
|
|
6252
6230
|
await this.page.keyboard.press(rightArrowKey);
|
|
@@ -8887,7 +8865,7 @@ function requireSafer () {
|
|
|
8887
8865
|
if (hasRequiredSafer) return safer_1;
|
|
8888
8866
|
hasRequiredSafer = 1;
|
|
8889
8867
|
|
|
8890
|
-
var buffer = require$$0$
|
|
8868
|
+
var buffer = require$$0$5;
|
|
8891
8869
|
var Buffer = buffer.Buffer;
|
|
8892
8870
|
|
|
8893
8871
|
var safer = {};
|
|
@@ -26582,7 +26560,7 @@ function requireCharset () {
|
|
|
26582
26560
|
if (hasRequiredCharset) return charset.exports;
|
|
26583
26561
|
hasRequiredCharset = 1;
|
|
26584
26562
|
|
|
26585
|
-
const { Buffer } = require$$0$
|
|
26563
|
+
const { Buffer } = require$$0$6;
|
|
26586
26564
|
const iconv = requireLib$b();
|
|
26587
26565
|
const encodingJapanese = requireSrc$2();
|
|
26588
26566
|
const charsets = requireCharsets();
|
|
@@ -26708,7 +26686,7 @@ function requireLibbase64 () {
|
|
|
26708
26686
|
if (hasRequiredLibbase64) return libbase64;
|
|
26709
26687
|
hasRequiredLibbase64 = 1;
|
|
26710
26688
|
|
|
26711
|
-
const { Buffer } = require$$0$
|
|
26689
|
+
const { Buffer } = require$$0$6;
|
|
26712
26690
|
const stream = require$$1$3;
|
|
26713
26691
|
const Transform = stream.Transform;
|
|
26714
26692
|
|
|
@@ -26969,7 +26947,7 @@ function requireLibqp () {
|
|
|
26969
26947
|
if (hasRequiredLibqp) return libqp;
|
|
26970
26948
|
hasRequiredLibqp = 1;
|
|
26971
26949
|
|
|
26972
|
-
const { Buffer } = require$$0$
|
|
26950
|
+
const { Buffer } = require$$0$6;
|
|
26973
26951
|
const stream = require$$1$3;
|
|
26974
26952
|
const Transform = stream.Transform;
|
|
26975
26953
|
|
|
@@ -29344,7 +29322,7 @@ function requireLibmime () {
|
|
|
29344
29322
|
if (hasRequiredLibmime) return libmime.exports;
|
|
29345
29323
|
hasRequiredLibmime = 1;
|
|
29346
29324
|
|
|
29347
|
-
const { Buffer } = require$$0$
|
|
29325
|
+
const { Buffer } = require$$0$6;
|
|
29348
29326
|
const libcharset = requireCharset();
|
|
29349
29327
|
const libbase64 = requireLibbase64();
|
|
29350
29328
|
const libqp = requireLibqp();
|
|
@@ -30525,7 +30503,7 @@ function requireMimeNode () {
|
|
|
30525
30503
|
const libmime = requireLibmime();
|
|
30526
30504
|
const libqp = requireLibqp();
|
|
30527
30505
|
const libbase64 = requireLibbase64();
|
|
30528
|
-
const PassThrough = require$$0$
|
|
30506
|
+
const PassThrough = require$$0$7.PassThrough;
|
|
30529
30507
|
const pathlib = path__default;
|
|
30530
30508
|
|
|
30531
30509
|
class MimeNode {
|
|
@@ -30794,7 +30772,7 @@ function requireMessageSplitter () {
|
|
|
30794
30772
|
if (hasRequiredMessageSplitter) return messageSplitter;
|
|
30795
30773
|
hasRequiredMessageSplitter = 1;
|
|
30796
30774
|
|
|
30797
|
-
const Transform = require$$0$
|
|
30775
|
+
const Transform = require$$0$7.Transform;
|
|
30798
30776
|
const MimeNode = requireMimeNode();
|
|
30799
30777
|
|
|
30800
30778
|
const MAX_HEAD_SIZE = 1 * 1024 * 1024;
|
|
@@ -31224,7 +31202,7 @@ function requireMessageJoiner () {
|
|
|
31224
31202
|
if (hasRequiredMessageJoiner) return messageJoiner;
|
|
31225
31203
|
hasRequiredMessageJoiner = 1;
|
|
31226
31204
|
|
|
31227
|
-
const Transform = require$$0$
|
|
31205
|
+
const Transform = require$$0$7.Transform;
|
|
31228
31206
|
|
|
31229
31207
|
class MessageJoiner extends Transform {
|
|
31230
31208
|
constructor() {
|
|
@@ -31264,7 +31242,7 @@ function requireFlowedDecoder () {
|
|
|
31264
31242
|
|
|
31265
31243
|
// Helper class to rewrite nodes with specific mime type
|
|
31266
31244
|
|
|
31267
|
-
const Transform = require$$0$
|
|
31245
|
+
const Transform = require$$0$7.Transform;
|
|
31268
31246
|
const libmime = requireLibmime();
|
|
31269
31247
|
|
|
31270
31248
|
/**
|
|
@@ -31327,7 +31305,7 @@ function requireNodeRewriter () {
|
|
|
31327
31305
|
|
|
31328
31306
|
// Helper class to rewrite nodes with specific mime type
|
|
31329
31307
|
|
|
31330
|
-
const Transform = require$$0$
|
|
31308
|
+
const Transform = require$$0$7.Transform;
|
|
31331
31309
|
const FlowedDecoder = requireFlowedDecoder();
|
|
31332
31310
|
|
|
31333
31311
|
/**
|
|
@@ -31529,7 +31507,7 @@ function requireNodeStreamer () {
|
|
|
31529
31507
|
|
|
31530
31508
|
// Helper class to rewrite nodes with specific mime type
|
|
31531
31509
|
|
|
31532
|
-
const Transform = require$$0$
|
|
31510
|
+
const Transform = require$$0$7.Transform;
|
|
31533
31511
|
const FlowedDecoder = requireFlowedDecoder();
|
|
31534
31512
|
|
|
31535
31513
|
/**
|
|
@@ -31656,7 +31634,7 @@ function requireChunkedPassthrough () {
|
|
|
31656
31634
|
if (hasRequiredChunkedPassthrough) return chunkedPassthrough;
|
|
31657
31635
|
hasRequiredChunkedPassthrough = 1;
|
|
31658
31636
|
|
|
31659
|
-
const { Transform } = require$$0$
|
|
31637
|
+
const { Transform } = require$$0$7;
|
|
31660
31638
|
|
|
31661
31639
|
class ChunkedPassthrough extends Transform {
|
|
31662
31640
|
constructor(options = {}) {
|
|
@@ -32582,8 +32560,8 @@ function requireStreamHash () {
|
|
|
32582
32560
|
if (hasRequiredStreamHash) return streamHash;
|
|
32583
32561
|
hasRequiredStreamHash = 1;
|
|
32584
32562
|
|
|
32585
|
-
const crypto = require$$0$
|
|
32586
|
-
const Transform = require$$0$
|
|
32563
|
+
const crypto = require$$0$8;
|
|
32564
|
+
const Transform = require$$0$7.Transform;
|
|
32587
32565
|
|
|
32588
32566
|
class StreamHash extends Transform {
|
|
32589
32567
|
constructor(attachment, algo) {
|
|
@@ -54966,7 +54944,7 @@ function requireMailParser () {
|
|
|
54966
54944
|
const mailsplit = requireMailsplit();
|
|
54967
54945
|
const libmime = requireLibmime();
|
|
54968
54946
|
const addressparser = requireAddressparser();
|
|
54969
|
-
const Transform = require$$0$
|
|
54947
|
+
const Transform = require$$0$7.Transform;
|
|
54970
54948
|
const Splitter = mailsplit.Splitter;
|
|
54971
54949
|
const ChunkedPassthrough = mailsplit.ChunkedPassthrough;
|
|
54972
54950
|
const punycode = require$$4$2;
|
|
@@ -60287,10 +60265,10 @@ const hexToRGB = (hex) => {
|
|
|
60287
60265
|
|
|
60288
60266
|
class RailsEmailUtils {
|
|
60289
60267
|
neetoPlaywrightUtilities;
|
|
60290
|
-
|
|
60268
|
+
railsEmailClient;
|
|
60291
60269
|
constructor(neetoPlaywrightUtilities) {
|
|
60292
60270
|
this.neetoPlaywrightUtilities = neetoPlaywrightUtilities;
|
|
60293
|
-
this.
|
|
60271
|
+
this.railsEmailClient = new RailsEmailApiClient();
|
|
60294
60272
|
}
|
|
60295
60273
|
convertRailsEmailToFormattedList = (railsEmail) => {
|
|
60296
60274
|
if (!railsEmail)
|
|
@@ -60341,11 +60319,11 @@ class RailsEmailUtils {
|
|
|
60341
60319
|
blobId: "",
|
|
60342
60320
|
};
|
|
60343
60321
|
};
|
|
60344
|
-
clearEmails = () => this.
|
|
60345
|
-
getLatestEmail = (searchParams) => this.
|
|
60346
|
-
listEmails = (searchParams) => this.
|
|
60322
|
+
clearEmails = () => this.railsEmailClient.clearEmails();
|
|
60323
|
+
getLatestEmail = (searchParams) => this.railsEmailClient.getLatestEmail(searchParams);
|
|
60324
|
+
listEmails = (searchParams) => this.railsEmailClient.listEmails(searchParams);
|
|
60347
60325
|
listMessages = async (messageSearchCriteria = {}, { receivedAfter = new Date(new Date().valueOf() - 60 * 60 * 1000), } = {}) => {
|
|
60348
|
-
const emails = await this.
|
|
60326
|
+
const emails = await this.railsEmailClient.listEmails({
|
|
60349
60327
|
...messageSearchCriteria,
|
|
60350
60328
|
receivedAfter: receivedAfter.toISOString(),
|
|
60351
60329
|
});
|
|
@@ -60356,7 +60334,7 @@ class RailsEmailUtils {
|
|
|
60356
60334
|
findMessage = async (messageSearchCriteria = {}, { timeout = 10_000, receivedAfter = new Date(new Date().valueOf() - 60 * 60 * 1000), expectedEmailCount = 1, } = {}, shouldThrowErrorOnTimeout = true) => {
|
|
60357
60335
|
const email = (await this.neetoPlaywrightUtilities.executeRecursively({
|
|
60358
60336
|
callback: async () => {
|
|
60359
|
-
const railsEmail = await this.
|
|
60337
|
+
const railsEmail = await this.railsEmailClient.getLatestEmail({
|
|
60360
60338
|
...messageSearchCriteria,
|
|
60361
60339
|
receivedAfter: receivedAfter.toISOString(),
|
|
60362
60340
|
});
|
|
@@ -60365,7 +60343,7 @@ class RailsEmailUtils {
|
|
|
60365
60343
|
return this.convertRailsEmailToFormattedList(railsEmail);
|
|
60366
60344
|
},
|
|
60367
60345
|
condition: async () => {
|
|
60368
|
-
const emails = await this.
|
|
60346
|
+
const emails = await this.railsEmailClient.listEmails({
|
|
60369
60347
|
...messageSearchCriteria,
|
|
60370
60348
|
receivedAfter: receivedAfter.toISOString(),
|
|
60371
60349
|
});
|
|
@@ -60384,7 +60362,7 @@ class RailsEmailUtils {
|
|
|
60384
60362
|
findOtpFromEmail = async ({ email, subjectSubstring = OTP_EMAIL_PATTERN, timeout = 10_000, receivedAfter = new Date(), expectedEmailCount = 1, }) => {
|
|
60385
60363
|
const otp = await this.neetoPlaywrightUtilities.executeRecursively({
|
|
60386
60364
|
callback: async () => {
|
|
60387
|
-
const railsEmail = await this.
|
|
60365
|
+
const railsEmail = await this.railsEmailClient.getLatestEmail({
|
|
60388
60366
|
to: email,
|
|
60389
60367
|
subject: subjectSubstring,
|
|
60390
60368
|
receivedAfter: receivedAfter.toISOString(),
|
|
@@ -60397,7 +60375,7 @@ class RailsEmailUtils {
|
|
|
60397
60375
|
return formattedEmail.html.codes?.[0] || formattedEmail.text.codes?.[0];
|
|
60398
60376
|
},
|
|
60399
60377
|
condition: async () => {
|
|
60400
|
-
const emails = await this.
|
|
60378
|
+
const emails = await this.railsEmailClient.listEmails({
|
|
60401
60379
|
to: email,
|
|
60402
60380
|
subject: subjectSubstring,
|
|
60403
60381
|
receivedAfter: receivedAfter.toISOString(),
|
|
@@ -60411,7 +60389,7 @@ class RailsEmailUtils {
|
|
|
60411
60389
|
getEmailAttachment = async (attachmentName, messageSearchCriteria = {}, { receivedAfter = new Date(new Date().valueOf() - 60 * 60 * 1000), expectedEmailCount = 1, timeout = 10_000, } = {}, shouldThrowErrorOnTimeout = true) => {
|
|
60412
60390
|
const attachmentDetails = (await this.neetoPlaywrightUtilities.executeRecursively({
|
|
60413
60391
|
callback: async () => {
|
|
60414
|
-
const railsEmail = await this.
|
|
60392
|
+
const railsEmail = await this.railsEmailClient.getLatestEmail({
|
|
60415
60393
|
...messageSearchCriteria,
|
|
60416
60394
|
receivedAfter: receivedAfter.toISOString(),
|
|
60417
60395
|
});
|
|
@@ -60428,7 +60406,7 @@ class RailsEmailUtils {
|
|
|
60428
60406
|
};
|
|
60429
60407
|
},
|
|
60430
60408
|
condition: async () => {
|
|
60431
|
-
const emails = await this.
|
|
60409
|
+
const emails = await this.railsEmailClient.listEmails({
|
|
60432
60410
|
...messageSearchCriteria,
|
|
60433
60411
|
receivedAfter: receivedAfter.toISOString(),
|
|
60434
60412
|
});
|
|
@@ -60600,9 +60578,7 @@ class MailerUtils {
|
|
|
60600
60578
|
const { html: { codes }, } = await this.findMessage({ to: email, subject: subjectSubstring }, { timeout, receivedAfter, expectedEmailCount });
|
|
60601
60579
|
return codes?.[0];
|
|
60602
60580
|
};
|
|
60603
|
-
generateRandomEmail = (
|
|
60604
|
-
? generateRandomBypassEmail()
|
|
60605
|
-
: faker.internet.email({ provider: process.env.FASTMAIL_DOMAIN_NAME });
|
|
60581
|
+
generateRandomEmail = () => faker.internet.email({ provider: process.env.FASTMAIL_DOMAIN_NAME });
|
|
60606
60582
|
getEmailAttachment = async (attachmentName, messageSearchCriteria = {}, { timeout = 10_000, receivedAfter = dateTimeOneHourAgo(), expectedEmailCount = 1, } = {}, shouldThrowErrorOnTimeout = true) => {
|
|
60607
60583
|
if (IS_DEV_ENV) {
|
|
60608
60584
|
return this.railsEmailUtils.getEmailAttachment(attachmentName, messageSearchCriteria, { receivedAfter, expectedEmailCount, timeout: timeout / 3 }, shouldThrowErrorOnTimeout);
|
|
@@ -66986,7 +66962,7 @@ function requireGifutil () {
|
|
|
66986
66962
|
|
|
66987
66963
|
/** @namespace GifUtil */
|
|
66988
66964
|
|
|
66989
|
-
const fs =
|
|
66965
|
+
const fs = fs__default;
|
|
66990
66966
|
const ImageQ = requireImageQ();
|
|
66991
66967
|
|
|
66992
66968
|
const BitmapImage = requireBitmapimage();
|
|
@@ -69802,8 +69778,8 @@ function requireChunkstream () {
|
|
|
69802
69778
|
if (hasRequiredChunkstream) return chunkstream.exports;
|
|
69803
69779
|
hasRequiredChunkstream = 1;
|
|
69804
69780
|
|
|
69805
|
-
let util = require$$0$
|
|
69806
|
-
let Stream = require$$0$
|
|
69781
|
+
let util = require$$0$3;
|
|
69782
|
+
let Stream = require$$0$7;
|
|
69807
69783
|
|
|
69808
69784
|
let ChunkStream = (chunkstream.exports = function () {
|
|
69809
69785
|
Stream.call(this);
|
|
@@ -70314,7 +70290,7 @@ function requireFilterParseAsync () {
|
|
|
70314
70290
|
if (hasRequiredFilterParseAsync) return filterParseAsync.exports;
|
|
70315
70291
|
hasRequiredFilterParseAsync = 1;
|
|
70316
70292
|
|
|
70317
|
-
let util = require$$0$
|
|
70293
|
+
let util = require$$0$3;
|
|
70318
70294
|
let ChunkStream = requireChunkstream();
|
|
70319
70295
|
let Filter = requireFilterParse();
|
|
70320
70296
|
|
|
@@ -71110,7 +71086,7 @@ function requireParserAsync () {
|
|
|
71110
71086
|
if (hasRequiredParserAsync) return parserAsync.exports;
|
|
71111
71087
|
hasRequiredParserAsync = 1;
|
|
71112
71088
|
|
|
71113
|
-
let util = require$$0$
|
|
71089
|
+
let util = require$$0$3;
|
|
71114
71090
|
let zlib = require$$1$4;
|
|
71115
71091
|
let ChunkStream = requireChunkstream();
|
|
71116
71092
|
let FilterAsync = requireFilterParseAsync();
|
|
@@ -71771,8 +71747,8 @@ function requirePackerAsync () {
|
|
|
71771
71747
|
if (hasRequiredPackerAsync) return packerAsync.exports;
|
|
71772
71748
|
hasRequiredPackerAsync = 1;
|
|
71773
71749
|
|
|
71774
|
-
let util = require$$0$
|
|
71775
|
-
let Stream = require$$0$
|
|
71750
|
+
let util = require$$0$3;
|
|
71751
|
+
let Stream = require$$0$7;
|
|
71776
71752
|
let constants = requireConstants$4();
|
|
71777
71753
|
let Packer = requirePacker();
|
|
71778
71754
|
|
|
@@ -71833,11 +71809,11 @@ function requireSyncInflate () {
|
|
|
71833
71809
|
hasRequiredSyncInflate = 1;
|
|
71834
71810
|
(function (module, exports$1) {
|
|
71835
71811
|
|
|
71836
|
-
let assert = require$$0$
|
|
71812
|
+
let assert = require$$0$9.ok;
|
|
71837
71813
|
let zlib = require$$1$4;
|
|
71838
|
-
let util = require$$0$
|
|
71814
|
+
let util = require$$0$3;
|
|
71839
71815
|
|
|
71840
|
-
let kMaxLength = require$$0$
|
|
71816
|
+
let kMaxLength = require$$0$5.kMaxLength;
|
|
71841
71817
|
|
|
71842
71818
|
function Inflate(opts) {
|
|
71843
71819
|
if (!(this instanceof Inflate)) {
|
|
@@ -72293,8 +72269,8 @@ function requirePng () {
|
|
|
72293
72269
|
if (hasRequiredPng) return png$1;
|
|
72294
72270
|
hasRequiredPng = 1;
|
|
72295
72271
|
|
|
72296
|
-
let util = require$$0$
|
|
72297
|
-
let Stream = require$$0$
|
|
72272
|
+
let util = require$$0$3;
|
|
72273
|
+
let Stream = require$$0$7;
|
|
72298
72274
|
let Parser = requireParserAsync();
|
|
72299
72275
|
let Packer = requirePackerAsync();
|
|
72300
72276
|
let PNGSync = requirePngSync();
|
|
@@ -107232,7 +107208,35 @@ class ColorPickerUtils {
|
|
|
107232
107208
|
};
|
|
107233
107209
|
}
|
|
107234
107210
|
|
|
107211
|
+
const STATIC_ASSET_PATTERN = /\.(js|css|woff2?|ttf|eot|png|svg|ico|gif|webp)(\?.*)?$/;
|
|
107212
|
+
const assetCache = new Map();
|
|
107235
107213
|
const commands = {
|
|
107214
|
+
context: async ({ context }, use) => {
|
|
107215
|
+
if (IS_DEV_ENV) {
|
|
107216
|
+
await context.route(STATIC_ASSET_PATTERN, async (route) => {
|
|
107217
|
+
const url = route.request().url();
|
|
107218
|
+
const hit = assetCache.get(url);
|
|
107219
|
+
if (hit)
|
|
107220
|
+
return route.fulfill(hit);
|
|
107221
|
+
try {
|
|
107222
|
+
const response = await route.fetch();
|
|
107223
|
+
const body = await response.body();
|
|
107224
|
+
const entry = {
|
|
107225
|
+
body,
|
|
107226
|
+
status: response.status(),
|
|
107227
|
+
headers: response.headers(),
|
|
107228
|
+
};
|
|
107229
|
+
if (response.ok())
|
|
107230
|
+
assetCache.set(url, entry);
|
|
107231
|
+
return route.fulfill(entry);
|
|
107232
|
+
}
|
|
107233
|
+
catch {
|
|
107234
|
+
return route.continue();
|
|
107235
|
+
}
|
|
107236
|
+
});
|
|
107237
|
+
}
|
|
107238
|
+
await use(context);
|
|
107239
|
+
},
|
|
107236
107240
|
neetoPlaywrightUtilities: async ({ page, request, baseURL }, use) => {
|
|
107237
107241
|
const commands = new CustomCommands(page, request, baseURL);
|
|
107238
107242
|
await use(commands);
|
|
@@ -108021,7 +108025,7 @@ var hasRequiredSupportsColor;
|
|
|
108021
108025
|
function requireSupportsColor () {
|
|
108022
108026
|
if (hasRequiredSupportsColor) return supportsColor_1;
|
|
108023
108027
|
hasRequiredSupportsColor = 1;
|
|
108024
|
-
const os = require$$0$
|
|
108028
|
+
const os = require$$0$4;
|
|
108025
108029
|
const hasFlag = requireHasFlag();
|
|
108026
108030
|
|
|
108027
108031
|
const env = process.env;
|
|
@@ -108164,8 +108168,8 @@ function requireNode () {
|
|
|
108164
108168
|
if (hasRequiredNode) return node.exports;
|
|
108165
108169
|
hasRequiredNode = 1;
|
|
108166
108170
|
(function (module, exports$1) {
|
|
108167
|
-
const tty = require$$0$
|
|
108168
|
-
const util = require$$0$
|
|
108171
|
+
const tty = require$$0$a;
|
|
108172
|
+
const util = require$$0$3;
|
|
108169
108173
|
|
|
108170
108174
|
/**
|
|
108171
108175
|
* This is the Node.js implementation of `debug()`.
|
|
@@ -109491,7 +109495,7 @@ function requirePath () {
|
|
|
109491
109495
|
hasRequiredPath = 1;
|
|
109492
109496
|
Object.defineProperty(path, "__esModule", { value: true });
|
|
109493
109497
|
path.convertPosixPathToPattern = path.convertWindowsPathToPattern = path.convertPathToPattern = path.escapePosixPath = path.escapeWindowsPath = path.escape = path.removeLeadingDotSegment = path.makeAbsolute = path.unixify = void 0;
|
|
109494
|
-
const os = require$$0$
|
|
109498
|
+
const os = require$$0$4;
|
|
109495
109499
|
const path$1 = path__default;
|
|
109496
109500
|
const IS_WINDOWS_PLATFORM = os.platform() === 'win32';
|
|
109497
109501
|
const LEADING_DOT_SEGMENT_CHARACTERS_COUNT = 2; // ./ or .\\
|
|
@@ -109758,7 +109762,7 @@ function requireGlobParent () {
|
|
|
109758
109762
|
|
|
109759
109763
|
var isGlob = requireIsGlob();
|
|
109760
109764
|
var pathPosixDirname = path__default.posix.dirname;
|
|
109761
|
-
var isWin32 = require$$0$
|
|
109765
|
+
var isWin32 = require$$0$4.platform() === 'win32';
|
|
109762
109766
|
|
|
109763
109767
|
var slash = '/';
|
|
109764
109768
|
var backslash = /\\/g;
|
|
@@ -110307,7 +110311,7 @@ function requireFillRange () {
|
|
|
110307
110311
|
if (hasRequiredFillRange) return fillRange;
|
|
110308
110312
|
hasRequiredFillRange = 1;
|
|
110309
110313
|
|
|
110310
|
-
const util = require$$0$
|
|
110314
|
+
const util = require$$0$3;
|
|
110311
110315
|
const toRegexRange = requireToRegexRange();
|
|
110312
110316
|
|
|
110313
110317
|
const isObject = val => val !== null && typeof val === 'object' && !Array.isArray(val);
|
|
@@ -113448,7 +113452,7 @@ function requireMicromatch () {
|
|
|
113448
113452
|
if (hasRequiredMicromatch) return micromatch_1;
|
|
113449
113453
|
hasRequiredMicromatch = 1;
|
|
113450
113454
|
|
|
113451
|
-
const util = require$$0$
|
|
113455
|
+
const util = require$$0$3;
|
|
113452
113456
|
const braces = requireBraces();
|
|
113453
113457
|
const picomatch = requirePicomatch();
|
|
113454
113458
|
const utils = requireUtils$2();
|
|
@@ -114151,7 +114155,7 @@ function requireMerge2 () {
|
|
|
114151
114155
|
* Copyright (c) 2014-2020 Teambition
|
|
114152
114156
|
* Licensed under the MIT license.
|
|
114153
114157
|
*/
|
|
114154
|
-
const Stream = require$$0$
|
|
114158
|
+
const Stream = require$$0$7;
|
|
114155
114159
|
const PassThrough = Stream.PassThrough;
|
|
114156
114160
|
const slice = Array.prototype.slice;
|
|
114157
114161
|
|
|
@@ -114580,7 +114584,7 @@ function requireFs$2 () {
|
|
|
114580
114584
|
(function (exports$1) {
|
|
114581
114585
|
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
114582
114586
|
exports$1.createFileSystemAdapter = exports$1.FILE_SYSTEM_ADAPTER = void 0;
|
|
114583
|
-
const fs =
|
|
114587
|
+
const fs = fs__default;
|
|
114584
114588
|
exports$1.FILE_SYSTEM_ADAPTER = {
|
|
114585
114589
|
lstat: fs.lstat,
|
|
114586
114590
|
stat: fs.stat,
|
|
@@ -115010,7 +115014,7 @@ function requireFs () {
|
|
|
115010
115014
|
(function (exports$1) {
|
|
115011
115015
|
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
115012
115016
|
exports$1.createFileSystemAdapter = exports$1.FILE_SYSTEM_ADAPTER = void 0;
|
|
115013
|
-
const fs =
|
|
115017
|
+
const fs = fs__default;
|
|
115014
115018
|
exports$1.FILE_SYSTEM_ADAPTER = {
|
|
115015
115019
|
lstat: fs.lstat,
|
|
115016
115020
|
stat: fs.stat,
|
|
@@ -115643,7 +115647,7 @@ function requireStream$2 () {
|
|
|
115643
115647
|
if (hasRequiredStream$2) return stream$2;
|
|
115644
115648
|
hasRequiredStream$2 = 1;
|
|
115645
115649
|
Object.defineProperty(stream$2, "__esModule", { value: true });
|
|
115646
|
-
const stream_1 = require$$0$
|
|
115650
|
+
const stream_1 = require$$0$7;
|
|
115647
115651
|
const async_1 = requireAsync$3();
|
|
115648
115652
|
class StreamProvider {
|
|
115649
115653
|
constructor(_root, _settings) {
|
|
@@ -115895,7 +115899,7 @@ function requireStream$1 () {
|
|
|
115895
115899
|
if (hasRequiredStream$1) return stream$1;
|
|
115896
115900
|
hasRequiredStream$1 = 1;
|
|
115897
115901
|
Object.defineProperty(stream$1, "__esModule", { value: true });
|
|
115898
|
-
const stream_1 = require$$0$
|
|
115902
|
+
const stream_1 = require$$0$7;
|
|
115899
115903
|
const fsStat = requireOut$3();
|
|
115900
115904
|
const fsWalk = requireOut$1();
|
|
115901
115905
|
const reader_1 = requireReader();
|
|
@@ -116413,7 +116417,7 @@ function requireStream () {
|
|
|
116413
116417
|
if (hasRequiredStream) return stream;
|
|
116414
116418
|
hasRequiredStream = 1;
|
|
116415
116419
|
Object.defineProperty(stream, "__esModule", { value: true });
|
|
116416
|
-
const stream_1 = require$$0$
|
|
116420
|
+
const stream_1 = require$$0$7;
|
|
116417
116421
|
const stream_2 = requireStream$1();
|
|
116418
116422
|
const provider_1 = requireProvider();
|
|
116419
116423
|
class ProviderStream extends provider_1.default {
|
|
@@ -116539,8 +116543,8 @@ function requireSettings () {
|
|
|
116539
116543
|
(function (exports$1) {
|
|
116540
116544
|
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
116541
116545
|
exports$1.DEFAULT_FILE_SYSTEM_ADAPTER = void 0;
|
|
116542
|
-
const fs =
|
|
116543
|
-
const os = require$$0$
|
|
116546
|
+
const fs = fs__default;
|
|
116547
|
+
const os = require$$0$4;
|
|
116544
116548
|
/**
|
|
116545
116549
|
* The `os.cpus` method can return zero. We expect the number of cores to be greater than zero.
|
|
116546
116550
|
* https://github.com/nodejs/node/blob/7faeddf23a98c53896f8b574a6e66589e8fb1eb8/lib/os.js#L106-L107
|
|
@@ -120010,7 +120014,7 @@ class EditorPage {
|
|
|
120010
120014
|
}).toPass({ timeout: 30_000 });
|
|
120011
120015
|
focusText = (textLocator) => expect(async () => {
|
|
120012
120016
|
await textLocator.click();
|
|
120013
|
-
await this.page.keyboard.press(require$$0$
|
|
120017
|
+
await this.page.keyboard.press(require$$0$4.platform() === "darwin" ? "Meta+ArrowRight" : "End");
|
|
120014
120018
|
await expect(textLocator.locator("..")).toHaveClass(/has-focus/, {
|
|
120015
120019
|
timeout: 5_000,
|
|
120016
120020
|
});
|
|
@@ -124950,6 +124954,185 @@ const generatePhoneNumberDetails = () => {
|
|
|
124950
124954
|
return { flag: country.flag, name: country.name, code: country.code, number };
|
|
124951
124955
|
};
|
|
124952
124956
|
|
|
124957
|
+
const DEFAULT_WARMUP_URLS = ["/login"];
|
|
124958
|
+
async function warmup({ urls = DEFAULT_WARMUP_URLS, timeout = 60_000, } = {}) {
|
|
124959
|
+
if (!IS_DEV_ENV)
|
|
124960
|
+
return;
|
|
124961
|
+
const { RAILS_SERVER_PORT, SUBDOMAIN = "spinkart" } = process.env;
|
|
124962
|
+
if (!RAILS_SERVER_PORT) {
|
|
124963
|
+
throw new Error("RAILS_SERVER_PORT is not defined in environment variables.");
|
|
124964
|
+
}
|
|
124965
|
+
const baseURL = `http://${SUBDOMAIN}.lvh.me:${RAILS_SERVER_PORT}`;
|
|
124966
|
+
const browser = await chromium$1.launch();
|
|
124967
|
+
const page = await browser.newPage();
|
|
124968
|
+
try {
|
|
124969
|
+
for (const url of urls) {
|
|
124970
|
+
const fullUrl = url.startsWith("http") ? url : `${baseURL}${url}`;
|
|
124971
|
+
await page.goto(fullUrl, {
|
|
124972
|
+
waitUntil: "networkidle", // eslint-disable-line playwright/no-networkidle
|
|
124973
|
+
timeout,
|
|
124974
|
+
});
|
|
124975
|
+
}
|
|
124976
|
+
}
|
|
124977
|
+
finally {
|
|
124978
|
+
await browser.close();
|
|
124979
|
+
}
|
|
124980
|
+
}
|
|
124981
|
+
|
|
124982
|
+
const CONFIG = {
|
|
124983
|
+
DIR: "/tmp/neeto-auth-web",
|
|
124984
|
+
LOG: "/tmp/neeto-auth-server.log",
|
|
124985
|
+
PORT: 9000,
|
|
124986
|
+
MAX_WAIT_MS: 120_000,
|
|
124987
|
+
EMAIL_INIT: "/tmp/neeto-auth-web/config/initializers/playwright_email_capture.rb",
|
|
124988
|
+
};
|
|
124989
|
+
const SCRIPTS_DIR = path$1.join(__dirname, "scripts", "neeto-auth");
|
|
124990
|
+
const escapeRubyString = (value) => value.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
|
|
124991
|
+
const buildEmailCaptureInitializer = (targetApp) => {
|
|
124992
|
+
const template = fs$4.readFileSync(path$1.join(SCRIPTS_DIR, "playwright_email_capture.rb.template"), "utf-8");
|
|
124993
|
+
return template.replace("{{TARGET_APP}}", escapeRubyString(targetApp));
|
|
124994
|
+
};
|
|
124995
|
+
const log = (msg) => console.log(`[NeetoAuth] ${msg}`);
|
|
124996
|
+
const sleep = (ms) => new Promise(resolve => setTimeout(resolve, ms));
|
|
124997
|
+
const httpCheck = (port, timeout = 3000) => new Promise(resolve => {
|
|
124998
|
+
const req = http.get(`http://localhost:${port}/`, () => resolve(true));
|
|
124999
|
+
req.on("error", () => resolve(false));
|
|
125000
|
+
req.setTimeout(timeout, () => {
|
|
125001
|
+
req.destroy();
|
|
125002
|
+
resolve(false);
|
|
125003
|
+
});
|
|
125004
|
+
});
|
|
125005
|
+
class NeetoAuthServer {
|
|
125006
|
+
process = null;
|
|
125007
|
+
targetApp;
|
|
125008
|
+
constructor(appName) {
|
|
125009
|
+
this.targetApp = STATUS_TEXTS.appName(appName);
|
|
125010
|
+
}
|
|
125011
|
+
get serverEnv() {
|
|
125012
|
+
return {
|
|
125013
|
+
...process.env,
|
|
125014
|
+
BUNDLE_PATH: undefined,
|
|
125015
|
+
RAILS_ENV: "development",
|
|
125016
|
+
POSTGRES_USER: process.env.POSTGRES_USER ?? process.env.USER ?? "postgres",
|
|
125017
|
+
};
|
|
125018
|
+
}
|
|
125019
|
+
waitForProcessExit = async (pid) => {
|
|
125020
|
+
const deadline = Date.now() + 10_000;
|
|
125021
|
+
while (Date.now() < deadline) {
|
|
125022
|
+
try {
|
|
125023
|
+
process.kill(pid, 0);
|
|
125024
|
+
await sleep(500);
|
|
125025
|
+
}
|
|
125026
|
+
catch {
|
|
125027
|
+
return;
|
|
125028
|
+
}
|
|
125029
|
+
}
|
|
125030
|
+
};
|
|
125031
|
+
killServerOnPort = async () => {
|
|
125032
|
+
try {
|
|
125033
|
+
execSync(`lsof -ti tcp:${CONFIG.PORT} | xargs kill -9`, {
|
|
125034
|
+
stdio: "ignore",
|
|
125035
|
+
});
|
|
125036
|
+
await sleep(1000);
|
|
125037
|
+
}
|
|
125038
|
+
catch {
|
|
125039
|
+
// No process on that port — nothing to kill.
|
|
125040
|
+
}
|
|
125041
|
+
};
|
|
125042
|
+
ensureSetup = () => {
|
|
125043
|
+
if (fs$4.existsSync(`${CONFIG.DIR}/Gemfile`)) {
|
|
125044
|
+
log("Already set up, skipping.");
|
|
125045
|
+
return;
|
|
125046
|
+
}
|
|
125047
|
+
if (!process.env.GITHUB_TOKEN) {
|
|
125048
|
+
throw new Error("[NeetoAuth] GITHUB_TOKEN is not set. Cannot clone neeto-auth-web.");
|
|
125049
|
+
}
|
|
125050
|
+
log("Running first-time setup...");
|
|
125051
|
+
const setupScript = path$1.join(SCRIPTS_DIR, "setup.sh");
|
|
125052
|
+
try {
|
|
125053
|
+
execSync(`bash "${setupScript}" "${CONFIG.DIR}"`, {
|
|
125054
|
+
stdio: "inherit",
|
|
125055
|
+
env: this.serverEnv,
|
|
125056
|
+
});
|
|
125057
|
+
}
|
|
125058
|
+
catch {
|
|
125059
|
+
throw new Error("[NeetoAuth] First-time setup failed. Check the output above for details.");
|
|
125060
|
+
}
|
|
125061
|
+
log("Setup complete.");
|
|
125062
|
+
};
|
|
125063
|
+
waitForServer = async (timeoutMs = CONFIG.MAX_WAIT_MS) => {
|
|
125064
|
+
const startTime = Date.now();
|
|
125065
|
+
while (Date.now() - startTime < timeoutMs) {
|
|
125066
|
+
if (this.process !== null && this.process.exitCode !== null) {
|
|
125067
|
+
const logContent = fs$4.existsSync(CONFIG.LOG)
|
|
125068
|
+
? fs$4.readFileSync(CONFIG.LOG, "utf-8")
|
|
125069
|
+
: "<no log file>";
|
|
125070
|
+
throw new Error(`[NeetoAuth] Server process exited unexpectedly with code ${this.process.exitCode}.\nLog:\n${logContent}`);
|
|
125071
|
+
}
|
|
125072
|
+
if (await httpCheck(CONFIG.PORT))
|
|
125073
|
+
return;
|
|
125074
|
+
await sleep(3000);
|
|
125075
|
+
}
|
|
125076
|
+
const logContent = fs$4.existsSync(CONFIG.LOG)
|
|
125077
|
+
? fs$4.readFileSync(CONFIG.LOG, "utf-8")
|
|
125078
|
+
: "<no log file>";
|
|
125079
|
+
throw new Error(`[NeetoAuth] Server did not start within ${timeoutMs / 1000}s.\nLog:\n${logContent}`);
|
|
125080
|
+
};
|
|
125081
|
+
injectEmailCaptureInitializer = () => {
|
|
125082
|
+
fs$4.writeFileSync(CONFIG.EMAIL_INIT, buildEmailCaptureInitializer(this.targetApp));
|
|
125083
|
+
};
|
|
125084
|
+
isRunningForCurrentApp = () => {
|
|
125085
|
+
if (!fs$4.existsSync(CONFIG.EMAIL_INIT))
|
|
125086
|
+
return false;
|
|
125087
|
+
const currentContent = fs$4.readFileSync(CONFIG.EMAIL_INIT, "utf-8");
|
|
125088
|
+
return currentContent === buildEmailCaptureInitializer(this.targetApp);
|
|
125089
|
+
};
|
|
125090
|
+
start = async () => {
|
|
125091
|
+
if (IS_STAGING_ENV)
|
|
125092
|
+
return;
|
|
125093
|
+
if (await httpCheck(CONFIG.PORT)) {
|
|
125094
|
+
if (this.isRunningForCurrentApp()) {
|
|
125095
|
+
log("Server already running for this app.");
|
|
125096
|
+
return;
|
|
125097
|
+
}
|
|
125098
|
+
log("Server running for a different app — restarting...");
|
|
125099
|
+
await this.killServerOnPort();
|
|
125100
|
+
}
|
|
125101
|
+
this.ensureSetup();
|
|
125102
|
+
this.injectEmailCaptureInitializer();
|
|
125103
|
+
log("Starting server...");
|
|
125104
|
+
const logStream = fs$4.createWriteStream(CONFIG.LOG);
|
|
125105
|
+
this.process = spawn("bundle", [
|
|
125106
|
+
"exec",
|
|
125107
|
+
"rails",
|
|
125108
|
+
"server",
|
|
125109
|
+
"-p",
|
|
125110
|
+
CONFIG.PORT.toString(),
|
|
125111
|
+
"-b",
|
|
125112
|
+
"0.0.0.0",
|
|
125113
|
+
], {
|
|
125114
|
+
cwd: CONFIG.DIR,
|
|
125115
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
125116
|
+
env: this.serverEnv,
|
|
125117
|
+
});
|
|
125118
|
+
this.process.stdout?.pipe(logStream);
|
|
125119
|
+
this.process.stderr?.pipe(logStream);
|
|
125120
|
+
await this.waitForServer();
|
|
125121
|
+
log("Server ready.");
|
|
125122
|
+
};
|
|
125123
|
+
stop = async () => {
|
|
125124
|
+
if (IS_STAGING_ENV || !this.process)
|
|
125125
|
+
return;
|
|
125126
|
+
const pid = this.process.pid;
|
|
125127
|
+
log("Stopping server...");
|
|
125128
|
+
this.process.kill("SIGTERM");
|
|
125129
|
+
this.process = null;
|
|
125130
|
+
if (pid) {
|
|
125131
|
+
await this.waitForProcessExit(pid);
|
|
125132
|
+
}
|
|
125133
|
+
};
|
|
125134
|
+
}
|
|
125135
|
+
|
|
124953
125136
|
var main$1 = {exports: {}};
|
|
124954
125137
|
|
|
124955
125138
|
var version = "17.3.1";
|
|
@@ -124961,10 +125144,10 @@ var hasRequiredMain$1;
|
|
|
124961
125144
|
function requireMain$1 () {
|
|
124962
125145
|
if (hasRequiredMain$1) return main$1.exports;
|
|
124963
125146
|
hasRequiredMain$1 = 1;
|
|
124964
|
-
const fs =
|
|
125147
|
+
const fs = fs__default;
|
|
124965
125148
|
const path = path__default;
|
|
124966
|
-
const os = require$$0$
|
|
124967
|
-
const crypto = require$$0$
|
|
125149
|
+
const os = require$$0$4;
|
|
125150
|
+
const crypto = require$$0$8;
|
|
124968
125151
|
const packageJson = require$$4;
|
|
124969
125152
|
|
|
124970
125153
|
const version = packageJson.version;
|
|
@@ -125515,7 +125698,7 @@ const envLocalPath = `${envBasePath}.local`;
|
|
|
125515
125698
|
const reporterPackageName = "@bigbinary/neeto-playwright-reporter";
|
|
125516
125699
|
process.env.TEST_ENV = process.env.TEST_ENV ?? ENVIRONMENT.development;
|
|
125517
125700
|
loadEnv(`${envBasePath}.${process.env.TEST_ENV}`);
|
|
125518
|
-
|
|
125701
|
+
fs$4.existsSync(envLocalPath) && loadEnv(envLocalPath);
|
|
125519
125702
|
const playdashStagingConfig = {
|
|
125520
125703
|
apiKey: process.env.PLAYDASH_STAGING_API_KEY,
|
|
125521
125704
|
ciBuildId: process.env.NEETO_CI_JOB_ID,
|
|
@@ -125711,5 +125894,5 @@ const definePlaywrightConfig = (overrides) => {
|
|
|
125711
125894
|
});
|
|
125712
125895
|
};
|
|
125713
125896
|
|
|
125714
|
-
export { ACTIONS, ADMIN_PANEL_SELECTORS, API_KEYS_SELECTORS, API_ROUTES, AUDIT_LOGS_SELECTORS, ApiKeysApi, ApiKeysPage, AuditLogsPage, BASE_URL, CALENDAR_LABELS, CERTIFICATE_LIMIT_EXCEEDED_MESSAGE, CERTIFICATE_LIMIT_EXCEEDED_REGEXP, CHANGELOG_WIDGET_SELECTORS, CHAT_WIDGET_SELECTORS, CHAT_WIDGET_TEXTS, COLOR, COMMON_SELECTORS, COMMON_TEXTS, COMMUNITY_TEXTS, CREDENTIALS, CURRENT_TIME_RANGES, CUSTOM_DOMAIN_SELECTORS, CUSTOM_DOMAIN_SUFFIX, CustomCommands, CustomDomainApi, CustomDomainPage, DATE_FORMATS, DATE_PICKER_SELECTORS, DATE_RANGES, DATE_TEXTS, DEFAULT_WEBHOOKS_RESPONSE_TEXT, DESCRIPTION_EDITOR_TEXTS, EMBED_SELECTORS, EMOJI_LABEL, EMPTY_STORAGE_STATE, ENGAGE_TEXTS, ENVIRONMENT, EXAMPLE_URL, EXPANDED_FONT_SIZE, EXPORT_FILE_TYPES, EditorPage, EmbedBase, FILE_FORMATS, FONT_SIZE_SELECTORS, GLOBAL_TRANSLATIONS_PATTERN, GOOGLE_ANALYTICS_SELECTORS, GOOGLE_CALENDAR_DATE_FORMAT, GOOGLE_LOGIN_SELECTORS, GOOGLE_LOGIN_TEXTS, GOOGLE_SHEETS_SELECTORS, GooglePage, HELP_CENTER_ROUTES, HELP_CENTER_SELECTORS, HelpAndProfilePage, INTEGRATIONS_TEXTS, INTEGRATION_SELECTORS, IPRestrictionsPage, IP_RESTRICTIONS_SELECTORS, IS_DEV_ENV, IS_STAGING_ENV, ImageUploader, IntegrationBase, IpRestrictionsApi, KEYBOARD_SHORTCUTS_SELECTORS, KEYBOARD_SHORTCUT_TEST_CASES, LIST_MODIFIER_SELECTORS, LIST_MODIFIER_TAGS, LOGIN_SELECTORS, MEMBER_FORM_SELECTORS, MEMBER_SELECTORS, MEMBER_TEXTS, MERGE_TAGS_SELECTORS, MICROSOFT_LOGIN_SELECTORS, MICROSOFT_LOGIN_TEXTS, MailerUtils, Member, MemberApis, MicrosoftPage, NEETO_AUTH_BASE_URL, NEETO_EDITOR_SELECTORS, NEETO_FILTERS_SELECTORS, NEETO_IMAGE_UPLOADER_SELECTORS, NEETO_ROUTES, NEETO_SEO_SELECTORS, NEETO_TEXT_MODIFIER_SELECTORS, NeetoTowerApi, ONBOARDING_SELECTORS, ORGANIZATION_TEXTS, OTP_EMAIL_PATTERN, OrganizationPage, PAST_TIME_RANGES, PHONE_NUMBER_FORMATS, PLURAL, PROFILE_LINKS, PROFILE_SECTION_SELECTORS, PROJECT_NAMES, PROJECT_TRANSLATIONS_PATH, ROLES_SELECTORS, ROUTES,
|
|
125897
|
+
export { ACTIONS, ADMIN_PANEL_SELECTORS, API_KEYS_SELECTORS, API_ROUTES, AUDIT_LOGS_SELECTORS, ApiKeysApi, ApiKeysPage, AuditLogsPage, BASE_URL, CALENDAR_LABELS, CERTIFICATE_LIMIT_EXCEEDED_MESSAGE, CERTIFICATE_LIMIT_EXCEEDED_REGEXP, CHANGELOG_WIDGET_SELECTORS, CHAT_WIDGET_SELECTORS, CHAT_WIDGET_TEXTS, COLOR, COMMON_SELECTORS, COMMON_TEXTS, COMMUNITY_TEXTS, CREDENTIALS, CURRENT_TIME_RANGES, CUSTOM_DOMAIN_SELECTORS, CUSTOM_DOMAIN_SUFFIX, CustomCommands, CustomDomainApi, CustomDomainPage, DATE_FORMATS, DATE_PICKER_SELECTORS, DATE_RANGES, DATE_TEXTS, DEFAULT_WEBHOOKS_RESPONSE_TEXT, DESCRIPTION_EDITOR_TEXTS, EMBED_SELECTORS, EMOJI_LABEL, EMPTY_STORAGE_STATE, ENGAGE_TEXTS, ENVIRONMENT, EXAMPLE_URL, EXPANDED_FONT_SIZE, EXPORT_FILE_TYPES, EditorPage, EmbedBase, FILE_FORMATS, FONT_SIZE_SELECTORS, GLOBAL_TRANSLATIONS_PATTERN, GOOGLE_ANALYTICS_SELECTORS, GOOGLE_CALENDAR_DATE_FORMAT, GOOGLE_LOGIN_SELECTORS, GOOGLE_LOGIN_TEXTS, GOOGLE_SHEETS_SELECTORS, GooglePage, HELP_CENTER_ROUTES, HELP_CENTER_SELECTORS, HelpAndProfilePage, INTEGRATIONS_TEXTS, INTEGRATION_SELECTORS, IPRestrictionsPage, IP_RESTRICTIONS_SELECTORS, IS_DEV_ENV, IS_STAGING_ENV, ImageUploader, IntegrationBase, IpRestrictionsApi, KEYBOARD_SHORTCUTS_SELECTORS, KEYBOARD_SHORTCUT_TEST_CASES, LIST_MODIFIER_SELECTORS, LIST_MODIFIER_TAGS, LOGIN_SELECTORS, MEMBER_FORM_SELECTORS, MEMBER_SELECTORS, MEMBER_TEXTS, MERGE_TAGS_SELECTORS, MICROSOFT_LOGIN_SELECTORS, MICROSOFT_LOGIN_TEXTS, MailerUtils, Member, MemberApis, MicrosoftPage, NEETO_AUTH_BASE_URL, NEETO_EDITOR_SELECTORS, NEETO_FILTERS_SELECTORS, NEETO_IMAGE_UPLOADER_SELECTORS, NEETO_ROUTES, NEETO_SEO_SELECTORS, NEETO_TEXT_MODIFIER_SELECTORS, NeetoAuthServer, NeetoTowerApi, ONBOARDING_SELECTORS, ORGANIZATION_TEXTS, OTP_EMAIL_PATTERN, OrganizationPage, PAST_TIME_RANGES, PHONE_NUMBER_FORMATS, PLURAL, PROFILE_LINKS, PROFILE_SECTION_SELECTORS, PROJECT_NAMES, PROJECT_TRANSLATIONS_PATH, ROLES_SELECTORS, ROUTES, RailsEmailApiClient, RailsEmailUtils, RoleApis, RolesPage, SIGNUP_SELECTORS, SINGULAR, SLACK_DATA_QA_SELECTORS, SLACK_DEFAULT_CHANNEL, SLACK_SELECTORS, SLACK_WEB_TEXTS, STATUS_TEXTS, STORAGE_STATE, SecurityApi, SidebarSection, SlackApi, SlackPage, TABLE_SELECTORS, TAB_SELECTORS, TAGS_SELECTORS, TEAM_MEMBER_TEXTS, TEXT_MODIFIER_ROLES, TEXT_MODIFIER_SELECTORS, TEXT_MODIFIER_TAGS, THANK_YOU_SELECTORS, THEMES_SELECTORS, THEMES_TEXTS, THIRD_PARTY_ROUTES, TIME_RANGES, TOASTR_MESSAGES, TWILIO_SELECTORS, TagsApi, TagsPage, TeamMembers, ThankYouApi, ThankYouPage, TwilioApi, USER_AGENTS, WEBHOOK_SELECTORS, WebhookSiteApi, WebhooksPage, ZAPIER_LIMIT_EXHAUSTED_MESSAGE, ZAPIER_SELECTORS, ZAPIER_TEST_EMAIL, ZAPIER_WEB_TEXTS, ZapierPage, baseURLGenerator, basicHTMLContent, clearCredentials, commands, cpuThrottlingUsingCDP, createOrganizationViaRake, currencyUtils, dataQa, decodeQRCodeFromFile, definePlaywrightConfig, executeWithThrottledResources, extractSubdomainFromError, fillCredentialsAndSubmit, filterUtils, generatePhoneNumber, generatePhoneNumberDetails, generateRandomBypassEmail, generateRandomFile, generateStagingData, getByDataQA, getClipboardContent, getFormattedPhoneNumber, getFullUrl, getGlobalUserProps, getGlobalUserState, getImagePathAndName, getIsoCodeFromPhoneCode, getListCount, globalShortcuts, grantClipboardPermissions, hexToRGB, hexToRGBA, i18nFixture, imageRegex, initializeCredentials, initializeTestData, initializeTotp, isGithubIssueOpen, joinHyphenCase, joinString, login, loginWithoutSSO, networkConditions, networkThrottlingUsingCDP, readFileSyncIfExists, removeCredentialFile, serializeFileForBrowser, shouldSkipCustomDomainSetup, shouldSkipSetupAndTeardown, simulateClickWithDelay, simulateTypingWithDelay, skipTest, squish, stealth as stealthTest, tableUtils, toCamelCase, updateCredentials, warmup, writeDataToFile };
|
|
125715
125898
|
//# sourceMappingURL=index.js.map
|