diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2023-08-02 22:32:57 +1000 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2023-08-02 22:32:57 +1000 |
commit | 0152639ef0a574b9df98c1e812580d1c54d4d76e (patch) | |
tree | e4030f01908874ccf1826ad48a3d0366176e4e33 /pkg | |
parent | c43195efb6c7459ea24180ef464bc6e19942654f (diff) |
Add demo for staging lines
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/integration/tests/demo/stage_lines.go | 85 | ||||
-rw-r--r-- | pkg/integration/tests/test_list.go | 1 |
2 files changed, 86 insertions, 0 deletions
diff --git a/pkg/integration/tests/demo/stage_lines.go b/pkg/integration/tests/demo/stage_lines.go new file mode 100644 index 000000000..6bfa21a98 --- /dev/null +++ b/pkg/integration/tests/demo/stage_lines.go @@ -0,0 +1,85 @@ +package demo + +import ( + "github.com/jesseduffield/lazygit/pkg/config" + . "github.com/jesseduffield/lazygit/pkg/integration/components" +) + +var originalFile = `# Lazygit + +Simple terminal UI for git commands + +![demo](https://user-images.gh.com/demo.gif) + +## Installation + +### Homebrew + +` + +var updatedFile = `# Lazygit + +Simple terminal UI for git +(Not too simple though) + +![demo](https://user-images.gh.com/demo.gif) + +## Installation + +### Homebrew + +Just do brew install lazygit and bada bing bada +boom you have begun on the path of laziness. + +` + +var StageLines = NewIntegrationTest(NewIntegrationTestArgs{ + Description: "Stage individual lines", + ExtraCmdArgs: []string{}, + Skip: false, + IsDemo: true, + SetupConfig: func(config *config.AppConfig) { + // No idea why I had to use version 2: it should be using my own computer's + // font and the one iterm uses is version 3. + config.UserConfig.Gui.NerdFontsVersion = "2" + config.UserConfig.Gui.ShowFileTree = false + config.UserConfig.Gui.ShowCommandLog = false + }, + SetupRepo: func(shell *Shell) { + shell.NewBranch("docs-fix") + shell.CreateNCommitsWithRandomMessages(30) + shell.CreateFileAndAdd("docs/README.md", originalFile) + shell.Commit("Update docs/README") + shell.UpdateFile("docs/README.md", updatedFile) + }, + Run: func(t *TestDriver, keys config.KeybindingConfig) { + t.SetCaptionPrefix("Stage individual lines") + t.Wait(1000) + + t.Views().Files(). + IsFocused(). + PressEnter() + + t.Views().Staging(). + IsFocused(). + Press(keys.Main.ToggleDragSelect). + PressFast(keys.Universal.NextItem). + PressFast(keys.Universal.NextItem). + Wait(500). + PressPrimaryAction(). + Wait(500). + PressEscape() + + t.Views().Files(). + IsFocused(). + Press(keys.Files.CommitChanges). + Tap(func() { + t.ExpectPopup().CommitMessagePanel(). + Type("Update tagline"). + Confirm() + }) + + t.Views().Commits(). + Focus() + }, +}) diff --git a/pkg/integration/tests/test_list.go b/pkg/integration/tests/test_list.go index f5197f852..75508784e 100644 --- a/pkg/integration/tests/test_list.go +++ b/pkg/integration/tests/test_list.go @@ -96,6 +96,7 @@ var tests = []*components.IntegrationTest{ demo.Filter, demo.InteractiveRebase, demo.NukeWorkingTree, + demo.StageLines, diff.Diff, diff.DiffAndApplyPatch, diff.DiffCommits, |