1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2024-12-04 10:34:55 +02:00

Add a test for stopping at an "edit" command that conflicts

This test is almost identical to swap_in_rebase_with_conflict.go, except that it
sets the commit that will conflict to "edit".

This test is interesting because there's special code needed to determine
whether an "edit" command conflicted or not, i.e. whether to show the "confl"
entry. In this case we do. We have lots of other tests already that have "edit"
commands that don't conflict, so that's covered already.
This commit is contained in:
Stefan Haller 2023-03-10 18:56:07 +01:00
parent 3928d0ebda
commit 1998d0724f
2 changed files with 53 additions and 0 deletions

View File

@ -0,0 +1,52 @@
package interactive_rebase
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var SwapInRebaseWithConflictAndEdit = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Via an edit-triggered rebase, swap two commits, causing a conflict, then edit the commit that will conflict.",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.CreateFileAndAdd("myfile", "one")
shell.Commit("commit one")
shell.UpdateFileAndAdd("myfile", "two")
shell.Commit("commit two")
shell.UpdateFileAndAdd("myfile", "three")
shell.Commit("commit three")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Commits().
Focus().
Lines(
Contains("commit three").IsSelected(),
Contains("commit two"),
Contains("commit one"),
).
NavigateToLine(Contains("commit one")).
Press(keys.Universal.Edit).
Lines(
Contains("commit three"),
Contains("commit two"),
Contains("<-- YOU ARE HERE --- commit one").IsSelected(),
).
NavigateToLine(Contains("commit two")).
Press(keys.Commits.MoveUpCommit).
Lines(
Contains("commit two").IsSelected(),
Contains("commit three"),
Contains("<-- YOU ARE HERE --- commit one"),
).
NavigateToLine(Contains("commit three")).
Press(keys.Universal.Edit).
SelectPreviousItem().
Tap(func() {
t.Common().ContinueRebase()
})
handleConflictsFromSwap(t)
},
})

View File

@ -121,6 +121,7 @@ var tests = []*components.IntegrationTest{
interactive_rebase.SquashDownSecondCommit,
interactive_rebase.SquashFixupsAboveFirstCommit,
interactive_rebase.SwapInRebaseWithConflict,
interactive_rebase.SwapInRebaseWithConflictAndEdit,
interactive_rebase.SwapWithConflict,
misc.ConfirmOnQuit,
misc.InitialOpen,