diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2023-07-20 21:08:56 +1000 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2023-07-20 21:08:56 +1000 |
commit | 932e01b41ac3203b43ec786b8d9c25334e3e1623 (patch) | |
tree | ea880bf1e8785e4145b8925a8003d3322c21a631 /pkg/integration | |
parent | 373f24c80f2a99f7b4e1efd3a4c1f5fdb375e3bf (diff) |
Add test for crashing on empty menu
Diffstat (limited to 'pkg/integration')
-rw-r--r-- | pkg/integration/tests/test_list.go | 1 | ||||
-rw-r--r-- | pkg/integration/tests/ui/empty_menu.go | 31 |
2 files changed, 32 insertions, 0 deletions
diff --git a/pkg/integration/tests/test_list.go b/pkg/integration/tests/test_list.go index caaf2039e..5eab827b7 100644 --- a/pkg/integration/tests/test_list.go +++ b/pkg/integration/tests/test_list.go @@ -211,6 +211,7 @@ var tests = []*components.IntegrationTest{ tag.Reset, ui.Accordion, ui.DoublePopup, + ui.EmptyMenu, ui.SwitchTabFromMenu, undo.UndoCheckoutAndDrop, undo.UndoDrop, diff --git a/pkg/integration/tests/ui/empty_menu.go b/pkg/integration/tests/ui/empty_menu.go new file mode 100644 index 000000000..d6b3b42f0 --- /dev/null +++ b/pkg/integration/tests/ui/empty_menu.go @@ -0,0 +1,31 @@ +package ui + +import ( + "github.com/jesseduffield/lazygit/pkg/config" + . "github.com/jesseduffield/lazygit/pkg/integration/components" +) + +var EmptyMenu = NewIntegrationTest(NewIntegrationTestArgs{ + Description: "Verify that we don't crash on an empty menu", + ExtraCmdArgs: []string{}, + Skip: false, + SetupConfig: func(config *config.AppConfig) {}, + SetupRepo: func(shell *Shell) { + }, + Run: func(t *TestDriver, keys config.KeybindingConfig) { + t.Views().Files(). + IsFocused(). + Press(keys.Universal.OptionMenu) + + t.Views().Menu(). + IsFocused(). + // a string that filters everything out + FilterOrSearch("ljasldkjaslkdjalskdjalsdjaslkd"). + IsEmpty(). + Press(keys.Universal.Select) + + // back in the files view, selecting the non-existing menu item was a no-op + t.Views().Files(). + IsFocused() + }, +}) |