From 286e5f48492ec00a56ae0e5e46d50ba2deee419b Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Fri, 18 Oct 2024 09:15:08 +0200 Subject: [PATCH] Fix clicking multiple times in an integration test So far we only had tests that called Click() only once. If you have a test that calls Click twice (we'll add one in the next commit), you'll notice that the second click is interpreted as a drag because the mouse button wasn't released in between. Fix this by sending a "mouse-up" event after the click. --- pkg/gui/gui_driver.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/gui/gui_driver.go b/pkg/gui/gui_driver.go index b3dfa1b82..35c201a14 100644 --- a/pkg/gui/gui_driver.go +++ b/pkg/gui/gui_driver.go @@ -57,6 +57,11 @@ func (self *GuiDriver) Click(x, y int) { 0, ) self.waitTillIdle() + self.gui.g.ReplayedEvents.MouseEvents <- gocui.NewTcellMouseEventWrapper( + tcell.NewEventMouse(x, y, tcell.ButtonNone, 0), + 0, + ) + self.waitTillIdle() } // wait until lazygit is idle (i.e. all processing is done) before continuing