1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-31 14:24:25 +03:00

Add a Click() primitive to the integration test library

This commit is contained in:
Simon Whitaker
2023-08-06 14:55:14 +01:00
parent 579791e7bc
commit ed1547e0cb
16 changed files with 103 additions and 41 deletions

View File

@ -190,9 +190,9 @@ func (self *IntegrationTest) Run(gui integrationTypes.GuiDriver) {
shell := NewShell(pwd, func(errorMsg string) { gui.Fail(errorMsg) })
keys := gui.Keys()
testDriver := NewTestDriver(gui, shell, keys, KeyPressDelay())
testDriver := NewTestDriver(gui, shell, keys, InputDelay())
if KeyPressDelay() > 0 {
if InputDelay() > 0 {
// Setting caption to clear the options menu from whatever it starts with
testDriver.SetCaption("")
testDriver.SetCaptionPrefix("")
@ -200,7 +200,7 @@ func (self *IntegrationTest) Run(gui integrationTypes.GuiDriver) {
self.run(testDriver, keys)
if KeyPressDelay() > 0 {
if InputDelay() > 0 {
// Clear whatever caption there was so it doesn't linger
testDriver.SetCaption("")
testDriver.SetCaptionPrefix("")
@ -232,10 +232,10 @@ func TestNameFromFilePath(path string) string {
return name[:len(name)-len(".go")]
}
// this is the delay in milliseconds between keypresses
// this is the delay in milliseconds between keypresses or mouse clicks
// defaults to zero
func KeyPressDelay() int {
delayStr := os.Getenv("KEY_PRESS_DELAY")
func InputDelay() int {
delayStr := os.Getenv("INPUT_DELAY")
if delayStr == "" {
return 0
}