@dev-blinq/cucumber_client 1.0.1549-dev → 1.0.1551-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.
|
@@ -23,6 +23,13 @@ export class NamesService {
|
|
|
23
23
|
}
|
|
24
24
|
const url = `${getRunsServiceBaseURL()}/generate-step-information/generate`;
|
|
25
25
|
const TIMEOUT = 120; // 2 minutes
|
|
26
|
+
//!REMOVE LOG AFTER TESTING
|
|
27
|
+
console.log("Generating step name with data:", {
|
|
28
|
+
commands,
|
|
29
|
+
stepsNames,
|
|
30
|
+
parameters,
|
|
31
|
+
map,
|
|
32
|
+
}, "and TOKEN:", this.TOKEN);
|
|
26
33
|
const { data } = await axiosClient({
|
|
27
34
|
url,
|
|
28
35
|
method: "POST",
|
|
@@ -57,7 +64,7 @@ export class NamesService {
|
|
|
57
64
|
}
|
|
58
65
|
catch (error) {
|
|
59
66
|
if (i === TIMEOUT - 1) {
|
|
60
|
-
this.logger.error("Timeout while generating step details: ", error instanceof Error ? error
|
|
67
|
+
this.logger.error("Timeout while generating step details: ", error instanceof Error ? error : { message: JSON.stringify(error) });
|
|
61
68
|
console.error("Timeout while generating step details: ", error instanceof Error ? error.message : error);
|
|
62
69
|
}
|
|
63
70
|
}
|
|
@@ -171,7 +178,7 @@ export class RemoteBrowserService extends EventEmitter {
|
|
|
171
178
|
this.emit("debugURLChange", id);
|
|
172
179
|
}
|
|
173
180
|
catch (error) {
|
|
174
|
-
this.logger.error("Error fetching debug URLs: ", error instanceof Error ? error
|
|
181
|
+
this.logger.error("Error fetching debug URLs: ", error instanceof Error ? error : { message: JSON.stringify(error) });
|
|
175
182
|
}
|
|
176
183
|
}
|
|
177
184
|
set selectedPage(page) {
|
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
import { io } from "socket.io-client";
|
|
2
2
|
import { BVTRecorderInit } from "./bvt_init.js";
|
|
3
3
|
import { loadArgs, showUsage, validateCLIArg } from "../cli_helpers.js";
|
|
4
|
-
const requiredEnvVars = ["PROJECT_ID", "BLINQ_TOKEN", "SESSION_ID", "WORKER_WS_SERVER_URL"];
|
|
4
|
+
const requiredEnvVars = ["PROJECT_ID", "BLINQ_TOKEN", "SESSION_ID", "WORKER_WS_SERVER_URL", "REMOTE_ORIGINS_URL"];
|
|
5
5
|
function validateEnvVariables() {
|
|
6
6
|
const missingVars = requiredEnvVars.filter((varName) => !process.env[varName]);
|
|
7
7
|
if (missingVars.length > 0) {
|
|
8
8
|
throw new Error(`Missing required environment variables: ${missingVars.join(", ")}`);
|
|
9
9
|
}
|
|
10
|
+
else {
|
|
11
|
+
console.log("All required environment variables are set.");
|
|
12
|
+
requiredEnvVars.forEach((varName) => {
|
|
13
|
+
console.log(`${varName}: ${process.env[varName]}`);
|
|
14
|
+
});
|
|
15
|
+
}
|
|
10
16
|
}
|
|
11
17
|
function getEnvironmentConfig() {
|
|
12
18
|
const args = loadArgs();
|
|
@@ -1,132 +1,70 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @typedef {Object} SocketLoggerEventPayload
|
|
3
|
-
* @property {string} level Log level (e.g. "info", "warn", "error", "debug")
|
|
4
|
-
* @property {string} context Log context/subsystem (e.g. "BVTRecorder")
|
|
5
|
-
* @property {*} data The log message payload (string, object, etc)
|
|
6
|
-
* @property {string} timestamp ISO string when the log was emitted
|
|
7
|
-
* @property {number} dataSize Size of data in bytes (-1 if unknown)
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* @typedef {Object} SocketLoggerInitOptions
|
|
12
|
-
* @property {string=} context Default context for all logs (optional)
|
|
13
|
-
* @property {string=} eventName Default event name (default: "recorder.log")
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
1
|
/**
|
|
17
2
|
* SocketLogger - Singleton for structured socket-based logging.
|
|
18
3
|
*
|
|
19
|
-
* @namespace SocketLogger
|
|
20
|
-
* @property {function(import('socket.io-client').Socket|import('socket.io').Socket, SocketLoggerInitOptions=):void} init
|
|
21
|
-
* @property {function(string, (string|*), Object=, string=, string=):void} log
|
|
22
|
-
* @property {function((string|*), Object=):void} info
|
|
23
|
-
* @property {function((string|*), Object=):void} warn
|
|
24
|
-
* @property {function((string|*), Object=):void} debug
|
|
25
|
-
* @property {function((string|*), Object=):void} error
|
|
26
|
-
*
|
|
27
4
|
* @example
|
|
28
|
-
* import
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
5
|
+
* import SocketLogger from "./socket_logger";
|
|
6
|
+
* SocketLogger.getInstance().init(socket, { context: "BVTRecorder" });
|
|
7
|
+
* SocketLogger.getInstance().info("Step started", { step: 2 });
|
|
8
|
+
* SocketLogger.getInstance().error("Failed!", { error: "bad stuff" });
|
|
32
9
|
*/
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
10
|
+
export class SocketLogger {
|
|
11
|
+
static instance;
|
|
12
|
+
socket = null;
|
|
13
|
+
defaultContext = "";
|
|
14
|
+
defaultEventName = "recorder.log";
|
|
15
|
+
constructor() { }
|
|
16
|
+
static getInstance() {
|
|
17
|
+
if (!SocketLogger.instance) {
|
|
18
|
+
SocketLogger.instance = new SocketLogger();
|
|
19
|
+
}
|
|
20
|
+
return SocketLogger.instance;
|
|
21
|
+
}
|
|
22
|
+
init(sock, opts) {
|
|
23
|
+
this.socket = sock;
|
|
24
|
+
this.defaultContext = opts?.context || "";
|
|
25
|
+
this.defaultEventName = opts?.eventName || "recorder.log";
|
|
26
|
+
}
|
|
27
|
+
log(level, message, extra, eventName, context) {
|
|
28
|
+
if (!this.socket || typeof this.socket.emit !== "function")
|
|
29
|
+
return;
|
|
30
|
+
const data = typeof message === "object" ? message : { message };
|
|
31
|
+
let dataSize = 0;
|
|
32
|
+
try {
|
|
33
|
+
dataSize = Buffer.byteLength(JSON.stringify(data || ""), "utf8");
|
|
34
|
+
}
|
|
35
|
+
catch (e) {
|
|
36
|
+
dataSize = -1;
|
|
37
|
+
}
|
|
38
|
+
const eventPayload = {
|
|
39
|
+
level,
|
|
40
|
+
context: context || this.defaultContext,
|
|
41
|
+
data,
|
|
42
|
+
timestamp: new Date().toISOString(),
|
|
43
|
+
dataSize,
|
|
44
|
+
...extra,
|
|
45
|
+
};
|
|
46
|
+
try {
|
|
47
|
+
if (this.socket) {
|
|
48
|
+
this.socket.emit(eventName || this.defaultEventName, eventPayload);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
catch (e) {
|
|
52
|
+
console.error("Socket logging error:", e);
|
|
53
|
+
console.log("Socket event payload:", eventPayload);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
info(msg, ext) {
|
|
57
|
+
this.log("info", msg, ext);
|
|
58
|
+
}
|
|
59
|
+
warn(msg, ext) {
|
|
60
|
+
this.log("warn", msg, ext);
|
|
61
|
+
}
|
|
62
|
+
debug(msg, ext) {
|
|
63
|
+
this.log("debug", msg, ext);
|
|
70
64
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
{
|
|
74
|
-
level: level,
|
|
75
|
-
context: context || defaultContext,
|
|
76
|
-
data: data,
|
|
77
|
-
timestamp: new Date().toISOString(),
|
|
78
|
-
dataSize: dataSize,
|
|
79
|
-
},
|
|
80
|
-
extra || {}
|
|
81
|
-
);
|
|
82
|
-
// @ts-ignore
|
|
83
|
-
try {
|
|
84
|
-
if (socket) {
|
|
85
|
-
socket.emit(eventName || defaultEventName, eventPayload);
|
|
86
|
-
}
|
|
87
|
-
} catch (e) {
|
|
88
|
-
console.error("Socket logging error:", e);
|
|
89
|
-
console.log("Socket event payload:", eventPayload);
|
|
65
|
+
error(msg, ext) {
|
|
66
|
+
this.log("error", msg, ext);
|
|
90
67
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
* Write an info-level log event.
|
|
95
|
-
* @param {string|*} msg The message or object
|
|
96
|
-
* @param {Object=} ext Any extra fields/metadata
|
|
97
|
-
*/
|
|
98
|
-
function info(msg, ext) {
|
|
99
|
-
log("info", msg, ext);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* Write a warn-level log event.
|
|
104
|
-
* @param {string|*} msg The message or object
|
|
105
|
-
* @param {Object=} ext Any extra fields/metadata
|
|
106
|
-
*/
|
|
107
|
-
function warn(msg, ext) {
|
|
108
|
-
log("warn", msg, ext);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* Write a debug-level log event.
|
|
113
|
-
* @param {string|*} msg The message or object
|
|
114
|
-
* @param {Object=} ext Any extra fields/metadata
|
|
115
|
-
*/
|
|
116
|
-
function debug(msg, ext) {
|
|
117
|
-
log("debug", msg, ext);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* Write an error-level log event.
|
|
122
|
-
* @param {string|*} msg The message or object
|
|
123
|
-
* @param {Object=} ext Any extra fields/metadata
|
|
124
|
-
*/
|
|
125
|
-
function error(msg, ext) {
|
|
126
|
-
log("error", msg, ext);
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
return { init, log, info, warn, debug, error };
|
|
130
|
-
})();
|
|
131
|
-
|
|
132
|
-
export default SocketLogger;
|
|
68
|
+
}
|
|
69
|
+
const socketLoggerInstance = SocketLogger.getInstance();
|
|
70
|
+
export default socketLoggerInstance;
|