mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-08-08 22:36:49 +02:00
Add test for creating a fixup commit and squashing fixups
We have such a test already (squash_fixups_above_first_commit.go), but it can't be used for what we want to check here, because it uses the first commit, and we can't move down from there. So create a new one that basically does the same thing, but for a commit in the middle. The focus of this new test is to check how the selection behaves; as you can see, there is a problem both when creating a fixup and when squashing fixups. We'll address these separately in the next commits.
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
package interactive_rebase
|
||||
|
||||
import (
|
||||
"github.com/jesseduffield/lazygit/pkg/config"
|
||||
. "github.com/jesseduffield/lazygit/pkg/integration/components"
|
||||
)
|
||||
|
||||
var SquashFixupsAbove = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Description: "Squashes all fixups above a commit and checks that the selected line stays correct.",
|
||||
ExtraCmdArgs: []string{},
|
||||
Skip: false,
|
||||
SetupConfig: func(config *config.AppConfig) {},
|
||||
SetupRepo: func(shell *Shell) {
|
||||
shell.
|
||||
CreateNCommits(3).
|
||||
CreateFileAndAdd("fixup-file", "fixup content")
|
||||
},
|
||||
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
||||
t.Views().Commits().
|
||||
Focus().
|
||||
Lines(
|
||||
Contains("commit 03"),
|
||||
Contains("commit 02"),
|
||||
Contains("commit 01"),
|
||||
).
|
||||
NavigateToLine(Contains("commit 02")).
|
||||
Press(keys.Commits.CreateFixupCommit).
|
||||
Tap(func() {
|
||||
t.ExpectPopup().Confirmation().
|
||||
Title(Equals("Create fixup commit")).
|
||||
Content(Contains("Are you sure you want to create a fixup! commit for commit")).
|
||||
Confirm()
|
||||
}).
|
||||
Lines(
|
||||
Contains("fixup! commit 02"),
|
||||
Contains("commit 03").IsSelected(), // wrong, we want the next line
|
||||
Contains("commit 02"),
|
||||
Contains("commit 01"),
|
||||
).
|
||||
SelectNextItem().
|
||||
Press(keys.Commits.SquashAboveCommits).
|
||||
Tap(func() {
|
||||
t.ExpectPopup().Menu().
|
||||
Title(Equals("Apply fixup commits")).
|
||||
Select(Contains("Above the selected commit")).
|
||||
Confirm()
|
||||
}).
|
||||
Lines(
|
||||
Contains("commit 03"),
|
||||
Contains("commit 02"),
|
||||
Contains("commit 01").IsSelected(), // wrong, we want the previous line
|
||||
).
|
||||
SelectPreviousItem()
|
||||
|
||||
t.Views().Main().
|
||||
Content(Contains("fixup content"))
|
||||
},
|
||||
})
|
@@ -188,6 +188,7 @@ var tests = []*components.IntegrationTest{
|
||||
interactive_rebase.RewordYouAreHereCommitWithEditor,
|
||||
interactive_rebase.SquashDownFirstCommit,
|
||||
interactive_rebase.SquashDownSecondCommit,
|
||||
interactive_rebase.SquashFixupsAbove,
|
||||
interactive_rebase.SquashFixupsAboveFirstCommit,
|
||||
interactive_rebase.SquashFixupsInCurrentBranch,
|
||||
interactive_rebase.SwapInRebaseWithConflict,
|
||||
|
Reference in New Issue
Block a user