Add a test showing that a refresh resets the search in a commit log

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Stefan Haller
2026-11-07 19:54:00 +01:00
co-authored by Claude Opus 5.5
parent c732aaf163
commit 5f5d6a1dd6
2 changed files with 38 additions and 0 deletions
@@ -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)"))
})
},
})
+1
View File
@@ -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,