1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-28 16:02:01 +03:00

migrate patch building tests

This commit is contained in:
Jesse Duffield
2023-02-25 13:08:45 +11:00
parent 6c0b805137
commit dd1bf629b8
161 changed files with 1204 additions and 489 deletions

View File

@ -0,0 +1,70 @@
package patch_building
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var MoveToNewCommit = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Move a patch from a commit to a new commit",
ExtraCmdArgs: "",
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.CreateFileAndAdd("file1", "file1 content")
shell.Commit("first commit")
shell.UpdateFileAndAdd("file1", "file1 content with old changes")
shell.Commit("second commit")
shell.UpdateFileAndAdd("file1", "file1 content with new changes")
shell.Commit("third commit")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Commits().
Focus().
Lines(
Contains("third commit").IsSelected(),
Contains("second commit"),
Contains("first commit"),
).
SelectNextItem().
PressEnter()
t.Views().CommitFiles().
IsFocused().
Lines(
Contains("file1").IsSelected(),
).
PressPrimaryAction()
t.Views().Information().Content(Contains("building patch"))
t.Actions().SelectPatchOption(Contains("move patch into new commit"))
t.Views().CommitFiles().
IsFocused().
Lines(
Contains("file1").IsSelected(),
).
PressEscape()
t.Views().Commits().
IsFocused().
Lines(
Contains("third commit"),
Contains(`Split from "second commit"`).IsSelected(),
Contains("second commit"),
Contains("first commit"),
).
SelectNextItem().
PressEnter()
// the original commit has no more files in it
t.Views().CommitFiles().
IsFocused().
Lines(
Contains("(none)"),
)
},
})