diff options
author | Stefan Haller <stefan@haller-berlin.de> | 2024-01-13 16:17:41 +0100 |
---|---|---|
committer | Stefan Haller <stefan@haller-berlin.de> | 2024-01-14 17:42:03 +0100 |
commit | 8ca8a4396859559d818c2b5a51411da7d618ee70 (patch) | |
tree | 64f8b7b510946661d13224d08e00d08001d67b7d /pkg/gui/gui_driver.go | |
parent | 9fa43394fed0aaa1114798decb814ebddc9eddc8 (diff) |
Make it mandatory to acknowledge toasts in tests
Diffstat (limited to 'pkg/gui/gui_driver.go')
-rw-r--r-- | pkg/gui/gui_driver.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/pkg/gui/gui_driver.go b/pkg/gui/gui_driver.go index ddeb3fab4..e7fa097d3 100644 --- a/pkg/gui/gui_driver.go +++ b/pkg/gui/gui_driver.go @@ -26,6 +26,8 @@ type GuiDriver struct { var _ integrationTypes.GuiDriver = &GuiDriver{} func (self *GuiDriver) PressKey(keyStr string) { + self.CheckAllToastsAcknowledged() + key := keybindings.GetKey(keyStr) var r rune @@ -47,6 +49,8 @@ func (self *GuiDriver) PressKey(keyStr string) { } func (self *GuiDriver) Click(x, y int) { + self.CheckAllToastsAcknowledged() + self.gui.g.ReplayedEvents.MouseEvents <- gocui.NewTcellMouseEventWrapper( tcell.NewEventMouse(x, y, tcell.ButtonPrimary, 0), 0, @@ -59,6 +63,12 @@ func (self *GuiDriver) waitTillIdle() { <-self.isIdleChan } +func (self *GuiDriver) CheckAllToastsAcknowledged() { + if t := self.NextToast(); t != nil { + self.Fail("Toast not acknowledged: " + *t) + } +} + func (self *GuiDriver) Keys() config.KeybindingConfig { return self.gui.Config.GetUserConfig().Keybinding } |