1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-01-10 04:07:18 +02:00
lazygit/pkg/integration/tests/interactive_rebase/pick_rescheduled.go
Stefan Haller ba160cb5db 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.
2023-06-22 18:57:43 +02:00

48 lines
1.4 KiB
Go

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"),
)
},
})