1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-04-25 12:24:47 +02:00
lazygit/pkg/integration/tests/branch/squash_merge.go
2024-06-30 11:01:03 +10:00

65 lines
1.6 KiB
Go

package branch
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var SquashMerge = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Squash merge a branch both with and without committing",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.NewBranch("original-branch").
EmptyCommit("one").
NewBranch("change-worktree-branch").
CreateFileAndAdd("work", "content").
Commit("work").
Checkout("original-branch").
NewBranch("change-commit-branch").
CreateFileAndAdd("file", "content").
Commit("file").
Checkout("original-branch")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Commits().TopLines(
Contains("one"),
)
t.Views().Branches().
Focus().
Lines(
Contains("original-branch").IsSelected(),
Contains("change-commit-branch"),
Contains("change-worktree-branch"),
).
SelectNextItem().
Press(keys.Branches.MergeIntoCurrentBranch)
t.ExpectPopup().Menu().
Title(Equals("Merge")).
Select(Contains("Squash merge and commit")).
Confirm()
t.Views().Commits().TopLines(
Contains("Squash merge change-commit-branch into original-branch"),
Contains("one"),
)
t.Views().Branches().
Focus().
NavigateToLine(Contains("change-worktree-branch")).
Press(keys.Branches.MergeIntoCurrentBranch)
t.ExpectPopup().Menu().
Title(Equals("Merge")).
Select(Contains("Squash merge and leave uncommitted")).
Confirm()
t.Views().Files().Focus().Lines(
Contains("work"),
)
},
})