mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-11 12:25:47 +02:00
Don't wait in integration tests when running in headless mode
There's no point in spending time waiting in this case, as nobody can see it.
This commit is contained in:
parent
187a2f0cc2
commit
4f6d3fb592
5 changed files with 12 additions and 2 deletions
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue