@dev-blinq/cucumber_client 1.0.1711-dev → 1.0.1713-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.
@@ -3,318 +3,300 @@ import { BVTRecorder } from "./bvt_recorder.js";
3
3
  import { compareWithScenario } from "../code_gen/duplication_analysis.js";
4
4
  import { getAppDataDir } from "../utils/app_dir.js";
5
5
  import { readdir } from "fs/promises";
6
- import socketLogger, { getErrorMessage } from "../utils/socket_logger.js";
7
-
8
- let port = process.env.EDITOR_PORT || 3003;
6
+ import socketLogger, { getErrorMessage, responseSize } from "../utils/socket_logger.js";
7
+ const port = process.env.EDITOR_PORT || 3003;
9
8
  const WS_URL = process.env.WORKER_WS_SERVER_URL || "http://localhost:" + port;
10
-
11
- const responseSize = (response) => {
12
- try {
13
- if (typeof response !== "string") {
14
- return new Blob([JSON.stringify(response)]).size;
15
- } else {
16
- return new Blob([response]).size;
17
- }
18
- } catch {
19
- return -1;
20
- }
9
+ const SocketIOEvents = {
10
+ REQUEST: "request",
11
+ RESPONSE: "response",
12
+ CONNECT: "connect",
13
+ DISCONNECT: "disconnect",
14
+ CREATE_ROOM: "createRoom",
15
+ JOIN_ROOM: "joinRoom",
21
16
  };
22
-
23
17
  class PromisifiedSocketServer {
24
- constructor(socket, routes) {
25
- this.socket = socket;
26
- this.routes = routes;
27
- }
28
- init() {
29
- this.socket.on("request", async (data) => {
30
- const { event, input, id, roomId, socketId } = data;
31
- if (event !== "recorderWindow.getCurrentChromiumPath") {
32
- socketLogger.info("Received request", { event, input, id, roomId, socketId });
33
- }
34
- try {
35
- const handler = this.routes[event];
36
- if (!handler) {
37
- socketLogger.error(`No handler found for event: ${event}`, undefined, event);
38
- return;
39
- }
40
- const response = await handler(input);
41
- if (event !== "recorderWindow.getCurrentChromiumPath") {
42
- socketLogger.info(`Sending response for ${event}, ${responseSize(response)} bytes`);
43
- }
44
- this.socket.emit("response", { id, value: response, roomId, socketId });
45
- } catch (error) {
46
- socketLogger.error(
47
- "Error handling request",
48
- {
49
- input,
50
- id,
51
- roomId,
52
- socketId,
53
- error: error instanceof Error ? `${error.message}\n${error.stack}` : error,
54
- },
55
- event
56
- );
57
- this.socket.emit("response", {
58
- id,
59
- error: {
60
- message: error?.message,
61
- code: error?.code,
62
- info: error?.info,
63
- stack: error?.stack,
64
- },
65
- roomId,
66
- socketId,
18
+ socket;
19
+ routes;
20
+ constructor(socket, routes) {
21
+ this.socket = socket;
22
+ this.routes = routes;
23
+ }
24
+ init() {
25
+ this.socket.on(SocketIOEvents.REQUEST, async (data) => {
26
+ const { event, input, id, roomId, socketId } = data;
27
+ if (event !== "recorderWindow.getCurrentChromiumPath") {
28
+ socketLogger.info("Received request", { event, input, id, roomId, socketId });
29
+ }
30
+ try {
31
+ const handler = this.routes[event];
32
+ if (!handler) {
33
+ socketLogger.error(`No handler found for event: ${event}`, undefined, event);
34
+ return;
35
+ }
36
+ const response = await handler(input);
37
+ if (event !== "recorderWindow.getCurrentChromiumPath") {
38
+ socketLogger.info(`Sending response for ${event}, ${responseSize(response)} bytes`);
39
+ }
40
+ this.socket.emit(SocketIOEvents.RESPONSE, { id, value: response, roomId, socketId });
41
+ }
42
+ catch (error) {
43
+ socketLogger.error("Error handling request", {
44
+ input,
45
+ id,
46
+ roomId,
47
+ socketId,
48
+ error: error instanceof Error ? `${error.message}\n${error.stack}` : error,
49
+ }, event);
50
+ this.socket.emit(SocketIOEvents.RESPONSE, {
51
+ id,
52
+ error: {
53
+ message: error?.message,
54
+ code: error?.code,
55
+ info: error?.info,
56
+ stack: error?.stack,
57
+ },
58
+ roomId,
59
+ socketId,
60
+ });
61
+ }
67
62
  });
68
- }
69
- });
70
- }
63
+ }
71
64
  }
72
-
73
65
  const timeOutForFunction = async (promise, timeout = 5000) => {
74
- const timeoutPromise = new Promise((resolve) => setTimeout(() => resolve(), timeout));
75
-
76
- try {
77
- const res = await Promise.race([promise, timeoutPromise]);
78
- return res;
79
- } catch (error) {
80
- socketLogger.error(error, undefined, "timeOutForFunction");
81
- throw error;
82
- }
66
+ const timeoutPromise = new Promise((resolve) => setTimeout(() => resolve(), timeout));
67
+ try {
68
+ const res = await Promise.race([promise, timeoutPromise]);
69
+ return res;
70
+ }
71
+ catch (error) {
72
+ socketLogger.error(error, undefined, "timeOutForFunction");
73
+ throw error;
74
+ }
83
75
  };
84
-
85
76
  const CLIENT_IDENTIFIER = "cucumber_client/bvt_recorder";
86
-
87
77
  async function BVTRecorderInit({ envName, projectDir, roomId, TOKEN, socket = null }) {
88
- console.log(`Connecting to ${WS_URL}`);
89
- socket = socket || io(WS_URL);
90
- socketLogger.init(socket, { context: "BVTRecorder", eventName: "BVTRecorder.log" });
91
- socket.on("connect", () => {
92
- socketLogger.info(`${roomId} Connected to BVTRecorder server`);
93
- });
94
- socket.on("disconnect", (reason) => {
95
- socketLogger.info(`${roomId} Disconnected from server: ${reason}`);
96
- });
97
- socket.emit("joinRoom", { id: roomId, window: CLIENT_IDENTIFIER });
98
- const recorder = new BVTRecorder({
99
- envName,
100
- projectDir,
101
- TOKEN,
102
- sendEvent: (event, data) => {
103
- socketLogger.info("Sending event", { event, data, roomId });
104
- socket.emit(event, data, roomId);
105
- },
106
- logger: socketLogger,
107
- });
108
- // emit connected event for every 50 ms until connection_ack message is recieved
109
- let connected = false;
110
- const interval = setInterval(() => {
111
- if (connected) {
112
- clearInterval(interval);
113
- return;
114
- }
115
- socket.emit("BVTRecorder.connected", { roomId, window: "cucumber_client/bvt_recorder" }, roomId);
116
- }, 50);
117
-
118
- const promisifiedSocketServer = new PromisifiedSocketServer(socket, {
119
- "recorderWindow.connectionAck": async (input) => {
120
- connected = true;
121
- clearInterval(interval);
122
- },
123
- "recorderWindow.openBrowser": async (input) => {
124
- return recorder
125
- .openBrowser(input)
126
- .then(() => {
127
- socketLogger.info("BVTRecorder.browserOpened");
128
- socket.emit("BVTRecorder.browserOpened", { roomId, window: "cucumber_client/bvt_recorder" });
129
- })
130
- .catch((e) => {
131
- socketLogger.error(`Error opening browser: ${getErrorMessage(e)}`, undefined, "recorderWindow.openBrowser");
132
- socket.emit("BVTRecorder.browserLaunchFailed", { roomId, window: "cucumber_client/bvt_recorder" });
133
- });
134
- },
135
- "recorderWindow.closeBrowser": async (input) => {
136
- return recorder.closeBrowser(input);
137
- },
138
- "recorderWindow.reOpenBrowser": async (input) => {
139
- return recorder
140
- .reOpenBrowser(input)
141
- .then(() => {
142
- socketLogger.info("BVTRecorder.browserOpened");
143
- socket.emit("BVTRecorder.browserOpened", null, roomId);
144
- })
145
- .catch((e) => {
146
- socketLogger.error(
147
- `Error reopening browser: ${getErrorMessage(e)}`,
148
- undefined,
149
- "recorderWindow.reOpenBrowser"
150
- );
151
- socket.emit("BVTRecorder.browserLaunchFailed", null, roomId);
152
- });
153
- },
154
- "recorderWindow.startRecordingInput": async (input) => {
155
- return timeOutForFunction(recorder.startRecordingInput(input));
156
- },
157
- "recorderWindow.stopRecordingInput": async (input) => {
158
- return timeOutForFunction(recorder.stopRecordingInput(input));
159
- },
160
- "recorderWindow.startRecordingText": async (input) => {
161
- // console.log("--- {{ }} -- : recorderWindow.startRecordingText", input);
162
- return timeOutForFunction(recorder.startRecordingText(input));
163
- },
164
- "recorderWindow.stopRecordingText": async (input) => {
165
- return timeOutForFunction(recorder.stopRecordingText(input));
166
- },
167
- "recorderWindow.startRecordingContext": async (input) => {
168
- return timeOutForFunction(recorder.startRecordingContext(input));
169
- },
170
- "recorderWindow.stopRecordingContext": async (input) => {
171
- return timeOutForFunction(recorder.stopRecordingContext(input));
172
- },
173
- "recorderWindow.runStep": async (input) => {
174
- return recorder.runStep(input);
175
- },
176
- "recorderWindow.saveScenario": async (input) => {
177
- return recorder.saveScenario(input);
178
- },
179
- "recorderWindow.getImplementedSteps": async (input) => {
180
- return (await recorder.getImplementedSteps(input)).implementedSteps;
181
- },
182
- "recorderWindow.getImplementedScenarios": async (input) => {
183
- return (await recorder.getImplementedSteps(input)).scenarios;
184
- },
185
- "recorderWindow.getCurrentChromiumPath": async () => {
186
- return await recorder.getCurrentChromiumPath();
187
- },
188
- "recorderWindow.overwriteTestData": async (input) => {
189
- return await recorder.overwriteTestData(input);
190
- },
191
- "recorderWindow.generateStepName": async (input) => {
192
- return recorder.generateStepName(input);
193
- },
194
- "recorderWindow.getFeatureAndScenario": async (input) => {
195
- return recorder.generateScenarioAndFeatureNames(input);
196
- },
197
- "recorderWindow.generateCommandName": async (input) => {
198
- return recorder.generateCommandName(input);
199
- },
200
- "recorderWindow.loadTestData": async (input) => {
201
- return recorder.loadTestData(input);
202
- },
203
- "recorderWindow.discard": async (input) => {
204
- return await recorder.discardTestData(input);
205
- },
206
- "recorderWindow.addToTestData": async (input) => {
207
- return await recorder.addToTestData(input);
208
- },
209
- "recorderWindow.getScenarios": async () => {
210
- return recorder.getScenarios();
211
- },
212
- "recorderWindow.setShouldTakeScreenshot": async (input) => {
213
- return recorder.setShouldTakeScreenshot(input);
214
- },
215
- "recorderWindow.compareWithScenario": async ({ projectDir, scenario }, roomId) => {
216
- return await compareWithScenario(getAppDataDir(projectDir), scenario);
217
- },
218
- "recorderWindow.getCommandsForImplementedStep": async (input) => {
219
- return recorder.getCommandsForImplementedStep(input);
220
- },
221
- "recorderWindow.getNumberOfOccurrences": async (input) => {
222
- return recorder.getNumberOfOccurrences(input);
223
- },
224
- "recorderWindow.getFakeParams": async ({ parametersMap }) => {
225
- return recorder.fakeParams(parametersMap);
226
- },
227
- "recorderWindow.abortExecution": async (input) => {
228
- return recorder.abortExecution(input);
229
- },
230
- "recorderWindow.pauseExecution": async (input) => {
231
- return recorder.pauseExecution(input);
232
- },
233
- "recorderWindow.resumeExecution": async (input) => {
234
- return recorder.resumeExecution(input);
235
- },
236
- "recorderWindow.loadExistingScenario": async (input) => {
237
- return recorder.loadExistingScenario(input);
238
- },
239
- "recorderWindow.findRelatedTextInAllFrames": async (input) => {
240
- return recorder.findRelatedTextInAllFrames(input);
241
- },
242
- "recorderWindow.getReportFolder": async (input) => {
243
- return recorder.getReportFolder();
244
- },
245
- "recorderWindow.getSnapshotFiles": async (input) => {
246
- const snapshotFolder = recorder.getSnapshotFolder();
247
- if (snapshotFolder) {
248
- const files = await readdir(snapshotFolder);
249
- const ymlFiles = files.filter((file) => file.endsWith(".yml") || file.endsWith(".yaml"));
250
- return { folder: snapshotFolder, files: ymlFiles };
251
- } else return { folder: null, files: [] };
252
- },
253
- "recorderWindow.getCurrentPageTitle": async (input) => {
254
- return await recorder.getCurrentPageTitle();
255
- },
256
- "recorderWindow.getCurrentPageUrl": async (input) => {
257
- return await recorder.getCurrentPageUrl();
258
- },
259
- "recorderWindow.sendAriaSnapshot": async (input) => {
260
- const snapshot = input?.snapshot;
261
- const deselect = input?.deselect;
262
- if (deselect === true) {
263
- return await recorder.deselectAriaElements();
264
- }
265
- if (snapshot !== null) {
266
- return await recorder.processAriaSnapshot(snapshot);
267
- }
268
- },
269
- "recorderWindow.revertMode": async () => {
270
- await recorder.revertMode();
271
- },
272
- "recorderWindow.setMode": async (input) => {
273
- const mode = input?.mode;
274
- return recorder.setMode(mode);
275
- },
276
- "recorderWindow.getStepsAndCommandsForScenario": async (input) => {
277
- return await recorder.getStepsAndCommandsForScenario(input);
278
- },
279
- "recorderWindow.getNetworkEvents": async (input) => {
280
- return await recorder.getNetworkEvents(input);
281
- },
282
- "recorderWindow.initExecution": async (input) => {
283
- return await recorder.initExecution(input);
284
- },
285
- "recorderWindow.cleanupExecution": async (input) => {
286
- return await recorder.cleanupExecution(input);
287
- },
288
- "recorderWindow.resetExecution": async (input) => {
289
- return await recorder.resetExecution(input);
290
- },
291
- "recorderWindow.stopRecordingNetwork": async (input) => {
292
- return recorder.stopRecordingNetwork(input);
293
- },
294
- "recorderWindow.cleanup": async (input) => {
295
- return recorder.cleanup(input);
296
- },
297
- "recorderWindow.getStepCodeByScenario": async (input) => {
298
- return await recorder.getStepCodeByScenario(input);
299
- },
300
- "recorderWindow.setStepCodeByScenario": async (input) => {
301
- return await recorder.setStepCodeByScenario(input);
302
- },
303
- "recorderWindow.getRecorderContext": async (input) => {
304
- return await recorder.getContext();
305
- },
306
- "recorderWindow.addCommandToStepCode": async (input) => {
307
- return await recorder.addCommandToStepCode(input);
308
- },
309
- "recorderWindow.deleteCommandFromStepCode": async (input) => {
310
- return await recorder.deleteCommandFromStepCode(input);
311
- },
312
- });
313
-
314
- socket.on("targetBrowser.command.event", async (input) => {
315
- return recorder.onAction(input);
316
- });
317
- promisifiedSocketServer.init();
78
+ console.log(`Connecting to ${WS_URL}`);
79
+ socket = socket || io(WS_URL);
80
+ socketLogger.init(socket, { context: "BVTRecorder", eventName: "BVTRecorder.log" });
81
+ socket.on(SocketIOEvents.CONNECT, () => {
82
+ socketLogger.info(`${roomId} Connected to BVTRecorder server`);
83
+ });
84
+ socket.on(SocketIOEvents.DISCONNECT, (reason) => {
85
+ socketLogger.info(`${roomId} Disconnected from server: ${reason}`);
86
+ });
87
+ socket.emit(SocketIOEvents.JOIN_ROOM, { id: roomId, window: CLIENT_IDENTIFIER });
88
+ const recorder = new BVTRecorder({
89
+ envName,
90
+ projectDir,
91
+ TOKEN,
92
+ sendEvent: (event, data) => {
93
+ socketLogger.info("Sending event", { event, data, roomId });
94
+ socket.emit(event, data, roomId);
95
+ },
96
+ logger: socketLogger,
97
+ });
98
+ // emit connected event for every 50 ms until connection_ack message is recieved
99
+ let connected = false;
100
+ const interval = setInterval(() => {
101
+ if (connected) {
102
+ clearInterval(interval);
103
+ return;
104
+ }
105
+ socket.emit("BVTRecorder.connected", { roomId, window: "cucumber_client/bvt_recorder" }, roomId);
106
+ }, 50);
107
+ const promisifiedSocketServer = new PromisifiedSocketServer(socket, {
108
+ "recorderWindow.connectionAck": async (input) => {
109
+ connected = true;
110
+ clearInterval(interval);
111
+ },
112
+ "recorderWindow.openBrowser": async (input) => {
113
+ return recorder
114
+ .openBrowser(input)
115
+ .then(() => {
116
+ socketLogger.info("BVTRecorder.browserOpened");
117
+ socket.emit("BVTRecorder.browserOpened", { roomId, window: "cucumber_client/bvt_recorder" });
118
+ })
119
+ .catch((e) => {
120
+ socketLogger.error(`Error opening browser: ${getErrorMessage(e)}`, undefined, "recorderWindow.openBrowser");
121
+ socket.emit("BVTRecorder.browserLaunchFailed", { roomId, window: "cucumber_client/bvt_recorder" });
122
+ });
123
+ },
124
+ "recorderWindow.closeBrowser": async (input) => {
125
+ return recorder.closeBrowser(input);
126
+ },
127
+ "recorderWindow.reOpenBrowser": async (input) => {
128
+ return recorder
129
+ .reOpenBrowser(input)
130
+ .then(() => {
131
+ socketLogger.info("BVTRecorder.browserOpened");
132
+ socket.emit("BVTRecorder.browserOpened", null, roomId);
133
+ })
134
+ .catch((e) => {
135
+ socketLogger.error(`Error reopening browser: ${getErrorMessage(e)}`, undefined, "recorderWindow.reOpenBrowser");
136
+ socket.emit("BVTRecorder.browserLaunchFailed", null, roomId);
137
+ });
138
+ },
139
+ "recorderWindow.startRecordingInput": async (input) => {
140
+ return timeOutForFunction(recorder.startRecordingInput(input));
141
+ },
142
+ "recorderWindow.stopRecordingInput": async (input) => {
143
+ return timeOutForFunction(recorder.stopRecordingInput(input));
144
+ },
145
+ "recorderWindow.startRecordingText": async (input) => {
146
+ // console.log("--- {{ }} -- : recorderWindow.startRecordingText", input);
147
+ return timeOutForFunction(recorder.startRecordingText(input));
148
+ },
149
+ "recorderWindow.stopRecordingText": async (input) => {
150
+ return timeOutForFunction(recorder.stopRecordingText(input));
151
+ },
152
+ "recorderWindow.startRecordingContext": async (input) => {
153
+ return timeOutForFunction(recorder.startRecordingContext(input));
154
+ },
155
+ "recorderWindow.stopRecordingContext": async (input) => {
156
+ return timeOutForFunction(recorder.stopRecordingContext(input));
157
+ },
158
+ "recorderWindow.runStep": async (input) => {
159
+ return recorder.runStep(input);
160
+ },
161
+ "recorderWindow.saveScenario": async (input) => {
162
+ return recorder.saveScenario(input);
163
+ },
164
+ "recorderWindow.getImplementedSteps": async (input) => {
165
+ return (await recorder.getImplementedSteps(input)).implementedSteps;
166
+ },
167
+ "recorderWindow.getImplementedScenarios": async (input) => {
168
+ return (await recorder.getImplementedSteps(input)).scenarios;
169
+ },
170
+ "recorderWindow.getCurrentChromiumPath": async () => {
171
+ return recorder.getCurrentChromiumPath();
172
+ },
173
+ "recorderWindow.overwriteTestData": async (input) => {
174
+ return await recorder.overwriteTestData(input);
175
+ },
176
+ "recorderWindow.generateStepName": async (input) => {
177
+ return recorder.generateStepName(input);
178
+ },
179
+ "recorderWindow.getFeatureAndScenario": async (input) => {
180
+ return recorder.generateScenarioAndFeatureNames(input);
181
+ },
182
+ "recorderWindow.generateCommandName": async (input) => {
183
+ return recorder.generateCommandName(input);
184
+ },
185
+ "recorderWindow.loadTestData": async (input) => {
186
+ return recorder.loadTestData(input);
187
+ },
188
+ "recorderWindow.discard": async (input) => {
189
+ return await recorder.discardTestData(input);
190
+ },
191
+ "recorderWindow.addToTestData": async (input) => {
192
+ return await recorder.addToTestData(input);
193
+ },
194
+ "recorderWindow.getScenarios": async () => {
195
+ return recorder.getScenarios();
196
+ },
197
+ "recorderWindow.setShouldTakeScreenshot": async (input) => {
198
+ return recorder.setShouldTakeScreenshot(input);
199
+ },
200
+ "recorderWindow.compareWithScenario": async ({ projectDir, scenario }, roomId) => {
201
+ return await compareWithScenario(getAppDataDir(projectDir), scenario);
202
+ },
203
+ "recorderWindow.getCommandsForImplementedStep": async (input) => {
204
+ return recorder.getCommandsForImplementedStep(input);
205
+ },
206
+ "recorderWindow.getNumberOfOccurrences": async (input) => {
207
+ return recorder.getNumberOfOccurrences(input);
208
+ },
209
+ "recorderWindow.getFakeParams": async ({ parametersMap }) => {
210
+ return recorder.fakeParams(parametersMap);
211
+ },
212
+ "recorderWindow.abortExecution": async (_) => {
213
+ return recorder.abortExecution();
214
+ },
215
+ "recorderWindow.pauseExecution": async (input) => {
216
+ return recorder.pauseExecution(input);
217
+ },
218
+ "recorderWindow.resumeExecution": async (input) => {
219
+ return recorder.resumeExecution(input);
220
+ },
221
+ "recorderWindow.loadExistingScenario": async (input) => {
222
+ return recorder.loadExistingScenario(input);
223
+ },
224
+ "recorderWindow.findRelatedTextInAllFrames": async (input) => {
225
+ return recorder.findRelatedTextInAllFrames(input);
226
+ },
227
+ "recorderWindow.getReportFolder": async (input) => {
228
+ return recorder.getReportFolder();
229
+ },
230
+ "recorderWindow.getSnapshotFiles": async (input) => {
231
+ const snapshotFolder = recorder.getSnapshotFolder();
232
+ if (snapshotFolder) {
233
+ const files = await readdir(snapshotFolder);
234
+ const ymlFiles = files.filter((file) => file.endsWith(".yml") || file.endsWith(".yaml"));
235
+ return { folder: snapshotFolder, files: ymlFiles };
236
+ }
237
+ else
238
+ return { folder: null, files: [] };
239
+ },
240
+ "recorderWindow.getCurrentPageTitle": async () => {
241
+ return await recorder.getCurrentPageTitle();
242
+ },
243
+ "recorderWindow.getCurrentPageUrl": async () => {
244
+ return recorder.getCurrentPageUrl();
245
+ },
246
+ "recorderWindow.sendAriaSnapshot": async (input) => {
247
+ const snapshot = input?.snapshot;
248
+ const deselect = input?.deselect;
249
+ if (deselect === true) {
250
+ return await recorder.deselectAriaElements();
251
+ }
252
+ if (snapshot !== null) {
253
+ return await recorder.processAriaSnapshot(snapshot);
254
+ }
255
+ },
256
+ "recorderWindow.revertMode": async () => {
257
+ await recorder.revertMode();
258
+ },
259
+ "recorderWindow.setMode": async (input) => {
260
+ const mode = input?.mode;
261
+ return recorder.setMode(mode);
262
+ },
263
+ "recorderWindow.getStepsAndCommandsForScenario": async (input) => {
264
+ return await recorder.getStepsAndCommandsForScenario(input);
265
+ },
266
+ "recorderWindow.initExecution": async (input) => {
267
+ return await recorder.initExecution(input);
268
+ },
269
+ "recorderWindow.cleanupExecution": async (input) => {
270
+ return await recorder.cleanupExecution(input);
271
+ },
272
+ "recorderWindow.resetExecution": async (input) => {
273
+ return await recorder.resetExecution(input);
274
+ },
275
+ "recorderWindow.stopRecordingNetwork": async (input) => {
276
+ return recorder.stopRecordingNetwork(input);
277
+ },
278
+ "recorderWindow.cleanup": async (input) => {
279
+ return recorder.cleanup(input);
280
+ },
281
+ "recorderWindow.getStepCodeByScenario": async (input) => {
282
+ return await recorder.getStepCodeByScenario(input);
283
+ },
284
+ "recorderWindow.setStepCodeByScenario": async (input) => {
285
+ return await recorder.setStepCodeByScenario(input);
286
+ },
287
+ "recorderWindow.getRecorderContext": async () => {
288
+ return await recorder.getContext();
289
+ },
290
+ "recorderWindow.addCommandToStepCode": async (input) => {
291
+ return await recorder.addCommandToStepCode(input);
292
+ },
293
+ "recorderWindow.deleteCommandFromStepCode": async (input) => {
294
+ return await recorder.deleteCommandFromStepCode(input);
295
+ },
296
+ });
297
+ socket.on("targetBrowser.command.event", async (input) => {
298
+ return recorder.onAction(input);
299
+ });
300
+ promisifiedSocketServer.init();
318
301
  }
319
-
320
302
  export { BVTRecorderInit };