diff options
author | Stefan Haller <stefan@haller-berlin.de> | 2023-08-30 10:54:32 +0200 |
---|---|---|
committer | Stefan Haller <stefan@haller-berlin.de> | 2023-08-30 10:54:32 +0200 |
commit | 81216189e41287426ef374ceff26fcf65d363730 (patch) | |
tree | 96b2c045f2b56cd7a570e98e893227baeabc707c /pkg/gui | |
parent | 2b26b380b6ac40d3acfbf0446237990c11e5e0d2 (diff) |
Don't show toasts when running integration tests
It's pointless because you can't check for them in tests anyway, so they
unnecessarily slow down the test run by two seconds for no reason.
Diffstat (limited to 'pkg/gui')
-rw-r--r-- | pkg/gui/controllers/helpers/app_status_helper.go | 7 | ||||
-rw-r--r-- | pkg/gui/gui_common.go | 4 | ||||
-rw-r--r-- | pkg/gui/types/common.go | 3 |
3 files changed, 14 insertions, 0 deletions
diff --git a/pkg/gui/controllers/helpers/app_status_helper.go b/pkg/gui/controllers/helpers/app_status_helper.go index e3b6931ad..a6befe1a2 100644 --- a/pkg/gui/controllers/helpers/app_status_helper.go +++ b/pkg/gui/controllers/helpers/app_status_helper.go @@ -21,6 +21,13 @@ func NewAppStatusHelper(c *HelperCommon, statusMgr func() *status.StatusManager) } func (self *AppStatusHelper) Toast(message string) { + if self.c.RunningIntegrationTest() { + // Don't bother showing toasts in integration tests. You can't check for + // them anyway, and they would only slow down the test unnecessarily by + // two seconds. + return + } + self.statusMgr().AddToastStatus(message) self.renderAppStatus() diff --git a/pkg/gui/gui_common.go b/pkg/gui/gui_common.go index 72662f1c1..e3e288c11 100644 --- a/pkg/gui/gui_common.go +++ b/pkg/gui/gui_common.go @@ -182,6 +182,10 @@ func (self *guiCommon) AfterLayout(f func() error) { } } +func (self *guiCommon) RunningIntegrationTest() bool { + return self.gui.integrationTest != nil +} + func (self *guiCommon) InDemo() bool { return self.gui.integrationTest != nil && self.gui.integrationTest.IsDemo() } diff --git a/pkg/gui/types/common.go b/pkg/gui/types/common.go index 0b6a8e430..df927e1b2 100644 --- a/pkg/gui/types/common.go +++ b/pkg/gui/types/common.go @@ -107,6 +107,9 @@ type IGuiCommon interface { // hopefully we can remove this once we've moved all our keybinding stuff out of the gui god struct. GetInitialKeybindingsWithCustomCommands() ([]*Binding, []*gocui.ViewMouseBinding) + // Returns true if we're running an integration test + RunningIntegrationTest() bool + // Returns true if we're in a demo recording/playback InDemo() bool } |