1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-01-26 05:37:18 +02:00
lazygit/pkg/integration/tests/branch/unset_upstream.go

60 lines
1.8 KiB
Go
Raw Normal View History

2023-02-22 21:57:32 +11:00
package branch
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var UnsetUpstream = NewIntegrationTest(NewIntegrationTestArgs{
2023-11-04 23:19:38 +01:00
Description: "Unset upstream of selected branch, both when it exists and when it doesn't",
ExtraCmdArgs: []string{},
2023-02-22 21:57:32 +11:00
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
2023-11-04 23:19:38 +01:00
shell.
EmptyCommit("one").
NewBranch("branch_to_remove").
Checkout("master").
CloneIntoRemote("origin").
SetBranchUpstream("master", "origin/master").
SetBranchUpstream("branch_to_remove", "origin/branch_to_remove").
// to get the "(upstream gone)" branch status
RunCommand([]string{"git", "push", "origin", "--delete", "branch_to_remove"})
2023-02-22 21:57:32 +11:00
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Branches().
Focus().
Press(keys.Universal.NextScreenMode). // we need to enlargen the window to see the upstream
2023-11-04 23:19:38 +01:00
SelectedLines(
Contains("master").Contains("origin master"),
2023-02-22 21:57:32 +11:00
).
Press(keys.Branches.SetUpstream).
Tap(func() {
t.ExpectPopup().Menu().
Title(Equals("Upstream options")).
Select(Contains("Unset upstream of selected branch")).
2023-02-22 21:57:32 +11:00
Confirm()
}).
2023-11-04 23:19:38 +01:00
SelectedLines(
Contains("master").DoesNotContain("origin master"),
)
t.Views().Branches().
Focus().
SelectNextItem().
SelectedLines(
Contains("branch_to_remove").Contains("origin branch_to_remove").Contains("upstream gone"),
).
Press(keys.Branches.SetUpstream).
Tap(func() {
t.ExpectPopup().Menu().
Title(Equals("Upstream options")).
Select(Contains("Unset upstream of selected branch")).
Confirm()
}).
SelectedLines(
Contains("branch_to_remove").DoesNotContain("origin branch_to_remove").DoesNotContain("upstream gone"),
2023-02-22 21:57:32 +11:00
)
},
})