diff --git a/pkg/integration/tests/interactive_rebase/swap_in_rebase_with_conflict_and_edit.go b/pkg/integration/tests/interactive_rebase/swap_in_rebase_with_conflict_and_edit.go new file mode 100644 index 000000000..494c79552 --- /dev/null +++ b/pkg/integration/tests/interactive_rebase/swap_in_rebase_with_conflict_and_edit.go @@ -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) + }, +}) diff --git a/pkg/integration/tests/test_list.go b/pkg/integration/tests/test_list.go index 02d4f8432..c1549df83 100644 --- a/pkg/integration/tests/test_list.go +++ b/pkg/integration/tests/test_list.go @@ -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,