diff --git a/pkg/integration/tests/main_view/search_over_a_commit_log_keeps_the_current_match_on_refresh.go b/pkg/integration/tests/main_view/search_over_a_commit_log_keeps_the_current_match_on_refresh.go new file mode 100644 index 000000000..b15c8e2eb --- /dev/null +++ b/pkg/integration/tests/main_view/search_over_a_commit_log_keeps_the_current_match_on_refresh.go @@ -0,0 +1,37 @@ +package main_view + +import ( + "github.com/jesseduffield/lazygit/pkg/config" + . "github.com/jesseduffield/lazygit/pkg/integration/components" +) + +var SearchOverACommitLogKeepsTheCurrentMatchOnRefresh = NewIntegrationTest(NewIntegrationTestArgs{ + Description: "Searching a branch's commit log in the main view, which shows no selection, keeps the current match when a refresh renders the log again", + ExtraCmdArgs: []string{}, + Skip: false, + SetupConfig: func(config *config.AppConfig) {}, + SetupRepo: func(shell *Shell) { + shell.CreateNCommits(3) + }, + Run: func(t *TestDriver, keys config.KeybindingConfig) { + t.Views().Branches(). + Focus(). + Press(keys.Universal.FocusMainView) + + t.Views().Main(). + IsFocused(). + SelectionIsHidden(). + FilterOrSearch("commit-0"). + Press(keys.Universal.NextMatch). + Tap(func() { + t.Views().Search().Content(Contains("matches for 'commit-0' (2 of 3)")) + + t.GlobalPress(keys.Universal.Refresh) + t.Views().Search().Content( + /* EXPECTED: + Contains("matches for 'commit-0' (2 of 3)")) + ACTUAL: */ + Contains("matches for 'commit-0' (1 of 3)")) + }) + }, +}) diff --git a/pkg/integration/tests/test_list.go b/pkg/integration/tests/test_list.go index d6e5be26a..6557641de 100644 --- a/pkg/integration/tests/test_list.go +++ b/pkg/integration/tests/test_list.go @@ -503,6 +503,7 @@ var tests = []*components.IntegrationTest{ main_view.ScrollDiffHorizontally, main_view.SearchCollapsesTheSelection, main_view.SearchFollowsTheSelection, + main_view.SearchOverACommitLogKeepsTheCurrentMatchOnRefresh, main_view.SearchScrollsToAMatchOffTheEdge, main_view.SelectBelowALongCommitMessage, main_view.SelectBelowALongDiffstat,