@dev-blinq/cucumber_client 1.0.1602-dev → 1.0.1603-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.
|
@@ -243,6 +243,7 @@ export class RemoteBrowserService extends EventEmitter {
|
|
|
243
243
|
}
|
|
244
244
|
const cdpSession = await page.context().newCDPSession(page);
|
|
245
245
|
const { targetInfo } = await cdpSession.send("Target.getTargetInfo");
|
|
246
|
+
this.log("🔍 Retrieved TargetInfo via CDP session", targetInfo);
|
|
246
247
|
await cdpSession.detach();
|
|
247
248
|
if (targetInfo && targetInfo.targetId) {
|
|
248
249
|
this.log("✅ Found CDP ID by session", { id: targetInfo.targetId, url: page.url() });
|
|
@@ -509,9 +509,9 @@ export async function saveRecording({ step, cucumberStep, codePage, projectDir,
|
|
|
509
509
|
// remove the folder
|
|
510
510
|
try {
|
|
511
511
|
rmSync(routesPath, { recursive: true });
|
|
512
|
-
|
|
512
|
+
//
|
|
513
513
|
} catch (error) {
|
|
514
|
-
|
|
514
|
+
//
|
|
515
515
|
}
|
|
516
516
|
routesPath = path.join(projectDir, "data", "routes");
|
|
517
517
|
if (!existsSync(routesPath)) {
|
|
@@ -538,27 +538,21 @@ export async function saveRecording({ step, cucumberStep, codePage, projectDir,
|
|
|
538
538
|
|
|
539
539
|
routesPath = path.join(tmpdir(), "blinq_temp_routes");
|
|
540
540
|
if (process.env.TEMP_RUN === "true") {
|
|
541
|
-
console.log("Save routes in temp folder for running:", routesPath);
|
|
542
541
|
if (existsSync(routesPath)) {
|
|
543
|
-
console.log("Removing existing temp_routes_folder:", routesPath);
|
|
544
542
|
rmSync(routesPath, { recursive: true });
|
|
545
543
|
}
|
|
546
544
|
mkdirSync(routesPath, { recursive: true });
|
|
547
|
-
console.log("Created temp_routes_folder:", routesPath);
|
|
548
545
|
saveRoutes({ step, folderPath: routesPath });
|
|
549
546
|
} else {
|
|
550
|
-
console.log("Saving routes in project directory:", projectDir);
|
|
551
547
|
if (existsSync(routesPath)) {
|
|
552
548
|
// remove the folder
|
|
553
549
|
try {
|
|
554
550
|
rmSync(routesPath, { recursive: true });
|
|
555
|
-
console.log("Removed temp_routes_folder:", routesPath);
|
|
556
551
|
} catch (error) {
|
|
557
|
-
|
|
552
|
+
//
|
|
558
553
|
}
|
|
559
554
|
}
|
|
560
555
|
routesPath = path.join(projectDir, "data", "routes");
|
|
561
|
-
console.log("Saving routes to:", routesPath);
|
|
562
556
|
if (!existsSync(routesPath)) {
|
|
563
557
|
mkdirSync(routesPath, { recursive: true });
|
|
564
558
|
}
|
package/package.json
CHANGED
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
// web-ipcMain.ts
|
|
2
|
-
import { EventEmitter } from "events";
|
|
3
|
-
export class WebIpcMain extends EventEmitter {
|
|
4
|
-
socket;
|
|
5
|
-
handlers = new Map();
|
|
6
|
-
constructor(socket) {
|
|
7
|
-
super();
|
|
8
|
-
this.socket = socket;
|
|
9
|
-
this.setupSocketListeners();
|
|
10
|
-
}
|
|
11
|
-
setupSocketListeners() {
|
|
12
|
-
// Handle invoke calls from renderer (via relay server)
|
|
13
|
-
this.socket.on("invoke", async ({ channel, args, invokeId, clientId }) => {
|
|
14
|
-
const handler = this.handlers.get(channel);
|
|
15
|
-
if (!handler) {
|
|
16
|
-
this.socket.emit("invoke-response", {
|
|
17
|
-
invokeId,
|
|
18
|
-
clientId,
|
|
19
|
-
error: `No handler registered for channel: ${channel}`,
|
|
20
|
-
});
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
|
-
try {
|
|
24
|
-
const event = {
|
|
25
|
-
frameId: 0,
|
|
26
|
-
processId: 0,
|
|
27
|
-
sender: {
|
|
28
|
-
send: (replyChannel, ...replyArgs) => {
|
|
29
|
-
this.socket.emit("message", { channel: replyChannel, args: replyArgs, clientId });
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
senderFrame: null,
|
|
33
|
-
};
|
|
34
|
-
const result = await Promise.resolve(handler(event, ...args));
|
|
35
|
-
this.socket.emit("invoke-response", { invokeId, clientId, result });
|
|
36
|
-
}
|
|
37
|
-
catch (error) {
|
|
38
|
-
this.socket.emit("invoke-response", {
|
|
39
|
-
invokeId,
|
|
40
|
-
clientId,
|
|
41
|
-
error: error.message || "Handler error",
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
// Handle send calls from renderer (fire and forget)
|
|
46
|
-
this.socket.on("send", ({ channel, args, clientId }) => {
|
|
47
|
-
const event = {
|
|
48
|
-
frameId: 0,
|
|
49
|
-
processId: 0,
|
|
50
|
-
sender: {
|
|
51
|
-
send: (replyChannel, ...replyArgs) => {
|
|
52
|
-
this.socket.emit("message", { channel: replyChannel, args: replyArgs, clientId });
|
|
53
|
-
},
|
|
54
|
-
},
|
|
55
|
-
senderFrame: null,
|
|
56
|
-
ports: [],
|
|
57
|
-
reply: (replyChannel, ...replyArgs) => {
|
|
58
|
-
this.socket.emit("message", { channel: replyChannel, args: replyArgs, clientId });
|
|
59
|
-
},
|
|
60
|
-
};
|
|
61
|
-
this.emit(channel, event, ...args);
|
|
62
|
-
});
|
|
63
|
-
// Handle postMessage
|
|
64
|
-
this.socket.on("postMessage", ({ channel, message, clientId }) => {
|
|
65
|
-
const event = {
|
|
66
|
-
frameId: 0,
|
|
67
|
-
processId: 0,
|
|
68
|
-
sender: {
|
|
69
|
-
send: (replyChannel, ...replyArgs) => {
|
|
70
|
-
this.socket.emit("message", { channel: replyChannel, args: replyArgs, clientId });
|
|
71
|
-
},
|
|
72
|
-
},
|
|
73
|
-
senderFrame: null,
|
|
74
|
-
ports: [],
|
|
75
|
-
reply: (replyChannel, ...replyArgs) => {
|
|
76
|
-
this.socket.emit("message", { channel: replyChannel, args: replyArgs, clientId });
|
|
77
|
-
},
|
|
78
|
-
};
|
|
79
|
-
this.emit(channel, event, message);
|
|
80
|
-
});
|
|
81
|
-
// Handle sendToHost
|
|
82
|
-
this.socket.on("sendToHost", ({ channel, args, clientId }) => {
|
|
83
|
-
const event = {
|
|
84
|
-
frameId: 0,
|
|
85
|
-
processId: 0,
|
|
86
|
-
sender: {
|
|
87
|
-
send: (replyChannel, ...replyArgs) => {
|
|
88
|
-
this.socket.emit("message", { channel: replyChannel, args: replyArgs, clientId });
|
|
89
|
-
},
|
|
90
|
-
},
|
|
91
|
-
senderFrame: null,
|
|
92
|
-
ports: [],
|
|
93
|
-
reply: (replyChannel, ...replyArgs) => {
|
|
94
|
-
this.socket.emit("message", { channel: replyChannel, args: replyArgs, clientId });
|
|
95
|
-
},
|
|
96
|
-
};
|
|
97
|
-
this.emit(channel, event, ...args);
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
handle(channel, listener) {
|
|
101
|
-
if (this.handlers.has(channel)) {
|
|
102
|
-
throw new Error(`Handler for channel '${channel}' already exists`);
|
|
103
|
-
}
|
|
104
|
-
this.handlers.set(channel, listener);
|
|
105
|
-
}
|
|
106
|
-
handleOnce(channel, listener) {
|
|
107
|
-
const onceWrapper = async (event, ...args) => {
|
|
108
|
-
this.removeHandler(channel);
|
|
109
|
-
return await Promise.resolve(listener(event, ...args));
|
|
110
|
-
};
|
|
111
|
-
this.handle(channel, onceWrapper);
|
|
112
|
-
}
|
|
113
|
-
removeHandler(channel) {
|
|
114
|
-
this.handlers.delete(channel);
|
|
115
|
-
}
|
|
116
|
-
// Send message to all connected clients (via relay server)
|
|
117
|
-
sendToAll(channel, ...args) {
|
|
118
|
-
this.socket.emit("broadcast", { channel, args });
|
|
119
|
-
}
|
|
120
|
-
// Send message to specific client by client ID (via relay server)
|
|
121
|
-
sendToClient(clientId, channel, ...args) {
|
|
122
|
-
this.socket.emit("message", { channel, args, clientId });
|
|
123
|
-
}
|
|
124
|
-
// Cleanup
|
|
125
|
-
destroy() {
|
|
126
|
-
this.handlers.clear();
|
|
127
|
-
this.removeAllListeners();
|
|
128
|
-
}
|
|
129
|
-
}
|