mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-06-15 00:15:32 +02:00
Add new integration tests folder "shell_commands"
The folder custom_commands contained tests for both custom commands (the ones you configure in config.yml) and shell commands (the ones you execute at the ":" prompt). I always found this confusing, so separate these into two different folders.
This commit is contained in:
60
pkg/integration/tests/shell_commands/history.go
Normal file
60
pkg/integration/tests/shell_commands/history.go
Normal file
@ -0,0 +1,60 @@
|
||||
package shell_commands
|
||||
|
||||
import (
|
||||
"github.com/jesseduffield/lazygit/pkg/config"
|
||||
. "github.com/jesseduffield/lazygit/pkg/integration/components"
|
||||
)
|
||||
|
||||
var History = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Description: "Test that the custom commands history is saved correctly",
|
||||
ExtraCmdArgs: []string{},
|
||||
Skip: false,
|
||||
SetupRepo: func(shell *Shell) {},
|
||||
SetupConfig: func(cfg *config.AppConfig) {},
|
||||
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
||||
t.GlobalPress(keys.Universal.ExecuteCustomCommand)
|
||||
t.ExpectPopup().Prompt().
|
||||
Title(Equals("Custom command:")).
|
||||
Type("echo 1").
|
||||
Confirm()
|
||||
|
||||
t.GlobalPress(keys.Universal.ExecuteCustomCommand)
|
||||
t.ExpectPopup().Prompt().
|
||||
Title(Equals("Custom command:")).
|
||||
SuggestionLines(Contains("1")).
|
||||
Type("echo 2").
|
||||
Confirm()
|
||||
|
||||
t.GlobalPress(keys.Universal.ExecuteCustomCommand)
|
||||
t.ExpectPopup().Prompt().
|
||||
Title(Equals("Custom command:")).
|
||||
SuggestionLines(
|
||||
// "echo 2" was typed last, so it should come first
|
||||
Contains("2"),
|
||||
Contains("1"),
|
||||
).
|
||||
Type("echo 3").
|
||||
Confirm()
|
||||
|
||||
t.GlobalPress(keys.Universal.ExecuteCustomCommand)
|
||||
t.ExpectPopup().Prompt().
|
||||
Title(Equals("Custom command:")).
|
||||
SuggestionLines(
|
||||
Contains("3"),
|
||||
Contains("2"),
|
||||
Contains("1"),
|
||||
).
|
||||
Type("echo 1").
|
||||
Confirm()
|
||||
|
||||
// Executing a command again should move it to the front:
|
||||
t.GlobalPress(keys.Universal.ExecuteCustomCommand)
|
||||
t.ExpectPopup().Prompt().
|
||||
Title(Equals("Custom command:")).
|
||||
SuggestionLines(
|
||||
Contains("1"),
|
||||
Contains("3"),
|
||||
Contains("2"),
|
||||
)
|
||||
},
|
||||
})
|
Reference in New Issue
Block a user