Skip to content

Commit 0111dbd

Browse files
committed
Add integration test for the new divergence log
1 parent efd8f48 commit 0111dbd

File tree

2 files changed

+55
-0
lines changed

2 files changed

+55
-0
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
package branch
2+
3+
import (
4+
"github.com/jesseduffield/lazygit/pkg/config"
5+
. "github.com/jesseduffield/lazygit/pkg/integration/components"
6+
)
7+
8+
var ShowDivergenceFromUpstream = NewIntegrationTest(NewIntegrationTestArgs{
9+
Description: "Show divergence from upstream",
10+
ExtraCmdArgs: []string{},
11+
Skip: false,
12+
SetupConfig: func(config *config.AppConfig) {},
13+
SetupRepo: func(shell *Shell) {
14+
shell.CreateFileAndAdd("file", "content1")
15+
shell.Commit("one")
16+
shell.UpdateFileAndAdd("file", "content2")
17+
shell.Commit("two")
18+
shell.CreateFileAndAdd("file3", "content3")
19+
shell.Commit("three")
20+
21+
shell.CloneIntoRemote("origin")
22+
23+
shell.SetBranchUpstream("master", "origin/master")
24+
25+
shell.HardReset("HEAD^^")
26+
shell.CreateFileAndAdd("file4", "content4")
27+
shell.Commit("four")
28+
},
29+
Run: func(t *TestDriver, keys config.KeybindingConfig) {
30+
t.Views().Commits().
31+
Lines(
32+
Contains("four"),
33+
Contains("one"),
34+
)
35+
36+
t.Views().Branches().
37+
Focus().
38+
Lines(Contains("master")).
39+
Press(keys.Branches.SetUpstream)
40+
41+
t.ExpectPopup().Menu().Title(Contains("upstream")).Select(Contains("View divergence from upstream")).Confirm()
42+
43+
t.Views().SubCommits().
44+
IsFocused().
45+
Title(Contains("Commits (master <-> origin/master)")).
46+
Lines(
47+
DoesNotContainAnyOf("↓", "↑").Contains("--- Remote ---"),
48+
Contains("↓").Contains("three"),
49+
Contains("↓").Contains("two"),
50+
DoesNotContainAnyOf("↓", "↑").Contains("--- Local ---"),
51+
Contains("↑").Contains("four"),
52+
)
53+
},
54+
})

pkg/integration/tests/test_list.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ var tests = []*components.IntegrationTest{
4949
branch.Reset,
5050
branch.ResetUpstream,
5151
branch.SetUpstream,
52+
branch.ShowDivergenceFromUpstream,
5253
branch.Suggestions,
5354
cherry_pick.CherryPick,
5455
cherry_pick.CherryPickConflicts,

0 commit comments

Comments
 (0)