diff options
-rw-r--r-- | pkg/gui/gui_driver.go | 5 | ||||
-rw-r--r-- | pkg/gui/test_mode.go | 2 | ||||
-rw-r--r-- | pkg/integration/components/test_test.go | 2 | ||||
-rw-r--r-- | pkg/integration/components/view_driver.go | 4 | ||||
-rw-r--r-- | pkg/integration/types/types.go | 1 |
5 files changed, 12 insertions, 2 deletions
diff --git a/pkg/gui/gui_driver.go b/pkg/gui/gui_driver.go index 3421602e9..5de0ad4ee 100644 --- a/pkg/gui/gui_driver.go +++ b/pkg/gui/gui_driver.go @@ -21,6 +21,7 @@ type GuiDriver struct { gui *Gui isIdleChan chan struct{} toastChan chan string + headless bool } var _ integrationTypes.GuiDriver = &GuiDriver{} @@ -161,3 +162,7 @@ func (self *GuiDriver) NextToast() *string { return nil } } + +func (self *GuiDriver) Headless() bool { + return self.headless +} diff --git a/pkg/gui/test_mode.go b/pkg/gui/test_mode.go index 65009fb78..c5014ad72 100644 --- a/pkg/gui/test_mode.go +++ b/pkg/gui/test_mode.go @@ -38,7 +38,7 @@ func (gui *Gui) handleTestMode() { gui.PopupHandler.(*popup.PopupHandler).SetToastFunc( func(message string, kind types.ToastKind) { toastChan <- message }) - test.Run(&GuiDriver{gui: gui, isIdleChan: isIdleChan, toastChan: toastChan}) + test.Run(&GuiDriver{gui: gui, isIdleChan: isIdleChan, toastChan: toastChan, headless: Headless()}) gui.g.Update(func(*gocui.Gui) error { return gocui.ErrQuit diff --git a/pkg/integration/components/test_test.go b/pkg/integration/components/test_test.go index 047ee507c..ea1c79124 100644 --- a/pkg/integration/components/test_test.go +++ b/pkg/integration/components/test_test.go @@ -84,6 +84,8 @@ func (self *fakeGuiDriver) NextToast() *string { func (self *fakeGuiDriver) CheckAllToastsAcknowledged() {} +func (self *fakeGuiDriver) Headless() bool { return false } + func TestManualFailure(t *testing.T) { test := NewIntegrationTest(NewIntegrationTestArgs{ Description: unitTestDescription, diff --git a/pkg/integration/components/view_driver.go b/pkg/integration/components/view_driver.go index 8d9b336d6..4d8e75217 100644 --- a/pkg/integration/components/view_driver.go +++ b/pkg/integration/components/view_driver.go @@ -601,7 +601,9 @@ func (self *ViewDriver) SetCaptionPrefix(prefix string) *ViewDriver { } func (self *ViewDriver) Wait(milliseconds int) *ViewDriver { - self.t.Wait(milliseconds) + if !self.t.gui.Headless() { + self.t.Wait(milliseconds) + } return self } diff --git a/pkg/integration/types/types.go b/pkg/integration/types/types.go index a30aeb055..9c4f057d2 100644 --- a/pkg/integration/types/types.go +++ b/pkg/integration/types/types.go @@ -46,4 +46,5 @@ type GuiDriver interface { // Pop the next toast that was displayed; returns nil if there was none NextToast() *string CheckAllToastsAcknowledged() + Headless() bool } |