2022-08-08 21:32:58 +10:00
|
|
|
package interactive_rebase
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/jesseduffield/lazygit/pkg/config"
|
2022-08-14 20:13:39 +10:00
|
|
|
. "github.com/jesseduffield/lazygit/pkg/integration/components"
|
2022-08-08 21:32:58 +10:00
|
|
|
)
|
|
|
|
|
2022-08-14 20:13:39 +10:00
|
|
|
var One = NewIntegrationTest(NewIntegrationTestArgs{
|
2022-08-08 21:32:58 +10:00
|
|
|
Description: "Begins an interactive rebase, then fixups, drops, and squashes some commits",
|
|
|
|
ExtraCmdArgs: "",
|
|
|
|
Skip: false,
|
|
|
|
SetupConfig: func(config *config.AppConfig) {},
|
2022-08-14 20:13:39 +10:00
|
|
|
SetupRepo: func(shell *Shell) {
|
2022-08-08 21:32:58 +10:00
|
|
|
shell.
|
|
|
|
CreateNCommits(5) // these will appears at commit 05, 04, 04, down to 01
|
|
|
|
},
|
2022-08-14 20:13:39 +10:00
|
|
|
Run: func(shell *Shell, input *Input, assert *Assert, keys config.KeybindingConfig) {
|
2022-08-08 21:32:58 +10:00
|
|
|
input.SwitchToCommitsWindow()
|
|
|
|
assert.CurrentViewName("commits")
|
|
|
|
|
|
|
|
input.NavigateToListItemContainingText("commit 02")
|
|
|
|
input.PressKeys(keys.Universal.Edit)
|
2022-08-14 20:13:39 +10:00
|
|
|
assert.MatchSelectedLine(Contains("YOU ARE HERE"))
|
2022-08-08 21:32:58 +10:00
|
|
|
|
|
|
|
input.PreviousItem()
|
|
|
|
input.PressKeys(keys.Commits.MarkCommitAsFixup)
|
2022-08-14 20:13:39 +10:00
|
|
|
assert.MatchSelectedLine(Contains("fixup"))
|
2022-08-08 21:32:58 +10:00
|
|
|
|
|
|
|
input.PreviousItem()
|
|
|
|
input.PressKeys(keys.Universal.Remove)
|
2022-08-14 20:13:39 +10:00
|
|
|
assert.MatchSelectedLine(Contains("drop"))
|
2022-08-08 21:32:58 +10:00
|
|
|
|
|
|
|
input.PreviousItem()
|
|
|
|
input.PressKeys(keys.Commits.SquashDown)
|
2022-08-14 20:13:39 +10:00
|
|
|
assert.MatchSelectedLine(Contains("squash"))
|
2022-08-08 21:32:58 +10:00
|
|
|
|
|
|
|
input.ContinueRebase()
|
|
|
|
|
|
|
|
assert.CommitCount(2)
|
|
|
|
},
|
|
|
|
})
|