@testdriverai/runner 7.8.0-canary.10
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/45-allow-colord.pkla +6 -0
- package/README.md +1 -0
- package/Xauthority +0 -0
- package/focusWindow.ps1 +123 -0
- package/getActiveWindow.ps1 +70 -0
- package/index.js +556 -0
- package/lib/ably-service.js +537 -0
- package/lib/automation-bridge.js +85 -0
- package/lib/automation.js +786 -0
- package/lib/automation.js.bak +882 -0
- package/lib/pyautogui-local.js +229 -0
- package/network.ps1 +18 -0
- package/package.json +43 -0
- package/sandbox-agent.js +266 -0
- package/scripts-desktop/control_window.sh +59 -0
- package/scripts-desktop/launch_chrome.sh +3 -0
- package/scripts-desktop/launch_chrome_for_testing.sh +9 -0
- package/scripts-desktop/start-desktop.sh +161 -0
- package/wallpaper.png +0 -0
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
[Allow Colord all Users]
|
|
2
|
+
Identity=unix-user:*
|
|
3
|
+
Action=org.freedesktop.color-manager.create-device;org.freedesktop.color-manager.create-profile;org.freedesktop.color-manager.delete-device;org.freedesktop.color-manager.delete-profile;org.freedesktop.color-manager.modify-device;org.freedesktop.color-manager.modify-profile
|
|
4
|
+
ResultAny=no
|
|
5
|
+
ResultInactive=no
|
|
6
|
+
ResultActive=yes
|
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# runner
|
package/Xauthority
ADDED
|
File without changes
|
package/focusWindow.ps1
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# Check and print each argument
|
|
2
|
+
Write-Host "Number of arguments: $($args.Length)"
|
|
3
|
+
for ($i = 0; $i -lt $args.Length; $i++) {
|
|
4
|
+
Write-Host "Arg[$i]: $($args[$i])"
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
# Existing logic
|
|
8
|
+
if ($args.Length -lt 2) {
|
|
9
|
+
Write-Host "Error: Not enough arguments supplied."
|
|
10
|
+
Write-Host "Usage: .\ControlWindow.ps1 <WindowTitle> <Action>"
|
|
11
|
+
Write-Host "Actions: Minimize, Restore, Focus"
|
|
12
|
+
exit 1
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
# Check if arguments are passed correctly
|
|
16
|
+
$windowTitle = $args[0]
|
|
17
|
+
$action = $args[1]
|
|
18
|
+
|
|
19
|
+
# Debug output for arguments
|
|
20
|
+
Write-Host "=== Debugging Arguments ==="
|
|
21
|
+
Write-Host "WindowTitle: '$windowTitle'"
|
|
22
|
+
Write-Host "Action: '$action'"
|
|
23
|
+
Write-Host "==========================="
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
if (-not ("User32" -as [type])) {
|
|
27
|
+
Add-Type @"
|
|
28
|
+
using System;
|
|
29
|
+
using System.Runtime.InteropServices;
|
|
30
|
+
public class User32 {
|
|
31
|
+
[DllImport("user32.dll")]
|
|
32
|
+
public static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);
|
|
33
|
+
[DllImport("user32.dll")]
|
|
34
|
+
public static extern bool SetForegroundWindow(IntPtr hWnd);
|
|
35
|
+
[DllImport("user32.dll")]
|
|
36
|
+
public static extern bool IsIconic(IntPtr hWnd);
|
|
37
|
+
[DllImport("user32.dll")]
|
|
38
|
+
public static extern bool IsZoomed(IntPtr hWnd);
|
|
39
|
+
}
|
|
40
|
+
"@
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function Control-Window {
|
|
44
|
+
param(
|
|
45
|
+
[Parameter(Mandatory=$true)]
|
|
46
|
+
[string]$WindowTitle,
|
|
47
|
+
|
|
48
|
+
[Parameter(Mandatory=$true)]
|
|
49
|
+
[ValidateSet("Minimize", "Restore", "Focus")]
|
|
50
|
+
[string]$Action
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
# Debug output to confirm script execution
|
|
54
|
+
Write-Host "Searching for windows with title containing: '$WindowTitle'"
|
|
55
|
+
|
|
56
|
+
$processes = Get-Process | Where-Object {
|
|
57
|
+
$_.MainWindowTitle -and $_.MainWindowTitle -like "*$WindowTitle*"
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (-not $processes) {
|
|
61
|
+
Write-Host "No window found with the title containing '$WindowTitle'"
|
|
62
|
+
return
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
foreach ($proc in $processes) {
|
|
66
|
+
$hwnd = $proc.MainWindowHandle
|
|
67
|
+
|
|
68
|
+
# Debug output to show found window
|
|
69
|
+
Write-Host "Found window: '$($proc.MainWindowTitle)'"
|
|
70
|
+
|
|
71
|
+
switch ($Action) {
|
|
72
|
+
"Minimize" {
|
|
73
|
+
# Minimize the window
|
|
74
|
+
[User32]::ShowWindowAsync($hwnd, 6) | Out-Null # 6 is SW_MINIMIZE
|
|
75
|
+
Write-Host "Minimized '$($proc.MainWindowTitle)'"
|
|
76
|
+
}
|
|
77
|
+
"Restore" {
|
|
78
|
+
# Restore the window if minimized
|
|
79
|
+
if ([User32]::IsIconic($hwnd)) {
|
|
80
|
+
[User32]::ShowWindowAsync($hwnd, 9) | Out-Null # 9 is SW_RESTORE
|
|
81
|
+
}
|
|
82
|
+
# Bring the window to the foreground
|
|
83
|
+
[User32]::SetForegroundWindow($hwnd) | Out-Null
|
|
84
|
+
Write-Host "Restored and brought '$($proc.MainWindowTitle)' to the foreground."
|
|
85
|
+
}
|
|
86
|
+
"Focus" {
|
|
87
|
+
# Check if the window is minimized
|
|
88
|
+
if ([User32]::IsIconic($hwnd)) {
|
|
89
|
+
# If minimized, restore the window
|
|
90
|
+
[User32]::ShowWindowAsync($hwnd, 9) | Out-Null # 9 is SW_RESTORE
|
|
91
|
+
}
|
|
92
|
+
# Bring the window to the foreground
|
|
93
|
+
[User32]::SetForegroundWindow($hwnd) | Out-Null
|
|
94
|
+
Write-Host "Brought '$($proc.MainWindowTitle)' to the foreground."
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
# Script entry point
|
|
101
|
+
if ($args.Length -eq 2) {
|
|
102
|
+
$windowTitle = $args[0]
|
|
103
|
+
$action = $args[1]
|
|
104
|
+
|
|
105
|
+
# Debug output for arguments
|
|
106
|
+
Write-Host "=== Debugging Arguments ==="
|
|
107
|
+
Write-Host "Raw Args: $($args)"
|
|
108
|
+
Write-Host "WindowTitle: '$windowTitle'"
|
|
109
|
+
Write-Host "Action: '$action'"
|
|
110
|
+
Write-Host "==========================="
|
|
111
|
+
|
|
112
|
+
# Validate action parameter
|
|
113
|
+
if ($action -notin @("Minimize", "Restore", "Focus")) {
|
|
114
|
+
Write-Host "Invalid action. Valid actions are: Minimize, Restore, Focus."
|
|
115
|
+
exit 1
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
# Call the Control-Window function with command-line arguments
|
|
119
|
+
Control-Window -WindowTitle $windowTitle -Action $action
|
|
120
|
+
} else {
|
|
121
|
+
Write-Host "Usage: .\ControlWindow.ps1 <WindowTitle> <Action>"
|
|
122
|
+
Write-Host "Actions: Minimize, Restore, Focus"
|
|
123
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
Add-Type @"
|
|
2
|
+
using System;
|
|
3
|
+
using System.Runtime.InteropServices;
|
|
4
|
+
using System.Text;
|
|
5
|
+
public class User32 {
|
|
6
|
+
[DllImport("user32.dll")]
|
|
7
|
+
public static extern IntPtr GetForegroundWindow();
|
|
8
|
+
[DllImport("user32.dll")]
|
|
9
|
+
public static extern int GetWindowText(IntPtr hWnd, StringBuilder text, int count);
|
|
10
|
+
[DllImport("user32.dll")]
|
|
11
|
+
public static extern bool GetWindowRect(IntPtr hWnd, out RECT lpRect);
|
|
12
|
+
[DllImport("user32.dll")]
|
|
13
|
+
public static extern bool GetClientRect(IntPtr hWnd, out RECT lpRect);
|
|
14
|
+
[DllImport("user32.dll")]
|
|
15
|
+
public static extern uint GetWindowThreadProcessId(IntPtr hWnd, out uint processId);
|
|
16
|
+
}
|
|
17
|
+
public struct RECT {
|
|
18
|
+
public int Left;
|
|
19
|
+
public int Top;
|
|
20
|
+
public int Right;
|
|
21
|
+
public int Bottom;
|
|
22
|
+
}
|
|
23
|
+
"@
|
|
24
|
+
|
|
25
|
+
# Get the currently focused window
|
|
26
|
+
$hwnd = [User32]::GetForegroundWindow()
|
|
27
|
+
|
|
28
|
+
# Get window title
|
|
29
|
+
$title = New-Object System.Text.StringBuilder 256
|
|
30
|
+
[User32]::GetWindowText($hwnd, $title, $title.Capacity) | Out-Null
|
|
31
|
+
|
|
32
|
+
# Get window bounds
|
|
33
|
+
$windowRect = New-Object RECT
|
|
34
|
+
[User32]::GetWindowRect($hwnd, [ref]$windowRect) | Out-Null
|
|
35
|
+
|
|
36
|
+
# Get client bounds
|
|
37
|
+
$clientRect = New-Object RECT
|
|
38
|
+
[User32]::GetClientRect($hwnd, [ref]$clientRect) | Out-Null
|
|
39
|
+
|
|
40
|
+
# Get process information
|
|
41
|
+
$processId = 0
|
|
42
|
+
[User32]::GetWindowThreadProcessId($hwnd, [ref]$processId) | Out-Null
|
|
43
|
+
$process = Get-Process -Id $processId -ErrorAction SilentlyContinue
|
|
44
|
+
|
|
45
|
+
# Create result object matching example.json format
|
|
46
|
+
$result = @{
|
|
47
|
+
platform = 'windows'
|
|
48
|
+
id = $hwnd.ToInt64()
|
|
49
|
+
title = $title.ToString()
|
|
50
|
+
owner = @{
|
|
51
|
+
processId = $processId
|
|
52
|
+
path = if($process) { $process.Path } else { "Unknown" }
|
|
53
|
+
name = if($process) { "$($process.ProcessName).exe" } else { "Unknown" }
|
|
54
|
+
}
|
|
55
|
+
bounds = @{
|
|
56
|
+
x = $windowRect.Left
|
|
57
|
+
y = $windowRect.Top
|
|
58
|
+
width = $windowRect.Right - $windowRect.Left
|
|
59
|
+
height = $windowRect.Bottom - $windowRect.Top
|
|
60
|
+
}
|
|
61
|
+
contentBounds = @{
|
|
62
|
+
x = $clientRect.Left
|
|
63
|
+
y = $clientRect.Top
|
|
64
|
+
width = $clientRect.Right - $clientRect.Left
|
|
65
|
+
height = $clientRect.Bottom - $clientRect.Top
|
|
66
|
+
}
|
|
67
|
+
memoryUsage = if($process) { $process.WorkingSet64 } else { 0 }
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
Write-Output ($result | ConvertTo-Json -Depth 3)
|