bdy 1.20.3 → 1.20.4-dev
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/distTs/package.json +2 -2
- package/distTs/src/api/client.js +83 -0
- package/distTs/src/command/whoami.js +12 -0
- package/distTs/src/index.js +4 -6
- package/distTs/src/input.js +78 -0
- package/distTs/src/project/cfg.js +39 -0
- package/distTs/src/texts.js +67 -41
- package/distTs/src/unitTest/requests.js +23 -10
- package/distTs/src/visualTest/context.js +42 -31
- package/distTs/src/visualTest/requests.js +39 -139
- package/distTs/src/visualTest/resources.js +40 -38
- package/distTs/src/visualTest/server.js +2 -2
- package/distTs/src/visualTest/snapshots.js +18 -17
- package/distTs/src/visualTest/validation.js +2 -10
- package/package.json +2 -2
|
@@ -20,13 +20,13 @@ let sessionLink = '';
|
|
|
20
20
|
function setDefaultSettings(defaultSettings) {
|
|
21
21
|
defaultDevices = defaultSettings.defaultDevices;
|
|
22
22
|
}
|
|
23
|
-
function addSnapshot(snapshot) {
|
|
23
|
+
function addSnapshot(ctx, snapshot) {
|
|
24
24
|
const preparedSnapshot = {
|
|
25
25
|
...snapshot,
|
|
26
26
|
devices: snapshot.devices.length > 0 ? snapshot.devices : defaultDevices,
|
|
27
27
|
};
|
|
28
|
-
if (
|
|
29
|
-
(0, queue_1.addToQueue)(() => processSnapshot(preparedSnapshot, firstSnapshot));
|
|
28
|
+
if (ctx.oneByOne) {
|
|
29
|
+
(0, queue_1.addToQueue)(() => processSnapshot(ctx, preparedSnapshot, firstSnapshot));
|
|
30
30
|
}
|
|
31
31
|
else {
|
|
32
32
|
snapshots.push(preparedSnapshot);
|
|
@@ -35,12 +35,12 @@ function addSnapshot(snapshot) {
|
|
|
35
35
|
firstSnapshot = false;
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
async function finishProcessingSnapshots(spawnedProcessExitCode) {
|
|
39
|
-
if (
|
|
38
|
+
async function finishProcessingSnapshots(ctx, spawnedProcessExitCode) {
|
|
39
|
+
if (ctx.oneByOne) {
|
|
40
40
|
return await (0, queue_1.isQueueEmpty)();
|
|
41
41
|
}
|
|
42
42
|
if (spawnedProcessExitCode === 0) {
|
|
43
|
-
return await processSnapshots();
|
|
43
|
+
return await processSnapshots(ctx);
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
function showSessionLink() {
|
|
@@ -48,17 +48,17 @@ function showSessionLink() {
|
|
|
48
48
|
output_1.default.normal((0, texts_1.LOG_SESSION_LINK)(sessionLink));
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
|
-
async function processSnapshot(snapshot, firstSnapshot) {
|
|
51
|
+
async function processSnapshot(ctx, snapshot, firstSnapshot) {
|
|
52
52
|
let t1;
|
|
53
53
|
if (context_1.debug) {
|
|
54
54
|
t1 = performance.now();
|
|
55
55
|
}
|
|
56
|
-
const preparedSnapshot =
|
|
56
|
+
const preparedSnapshot = ctx.skipDiscovery
|
|
57
57
|
? snapshot
|
|
58
|
-
: await getSnapshotWithResources(snapshot);
|
|
58
|
+
: await getSnapshotWithResources(ctx, snapshot);
|
|
59
59
|
try {
|
|
60
60
|
output_1.default.normal(texts_1.LOG_SENDING_DATA);
|
|
61
|
-
const { message } = await (0, requests_1.sendSnapshot)(preparedSnapshot, firstSnapshot);
|
|
61
|
+
const { message } = await (0, requests_1.sendSnapshot)(ctx, preparedSnapshot, firstSnapshot);
|
|
62
62
|
sessionLink = message;
|
|
63
63
|
}
|
|
64
64
|
catch (error) {
|
|
@@ -69,22 +69,22 @@ async function processSnapshot(snapshot, firstSnapshot) {
|
|
|
69
69
|
output_1.default.normal((0, texts_1.DEBUG_SNAPSHOT_PROCESSING)(snapshot.name, t2 - t1));
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
|
-
async function processSnapshots() {
|
|
72
|
+
async function processSnapshots(ctx) {
|
|
73
73
|
let t1;
|
|
74
74
|
if (context_1.debug) {
|
|
75
75
|
t1 = performance.now();
|
|
76
76
|
}
|
|
77
77
|
output_1.default.normal((0, texts_1.LOG_PROCESSING_SNAPSHOTS)(snapshots.length));
|
|
78
|
-
const preparedSnapshots =
|
|
78
|
+
const preparedSnapshots = ctx.skipDiscovery
|
|
79
79
|
? snapshots
|
|
80
|
-
: await getSnapshotsWithResources(snapshots);
|
|
80
|
+
: await getSnapshotsWithResources(ctx, snapshots);
|
|
81
81
|
if (preparedSnapshots.length === 0) {
|
|
82
82
|
output_1.default.error(texts_1.ERR_NO_SNAPSHOTS_TO_SEND);
|
|
83
83
|
}
|
|
84
84
|
else {
|
|
85
85
|
try {
|
|
86
86
|
output_1.default.normal(texts_1.LOG_SENDING_DATA);
|
|
87
|
-
const { message } = await (0, requests_1.sendSnapshots)(preparedSnapshots);
|
|
87
|
+
const { message } = await (0, requests_1.sendSnapshots)(ctx, preparedSnapshots);
|
|
88
88
|
sessionLink = message;
|
|
89
89
|
}
|
|
90
90
|
catch (error) {
|
|
@@ -96,13 +96,14 @@ async function processSnapshots() {
|
|
|
96
96
|
output_1.default.normal((0, texts_1.DEBUG_SNAPSHOTS_PROCESSING)(t2 - t1));
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
|
-
async function getSnapshotWithResources(snapshot) {
|
|
99
|
+
async function getSnapshotWithResources(ctx, snapshot) {
|
|
100
100
|
const { url, devices, resourceDiscoveryTimeout, cookies } = snapshot;
|
|
101
101
|
const resources = await (0, resources_1.collectResources)({
|
|
102
102
|
url,
|
|
103
103
|
devices,
|
|
104
104
|
resourceDiscoveryTimeout,
|
|
105
105
|
cookies,
|
|
106
|
+
browserPath: ctx.browserPath,
|
|
106
107
|
});
|
|
107
108
|
if (context_1.debug) {
|
|
108
109
|
output_1.default.normal(`Collected resources for snapshot: ${snapshot.name}`);
|
|
@@ -115,11 +116,11 @@ async function getSnapshotWithResources(snapshot) {
|
|
|
115
116
|
resources: [...snapshot.resources, ...resources],
|
|
116
117
|
};
|
|
117
118
|
}
|
|
118
|
-
async function getSnapshotsWithResources(snapshots) {
|
|
119
|
+
async function getSnapshotsWithResources(ctx, snapshots) {
|
|
119
120
|
const snapshotsWithResources = [];
|
|
120
121
|
const prepareSnapshots = filterDuplicates(snapshots);
|
|
121
122
|
for (const snapshot of prepareSnapshots) {
|
|
122
|
-
const snapshotWithResources = await getSnapshotWithResources(snapshot);
|
|
123
|
+
const snapshotWithResources = await getSnapshotWithResources(ctx, snapshot);
|
|
123
124
|
snapshotsWithResources.push(snapshotWithResources);
|
|
124
125
|
}
|
|
125
126
|
return snapshotsWithResources;
|
|
@@ -1,20 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.checkToken = checkToken;
|
|
4
3
|
exports.checkBuildId = checkBuildId;
|
|
5
4
|
exports.checkParallel = checkParallel;
|
|
6
|
-
const context_1 = require("./context");
|
|
7
|
-
function checkToken(type) {
|
|
8
|
-
if (type === 'scrape') {
|
|
9
|
-
return !!context_1.scrapeToken;
|
|
10
|
-
}
|
|
11
|
-
return !!context_1.vtToken;
|
|
12
|
-
}
|
|
13
5
|
function checkBuildId() {
|
|
14
6
|
return !!process.env.SNAPSHOTS_BUILD_ID;
|
|
15
7
|
}
|
|
16
|
-
function checkParallel() {
|
|
17
|
-
if (
|
|
8
|
+
function checkParallel(ctx) {
|
|
9
|
+
if (ctx.parallel) {
|
|
18
10
|
return checkBuildId();
|
|
19
11
|
}
|
|
20
12
|
return true;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bdy",
|
|
3
3
|
"preferGlobal": false,
|
|
4
|
-
"version": "1.20.
|
|
4
|
+
"version": "1.20.4-dev",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"scripts": {
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"cookie": "1.1.1",
|
|
47
47
|
"cross-spawn": "7.0.6",
|
|
48
48
|
"eventsource": "4.1.0",
|
|
49
|
-
"fastify": "5.8.
|
|
49
|
+
"fastify": "5.8.5",
|
|
50
50
|
"fdir": "6.5.0",
|
|
51
51
|
"fflate": "0.8.2",
|
|
52
52
|
"human-id": "4.1.3",
|