Add a test showing that a background refresh doesn't scroll to a conflict

If a rebase started outside of lazygit stops with a conflict, the next
background refresh selects the conflicted commit. It keeps the scroll
position though, so if there are enough pending todos above the
conflicted commit, the selection is off-screen.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Stefan Haller
2026-10-30 20:37:44 +01:00
co-authored by Claude Opus 5.5
parent cd23678775
commit 30744324f8
2 changed files with 41 additions and 0 deletions
+1
View File
@@ -655,6 +655,7 @@ var tests = []*components.IntegrationTest{
tag.ResetToDuplicateNamedBranch,
ui.Accordion,
ui.BackgroundRefreshKeepsScrollPosition,
ui.BackgroundRefreshScrollsToConflictedCommit,
ui.BranchesNotFirstTab,
ui.CommitsNotFirstTab,
ui.DisableSwitchTabWithPanelJumpKeys,
@@ -0,0 +1,40 @@
package ui
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var BackgroundRefreshScrollsToConflictedCommit = NewIntegrationTest(NewIntegrationTestArgs{
Description: "A background refresh that selects a newly conflicted commit scrolls it into view",
ExtraCmdArgs: []string{},
Skip: false,
Width: 120,
Height: 30,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.EmptyCommit("initial commit")
shell.CreateFileAndAdd("file.txt", "master content")
shell.Commit("master commit")
shell.NewBranchFrom("branch", "master^")
shell.CreateFileAndAdd("file.txt", "branch content")
shell.Commit("this will conflict")
shell.CreateNCommits(30)
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Commits().
Focus().
SelectedLine(Contains("commit-30")).
Tap(func() {
t.Shell().RunCommandExpectError([]string{"git", "rebase", "master"})
t.RefreshInBackground()
}).
// The conflicted commit, below the 30 pending todos and their header
SelectedLineIdx(31).
/* EXPECTED:
SelectedLineIsVisible().
SelectedLine(Contains("<-- CONFLICT --- this will conflict"))
ACTUAL: */
OriginY(0)
},
})