Skip to content

Commit 6b6d881

Browse files
committed
Add test to check that an "edit" entry correctly shows a conflict
This works correctly, we are only adding this as a regression test to verify that the change later in this branch doesn't break it.
1 parent bb4d03d commit 6b6d881

File tree

2 files changed

+64
-0
lines changed

2 files changed

+64
-0
lines changed
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
package interactive_rebase
2+
3+
import (
4+
"github.com/jesseduffield/lazygit/pkg/config"
5+
. "github.com/jesseduffield/lazygit/pkg/integration/components"
6+
)
7+
8+
var InteractiveRebaseWithConflictForEditCommand = NewIntegrationTest(NewIntegrationTestArgs{
9+
Description: "Rebase a branch interactively, and edit a commit that will conflict",
10+
ExtraCmdArgs: []string{},
11+
Skip: false,
12+
SetupConfig: func(cfg *config.AppConfig) {},
13+
SetupRepo: func(shell *Shell) {
14+
shell.EmptyCommit("initial commit")
15+
shell.CreateFileAndAdd("file.txt", "master content")
16+
shell.Commit("master commit")
17+
shell.NewBranchFrom("branch", "master^")
18+
shell.CreateNCommits(3)
19+
shell.CreateFileAndAdd("file.txt", "branch content")
20+
shell.Commit("this will conflict")
21+
},
22+
Run: func(t *TestDriver, keys config.KeybindingConfig) {
23+
t.Views().Commits().
24+
Focus().
25+
Lines(
26+
Contains("this will conflict").IsSelected(),
27+
Contains("commit 03"),
28+
Contains("commit 02"),
29+
Contains("commit 01"),
30+
Contains("initial commit"),
31+
)
32+
33+
t.Views().Branches().
34+
Focus().
35+
NavigateToLine(Contains("master")).
36+
Press(keys.Branches.RebaseBranch)
37+
38+
t.ExpectPopup().Menu().
39+
Title(Equals("Rebase 'branch'")).
40+
Select(Contains("Interactive rebase")).
41+
Confirm()
42+
43+
t.Views().Commits().
44+
IsFocused().
45+
NavigateToLine(Contains("this will conflict")).
46+
Press(keys.Universal.Edit)
47+
48+
t.Common().ContinueRebase()
49+
t.ExpectPopup().Menu().
50+
Title(Equals("Conflicts!")).
51+
Cancel()
52+
53+
t.Views().Commits().
54+
Lines(
55+
Contains("edit").Contains("<-- CONFLICT --- this will conflict").IsSelected(),
56+
Contains("commit 03"),
57+
Contains("commit 02"),
58+
Contains("commit 01"),
59+
Contains("master commit"),
60+
Contains("initial commit"),
61+
)
62+
},
63+
})

pkg/integration/tests/test_list.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,7 @@ var tests = []*components.IntegrationTest{
250250
interactive_rebase.FixupFirstCommit,
251251
interactive_rebase.FixupSecondCommit,
252252
interactive_rebase.InteractiveRebaseOfCopiedBranch,
253+
interactive_rebase.InteractiveRebaseWithConflictForEditCommand,
253254
interactive_rebase.MidRebaseRangeSelect,
254255
interactive_rebase.Move,
255256
interactive_rebase.MoveAcrossBranchBoundaryOutsideRebase,

0 commit comments

Comments
 (0)