Skip to content

Commit

Permalink
Include demos when running integration tests on CI (#3640)
Browse files Browse the repository at this point in the history
- **PR Description**

This includes the demos when using `make integration-test-all`, and
speeds them up a little bit when run in this way by disabling Wait calls
when running in headless mode.

This will guard against demos breaking when we make behavior changes, as
happened several times in the past (most recently in #3636.
  • Loading branch information
stefanhaller committed Jun 5, 2024
2 parents 187a2f0 + f532944 commit eef70db
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 8 deletions.
5 changes: 5 additions & 0 deletions pkg/gui/gui_driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ type GuiDriver struct {
gui *Gui
isIdleChan chan struct{}
toastChan chan string
headless bool
}

var _ integrationTypes.GuiDriver = &GuiDriver{}
Expand Down Expand Up @@ -161,3 +162,7 @@ func (self *GuiDriver) NextToast() *string {
return nil
}
}

func (self *GuiDriver) Headless() bool {
return self.headless
}
2 changes: 1 addition & 1 deletion pkg/gui/test_mode.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 0 additions & 6 deletions pkg/integration/clients/go_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,6 @@ func TestIntegration(t *testing.T) {
return
}

// not running demoes right now. Arguably we should, but we'd need to
// strip away any artificial lag they use.
if test.IsDemo() {
return
}

t.Run(test.Name(), func(t *testing.T) {
t.Parallel()
err := f()
Expand Down
2 changes: 2 additions & 0 deletions pkg/integration/components/test_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 3 additions & 1 deletion pkg/integration/components/view_driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
1 change: 1 addition & 0 deletions pkg/integration/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

0 comments on commit eef70db

Please sign in to comment.