diff options
author | Stefan Haller <stefan@haller-berlin.de> | 2023-03-08 21:24:48 +0100 |
---|---|---|
committer | Stefan Haller <stefan@haller-berlin.de> | 2023-06-22 18:57:43 +0200 |
commit | ba160cb5db424330e59df41303215fe1a64e5b7c (patch) | |
tree | 3c91a238b4a760df35b9c5f9c1a19909453a4cc4 /pkg/integration | |
parent | 3d76c734aab1c92510b491fae25f94c1a8f5c0d5 (diff) |
Add test for a pick that fails and gets rescheduled
This test is interesting because it already behaves as desired: since git has
rescheduled the "pick" command, we do _not_ want to show a "conflict" entry in
this case, as we would see the same commit twice then.
Diffstat (limited to 'pkg/integration')
-rw-r--r-- | pkg/integration/tests/interactive_rebase/pick_rescheduled.go | 47 | ||||
-rw-r--r-- | pkg/integration/tests/test_list.go | 1 |
2 files changed, 48 insertions, 0 deletions
diff --git a/pkg/integration/tests/interactive_rebase/pick_rescheduled.go b/pkg/integration/tests/interactive_rebase/pick_rescheduled.go new file mode 100644 index 000000000..bd0f385f9 --- /dev/null +++ b/pkg/integration/tests/interactive_rebase/pick_rescheduled.go @@ -0,0 +1,47 @@ +package interactive_rebase + +import ( + "github.com/jesseduffield/lazygit/pkg/config" + . "github.com/jesseduffield/lazygit/pkg/integration/components" +) + +var PickRescheduled = NewIntegrationTest(NewIntegrationTestArgs{ + Description: "Makes a pick during a rebase fail because it would overwrite an untracked file", + ExtraCmdArgs: []string{}, + Skip: false, + SetupConfig: func(config *config.AppConfig) {}, + SetupRepo: func(shell *Shell) { + shell.CreateFileAndAdd("file1", "1\n").Commit("one") + shell.UpdateFileAndAdd("file2", "2\n").Commit("two") + shell.UpdateFileAndAdd("file3", "3\n").Commit("three") + }, + Run: func(t *TestDriver, keys config.KeybindingConfig) { + t.Views().Commits(). + Focus(). + Lines( + Contains("three").IsSelected(), + Contains("two"), + Contains("one"), + ). + NavigateToLine(Contains("one")). + Press(keys.Universal.Edit). + Lines( + Contains("pick").Contains("three"), + Contains("pick").Contains("two"), + Contains("<-- YOU ARE HERE --- one").IsSelected(), + ). + Tap(func() { + t.Shell().CreateFile("file3", "other content\n") + t.Common().ContinueRebase() + t.ExpectPopup().Alert().Title(Equals("Error")). + Content(Contains("The following untracked working tree files would be overwritten by merge"). + Contains("Please move or remove them before you merge.")). + Confirm() + }). + Lines( + Contains("pick").Contains("three"), + Contains("<-- YOU ARE HERE --- two"), + Contains("one"), + ) + }, +}) diff --git a/pkg/integration/tests/test_list.go b/pkg/integration/tests/test_list.go index 2c047b38f..c25df5c5d 100644 --- a/pkg/integration/tests/test_list.go +++ b/pkg/integration/tests/test_list.go @@ -109,6 +109,7 @@ var tests = []*components.IntegrationTest{ interactive_rebase.FixupSecondCommit, interactive_rebase.Move, interactive_rebase.MoveInRebase, + interactive_rebase.PickRescheduled, interactive_rebase.Rebase, interactive_rebase.RewordFirstCommit, interactive_rebase.RewordLastCommit, |