testdriverai 5.1.2 → 5.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/electron/overlay.html +38 -2
- package/electron/overlay.js +1 -1
- package/lib/commands.js +16 -1
- package/lib/events.js +1 -0
- package/lib/init.js +1 -1
- package/lib/overlay.js +0 -1
- package/package.json +1 -1
package/electron/overlay.html
CHANGED
|
@@ -93,9 +93,9 @@
|
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
.box {
|
|
96
|
-
border:
|
|
96
|
+
border: 1px solid #B0CF34;
|
|
97
97
|
position: absolute;
|
|
98
|
-
|
|
98
|
+
border-radius: 5px;
|
|
99
99
|
animation-duration: 5s;
|
|
100
100
|
animation-delay: 0s;
|
|
101
101
|
animation-timing-function: cubic-bezier(0.26, 0.53, 0.74, 1.48);
|
|
@@ -111,6 +111,29 @@
|
|
|
111
111
|
position: absolute;
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
+
#mouse {
|
|
115
|
+
margin-left: -100px;
|
|
116
|
+
margin-top: -100px;
|
|
117
|
+
width: 50px;
|
|
118
|
+
height: 50px;
|
|
119
|
+
opacity: 50%;
|
|
120
|
+
position: absolute;
|
|
121
|
+
transform: translate(-50%, -50%);
|
|
122
|
+
border-radius: 70%;
|
|
123
|
+
background: #FFD700;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
#mouse #dot {
|
|
127
|
+
width: 7px;
|
|
128
|
+
height: 7px;
|
|
129
|
+
position: absolute;
|
|
130
|
+
top: 50%;
|
|
131
|
+
left: 50%;
|
|
132
|
+
transform: translate(-50%, -50%);
|
|
133
|
+
border-radius: 50%;
|
|
134
|
+
background-color: black;
|
|
135
|
+
}
|
|
136
|
+
|
|
114
137
|
#pointer {
|
|
115
138
|
width: 25px;
|
|
116
139
|
height: 25px;
|
|
@@ -213,6 +236,7 @@
|
|
|
213
236
|
<div id="main" class="container">
|
|
214
237
|
<div id="boxes">
|
|
215
238
|
<div id="pointer"></div>
|
|
239
|
+
<div id="mouse"><div id="dot"></div></div>
|
|
216
240
|
</div>
|
|
217
241
|
<div id="terminal-wrapper">
|
|
218
242
|
<img src="td.png" alt="td" style="position: absolute; top: 20; right: 20; height: 40px; z-index: 9999; background-color: black;">
|
|
@@ -226,6 +250,7 @@
|
|
|
226
250
|
const { ipcRenderer } = require("electron");
|
|
227
251
|
const { events } = require("../lib/events.js");
|
|
228
252
|
|
|
253
|
+
const mouse = document.querySelector("#mouse");
|
|
229
254
|
const pointer = document.querySelector("#pointer");
|
|
230
255
|
const container = document.querySelector("#main");
|
|
231
256
|
const screenshotElement = document.querySelector("#screenshot");
|
|
@@ -277,9 +302,20 @@
|
|
|
277
302
|
container.style.opacity = 1
|
|
278
303
|
}, 2000)
|
|
279
304
|
});
|
|
305
|
+
ipcRenderer.on(events.mouseMove,
|
|
306
|
+
(event, { x, y } = {}) => {
|
|
307
|
+
|
|
308
|
+
console.log("mouseMove", x, y)
|
|
309
|
+
|
|
310
|
+
mouse.style.marginLeft = toCss(x);
|
|
311
|
+
mouse.style.marginTop = toCss(y);
|
|
312
|
+
|
|
313
|
+
},
|
|
314
|
+
);
|
|
280
315
|
|
|
281
316
|
ipcRenderer.on(events.mouseClick,
|
|
282
317
|
(event, { x, y, click = "single" } = {}) => {
|
|
318
|
+
|
|
283
319
|
pointer.style.marginLeft = toCss(x);
|
|
284
320
|
pointer.style.marginTop = toCss(y);
|
|
285
321
|
pointer.setAttribute("class", "");
|
package/electron/overlay.js
CHANGED
package/lib/commands.js
CHANGED
|
@@ -235,6 +235,8 @@ const click = async (x, y, action = "click") => {
|
|
|
235
235
|
y = parseInt(y);
|
|
236
236
|
|
|
237
237
|
config.TD_VM ? await sandbox.send({type: "moveMouse", x, y }) : await robot.moveMouseSmooth(x, y, 0.1);
|
|
238
|
+
emitter.emit(events.mouseMove, { x, y });
|
|
239
|
+
|
|
238
240
|
await delay(1000); // wait for the mouse to move
|
|
239
241
|
|
|
240
242
|
if (!config.TD_VM && process.platform === "darwin" && action === "right-click") {
|
|
@@ -252,10 +254,23 @@ const click = async (x, y, action = "click") => {
|
|
|
252
254
|
await sandbox.send({type: "middleClick" })
|
|
253
255
|
} else if (action === "double-click") {
|
|
254
256
|
await sandbox.send({type: "doubleClick" })
|
|
257
|
+
}else if (action === "drag-start") {
|
|
258
|
+
await sandbox.send({type: "mousePress", button: "left" })
|
|
259
|
+
}else if (action === "drag-end") {
|
|
260
|
+
await sandbox.send({type: "mouseRelease", button: "left" })
|
|
255
261
|
}
|
|
256
262
|
} else {
|
|
257
|
-
|
|
263
|
+
|
|
264
|
+
if (action === "drag-start") {
|
|
265
|
+
robot.mouseToggle("down", button);
|
|
266
|
+
} else if( action === "drag-end") {
|
|
267
|
+
robot.mouseToggle("up", button);
|
|
268
|
+
} else {
|
|
269
|
+
robot.mouseClick(button, double);
|
|
270
|
+
}
|
|
271
|
+
|
|
258
272
|
}
|
|
273
|
+
|
|
259
274
|
emitter.emit(events.mouseClick, { x, y, button, click });
|
|
260
275
|
}
|
|
261
276
|
|
package/lib/events.js
CHANGED
package/lib/init.js
CHANGED
package/lib/overlay.js
CHANGED