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.
@@ -93,9 +93,9 @@
93
93
  }
94
94
 
95
95
  .box {
96
- border: 2px solid #B0CF34;
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", "");
@@ -75,7 +75,7 @@ app.whenReady().then(() => {
75
75
  });
76
76
 
77
77
  // open developer tools
78
- // window.webContents.openDevTools();
78
+ window.webContents.openDevTools();
79
79
 
80
80
  ipc.serve(() => {
81
81
  for (const event of eventsArray) {
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
- robot.mouseClick(button, double);
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
@@ -5,6 +5,7 @@ const emitter = new EventEmitter();
5
5
  const events = {
6
6
  showWindow: "show-window",
7
7
  mouseClick: "mouse-click",
8
+ mouseMove: "mouse-move",
8
9
  screenCapture: {
9
10
  start: "screen-capture:start",
10
11
  end: "screen-capture:end",
package/lib/init.js CHANGED
@@ -78,7 +78,7 @@ module.exports = async () => {
78
78
  {
79
79
  type: "confirm",
80
80
  name: "TD_VM",
81
- message: "Use Testdriver Sandbox? (Recommended)",
81
+ message: "Use TestDriver Sandbox Runners? (Recommended)",
82
82
  initial: true,
83
83
  },
84
84
  {
package/lib/overlay.js CHANGED
@@ -29,7 +29,6 @@ try {
29
29
  logger.error("Failed to locate Electron CLI or start process:", error);
30
30
  }
31
31
 
32
-
33
32
  module.exports.electronProcessPromise = new Promise((resolve) => {
34
33
  ipc.connectTo("testdriverai_overlay");
35
34
  ipc.of.testdriverai_overlay.on("connect", () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "testdriverai",
3
- "version": "5.1.2",
3
+ "version": "5.2.1",
4
4
  "description": "Next generation autonomous AI agent for end-to-end testing of web & desktop",
5
5
  "main": "index.js",
6
6
  "bin": {