Skip to content

Commit ef77dd8

Browse files
committed
fixup! Make it mandatory to acknowledge toasts in tests
1 parent c630af0 commit ef77dd8

File tree

4 files changed

+8
-3
lines changed

4 files changed

+8
-3
lines changed

pkg/gui/gui_driver.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ type GuiDriver struct {
2626
var _ integrationTypes.GuiDriver = &GuiDriver{}
2727

2828
func (self *GuiDriver) PressKey(keyStr string) {
29-
self.checkAllToastsAcknowledged()
29+
self.CheckAllToastsAcknowledged()
3030

3131
key := keybindings.GetKey(keyStr)
3232

@@ -49,7 +49,7 @@ func (self *GuiDriver) PressKey(keyStr string) {
4949
}
5050

5151
func (self *GuiDriver) Click(x, y int) {
52-
self.checkAllToastsAcknowledged()
52+
self.CheckAllToastsAcknowledged()
5353

5454
self.gui.g.ReplayedEvents.MouseEvents <- gocui.NewTcellMouseEventWrapper(
5555
tcell.NewEventMouse(x, y, tcell.ButtonPrimary, 0),
@@ -63,7 +63,7 @@ func (self *GuiDriver) waitTillIdle() {
6363
<-self.isIdleChan
6464
}
6565

66-
func (self *GuiDriver) checkAllToastsAcknowledged() {
66+
func (self *GuiDriver) CheckAllToastsAcknowledged() {
6767
if t := self.NextToast(); t != nil {
6868
self.Fail("Toast not acknowledged: " + *t)
6969
}

pkg/integration/components/test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,8 @@ func (self *IntegrationTest) Run(gui integrationTypes.GuiDriver) {
194194

195195
self.run(testDriver, keys)
196196

197+
gui.CheckAllToastsAcknowledged()
198+
197199
if InputDelay() > 0 {
198200
// Clear whatever caption there was so it doesn't linger
199201
testDriver.SetCaption("")

pkg/integration/components/test_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ func (self *fakeGuiDriver) NextToast() *string {
8282
return nil
8383
}
8484

85+
func (self *fakeGuiDriver) CheckAllToastsAcknowledged() {}
86+
8587
func TestManualFailure(t *testing.T) {
8688
test := NewIntegrationTest(NewIntegrationTestArgs{
8789
Description: unitTestDescription,

pkg/integration/types/types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,5 @@ type GuiDriver interface {
4545
SetCaptionPrefix(prefix string)
4646
// Pop the next toast that was displayed; returns nil if there was none
4747
NextToast() *string
48+
CheckAllToastsAcknowledged()
4849
}

0 commit comments

Comments
 (0)