1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
|
package branch
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var Delete = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Try all combination of local and remote branch deletions",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.
CloneIntoRemote("origin").
EmptyCommit("blah").
NewBranch("branch-one").
PushBranchAndSetUpstream("origin", "branch-one").
NewBranch("branch-two").
PushBranchAndSetUpstream("origin", "branch-two").
EmptyCommit("deletion blocker").
NewBranch("branch-three")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Branches().
Focus().
Lines(
MatchesRegexp(`\*.*branch-three`).IsSelected(),
MatchesRegexp(`branch-two`),
MatchesRegexp(`branch-one`),
MatchesRegexp(`master`),
).
Press(keys.Universal.Remove).
Tap(func() {
t.ExpectPopup().
Menu().
Tooltip(Contains("You cannot delete the checked out branch!")).
Title(Equals("Delete branch 'branch-three'?")).
Select(Contains("Delete local branch")).
Confirm().
Tap(func() {
t.ExpectToast(Contains("You cannot delete the checked out branch!"))
}).
Cancel()
}).
SelectNextItem().
Press(keys.Universal.Remove).
Tap(func() {
t.ExpectPopup().
Menu().
Title(Equals("Delete branch 'branch-two'?")).
Select(Contains("Delete local branch")).
Confirm()
}).
Tap(func() {
t.ExpectPopup().
Confirmation().
Title(Equals("Force delete branch")).
Content(Equals("'branch-two' is not fully merged. Are you sure you want to delete it?")).
Confirm()
}).
Lines(
MatchesRegexp(`\*.*branch-three`),
MatchesRegexp(`branch-one`).IsSelected(),
MatchesRegexp(`master`),
).
Press(keys.Universal.Remove).
Tap(func() {
t.ExpectPopup().
Menu().
Title(Equals("Delete branch 'branch-one'?")).
Select(Contains("Delete remote branch")).
Confirm()
}).
Tap(func() {
t.ExpectPopup().
Confirmation().
Title(Equals("Delete branch 'branch-one'?")).
Content(Equals("Are you sure you want to delete the remote branch 'branch-one' from 'origin'?")).
Confirm()
}).
Tap(func() {
t.Views().Remotes().
Focus().
Lines(Contains("origin")).
PressEnter()
t.Views().
RemoteBranches().
Lines(Equals("branch-two")).
Press(keys.Universal.Return)
t.Views().
Branches().
Focus()
}).
Lines(
MatchesRegexp(`\*.*branch-three`),
MatchesRegexp(`branch-one \(upstream gone\)`).IsSelected(),
MatchesRegexp(`master`),
).
Press(keys.Universal.Remove).
Tap(func() {
t.ExpectPopup().
Menu().
Title(Equals("Delete branch 'branch-one'?")).
Select(Contains("Delete local branch")).
Confirm()
}).
Lines(
MatchesRegexp(`\*.*branch-three`),
MatchesRegexp(`master`).IsSelected(),
)
},
})
|