mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-06-27 00:51:18 +02:00
Add undo/redo demo
This commit is contained in:
71
pkg/integration/tests/demo/undo.go
Normal file
71
pkg/integration/tests/demo/undo.go
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
package demo
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/jesseduffield/lazygit/pkg/config"
|
||||||
|
. "github.com/jesseduffield/lazygit/pkg/integration/components"
|
||||||
|
)
|
||||||
|
|
||||||
|
// TODO: fix confirmation view wrapping issue: https://github.com/jesseduffield/lazygit/issues/2872
|
||||||
|
|
||||||
|
var Undo = NewIntegrationTest(NewIntegrationTestArgs{
|
||||||
|
Description: "Undo",
|
||||||
|
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"
|
||||||
|
},
|
||||||
|
SetupRepo: func(shell *Shell) {
|
||||||
|
shell.CreateNCommitsWithRandomMessages(30)
|
||||||
|
},
|
||||||
|
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
||||||
|
t.SetCaptionPrefix("Undo commands")
|
||||||
|
t.Wait(1000)
|
||||||
|
|
||||||
|
confirmCommitDrop := func() {
|
||||||
|
t.ExpectPopup().Confirmation().
|
||||||
|
Title(Equals("Delete commit")).
|
||||||
|
Content(Equals("Are you sure you want to delete this commit?")).
|
||||||
|
Wait(500).
|
||||||
|
Confirm()
|
||||||
|
}
|
||||||
|
|
||||||
|
confirmUndo := func() {
|
||||||
|
t.ExpectPopup().Confirmation().
|
||||||
|
Title(Equals("Undo")).
|
||||||
|
Content(MatchesRegexp(`Are you sure you want to hard reset to '.*'\? An auto-stash will be performed if necessary\.`)).
|
||||||
|
Wait(500).
|
||||||
|
Confirm()
|
||||||
|
}
|
||||||
|
|
||||||
|
confirmRedo := func() {
|
||||||
|
t.ExpectPopup().Confirmation().
|
||||||
|
Title(Equals("Redo")).
|
||||||
|
Content(MatchesRegexp(`Are you sure you want to hard reset to '.*'\? An auto-stash will be performed if necessary\.`)).
|
||||||
|
Wait(500).
|
||||||
|
Confirm()
|
||||||
|
}
|
||||||
|
|
||||||
|
t.Views().Commits().Focus().
|
||||||
|
SetCaptionPrefix("Drop two commits").
|
||||||
|
Wait(1000).
|
||||||
|
Press(keys.Universal.Remove).
|
||||||
|
Tap(confirmCommitDrop).
|
||||||
|
Press(keys.Universal.Remove).
|
||||||
|
Tap(confirmCommitDrop).
|
||||||
|
SetCaptionPrefix("Undo the drops").
|
||||||
|
Wait(1000).
|
||||||
|
Press(keys.Universal.Undo).
|
||||||
|
Tap(confirmUndo).
|
||||||
|
Press(keys.Universal.Undo).
|
||||||
|
Tap(confirmUndo).
|
||||||
|
SetCaptionPrefix("Redo the drops").
|
||||||
|
Wait(1000).
|
||||||
|
Press(keys.Universal.Redo).
|
||||||
|
Tap(confirmRedo).
|
||||||
|
Press(keys.Universal.Redo).
|
||||||
|
Tap(confirmRedo)
|
||||||
|
},
|
||||||
|
})
|
@ -97,6 +97,7 @@ var tests = []*components.IntegrationTest{
|
|||||||
demo.InteractiveRebase,
|
demo.InteractiveRebase,
|
||||||
demo.NukeWorkingTree,
|
demo.NukeWorkingTree,
|
||||||
demo.StageLines,
|
demo.StageLines,
|
||||||
|
demo.Undo,
|
||||||
diff.Diff,
|
diff.Diff,
|
||||||
diff.DiffAndApplyPatch,
|
diff.DiffAndApplyPatch,
|
||||||
diff.DiffCommits,
|
diff.DiffCommits,
|
||||||
|
Reference in New Issue
Block a user