diff --git a/pkg/integration/tests/filter_and_search/filter_worktrees.go b/pkg/integration/tests/filter_and_search/filter_worktrees.go new file mode 100644 index 000000000..84e367573 --- /dev/null +++ b/pkg/integration/tests/filter_and_search/filter_worktrees.go @@ -0,0 +1,34 @@ +package filter_and_search + +import ( + "github.com/jesseduffield/lazygit/pkg/config" + . "github.com/jesseduffield/lazygit/pkg/integration/components" +) + +var FilterWorktrees = NewIntegrationTest(NewIntegrationTestArgs{ + Description: "Filtering worktrees by branch name", + ExtraCmdArgs: []string{}, + Skip: false, + SetupConfig: func(config *config.AppConfig) {}, + SetupRepo: func(shell *Shell) { + shell.EmptyCommit("initial commit") + shell.NewBranch("branch-aaa") + shell.NewBranch("branch-xxx") + shell.Checkout("master") + shell.AddWorktreeCheckout("branch-aaa", "../worktree-xxx") + shell.AddWorktreeCheckout("branch-xxx", "../worktree-1") + }, + Run: func(t *TestDriver, keys config.KeybindingConfig) { + t.Views().Worktrees(). + Focus(). + Lines( + Contains("(main worktree)").IsSelected(), + Contains("worktree-1 branch-xxx"), + Contains("worktree-xxx branch-aaa"), + ). + FilterOrSearch("xxx"). + Lines( + Contains("worktree-xxx branch-aaa"), + ) + }, +}) diff --git a/pkg/integration/tests/test_list.go b/pkg/integration/tests/test_list.go index 0124de268..bf4cfd5df 100644 --- a/pkg/integration/tests/test_list.go +++ b/pkg/integration/tests/test_list.go @@ -270,6 +270,7 @@ var tests = []*components.IntegrationTest{ filter_and_search.FilterRemotes, filter_and_search.FilterSearchHistory, filter_and_search.FilterUpdatesWhenModelChanges, + filter_and_search.FilterWorktrees, filter_and_search.NestedFilter, filter_and_search.NestedFilterTransient, filter_and_search.NewSearch,