1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2024-12-02 09:21:40 +02:00

Add demo for staging lines

This commit is contained in:
Jesse Duffield 2023-08-02 22:32:57 +10:00
parent c43195efb6
commit 0152639ef0
2 changed files with 86 additions and 0 deletions

View File

@ -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()
},
})

View File

@ -96,6 +96,7 @@ var tests = []*components.IntegrationTest{
demo.Filter,
demo.InteractiveRebase,
demo.NukeWorkingTree,
demo.StageLines,
diff.Diff,
diff.DiffAndApplyPatch,
diff.DiffCommits,