Sorry to take a bit to reply. Still no luck. But a few things have occurred to me that may have some bearing on the issue.
1.) Zed has builtin GH Copilot prediction on keystrokes. I believe I've disabled it now and I'll see if that helps. I don't care about the copilot stuff for regression testing; I mean I'm just testing basic behaviors to ensure they work as expected.
2.) Sven you mentioned SendKeyDownDelay but in your sample code you have this:
So I actually set both of them to 250.
And I believe I'm now getting the keystrokes as I want them. The last test isn't passing but I did see the Theme Selector pop up so it's likely that it's my problem in picking the wrong pass/fail criteria.
FWIW, here's the code I currently have (for reference):
#cs------------------------------------
Zed Automated Regression Testing Suite
Onorio Catenacci
21 March 2025
v 0.0.4
#ce------------------------------------
#AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7
#AutoIt3Wrapper_AU3Check_Stop_OnWarning=y
#include-once
Opt("MustDeclareVars",true)
Opt("SendKeyDelay",250)
Opt("SendKeyDownDelay",250)
#include <AutoItConstants.au3>
#include <MsgBoxConstants.au3>
Const $zedWindowClass = "[CLASS:Zed::Window]"
Func OutputResult($testName, $testResult)
Local $resultString = "Test " & $testName
$resultString &= " "
$resultString &= $testResult ? "Passed" : "Failed"
return $resultString
EndFunc
Func StartZed()
Run("pwsh c:\users\public\zed.ps1")
Local $HWnd = WinWaitActive($zedWindowClass)
return $HWnd
EndFunc
Func CloseZed($keystrokesToClose = Default)
if $keystrokesToClose = Default Then
;~ Standard Windows Close Key Combo
Send("!{F4}")
else
Send($keystrokesToClose)
endif
EndFunc
Func TestZedStartupAndShutdown_CtrlQ()
StartZed()
Sleep(1000)
CloseZed("^q")
Sleep(1000)
# Test
Local $actual = WinExists($zedWindowClass)
Local $expected = 0
return ($actual = $expected)
EndFunc
Func TestZedStartupAndShutdown_StandardWindows()
StartZed()
Sleep(1000)
CloseZed()
Sleep(1000)
# Test
Local $actual = WinExists($zedWindowClass)
Local $expected = 0
return ($actual = $expected)
EndFunc
Func TestOpenSettingsTab()
StartZed()
Sleep(1000)
Send("^,")
Sleep(100)
Local $winTitle = WinGetTitle("[ACTIVE]")
Local $positionOfSettingsInTitle = StringInStr($winTitle,"settings")
Local $actual = $positionOfSettingsInTitle > 0
Local $expected = True
CloseZed()
return ($actual = $expected)
EndFunc
Func TestKeyboardMappings()
StartZed()
Sleep(1000)
Send("{CTRLDOWN}")
Send("k")
Send("s")
Send("{CTRLUP}")
Sleep(1000)
Local $winTitle = WinGetTitle("[ACTIVE]")
Local $positionOfKeymapInTitle = StringInStr($winTitle,"keymap")
Local $actual = $positionOfKeymapInTitle > 0
Local $expected = True
CloseZed()
return ($actual = $expected)
EndFunc
Func TestSelectTheme()
StartZed()
Sleep(1000)
Send("{CTRLDOWN}")
Send("k")
Send("t")
Send("{CTRLUP}")
Sleep(1000)
Local $winTitle = WinGetTitle("[ACTIVE]")
Local $positionOfSelectThemeInTitle = StringInStr($winTitle,"Theme")
Local $actual = $positionOfSelectThemeInTitle > 0
Local $expected = True
CloseZed()
return ($actual = $expected)
EndFunc
Func TestMouseBehavior()
StartZed()
Sleep(1000)
Local $currentMouseCoordMode = Opt("MouseCoordMode")
Opt("MouseCoordMode",0)
MouseMove(16,14)
MouseClick($MOUSE_CLICK_PRIMARY)
Opt("MouseCoordMode",$currentMouseCoordMode)
EndFunc
Func RunAllTests()
Local $testsToRun[] = ["TestZedStartupAndShutdown_CtrlQ", "TestZedStartupAndShutdown_StandardWindows", "TestOpenSettingsTab", "TestKeyboardMappings", "TestSelectTheme"]
Local $resultOfTest[UBound($testsToRun)]
For $i = 0 to UBound($testsToRun)-1
$resultOfTest[$i] = Call($testsToRun[$i])
Next
For $i = 0 to UBound($testsToRun)-1
MsgBox($MB_ICONINFORMATION, "Zed Tests", OutputResult($testsToRun[$i],$resultOfTest[$i]))
Next
EndFunc
; TestMouseBehavior()
RunAllTests()
Since you both gave me excellent suggestions I incorporated all of them into my script. For now I think it was Sven's suggestion that solved this so I'll mark his answer as the solution. But I also think disabling copilot helped some and as I said I'll still want to do more testing.
Regardless thanks for educating an AutoIt newbie a bit!