From dadfcbd9259623891b68bc2b2c81b4f048f9114d Mon Sep 17 00:00:00 2001 From: J-Kappes <87168492+J-Kappes@users.noreply.github.com> Date: Fri, 2 Feb 2024 12:13:46 +0000 Subject: [PATCH] start writing test --- .../tests/custom_commands/custom_shell.go | 28 +++++++++++++++++++ pkg/integration/tests/test_list.go | 1 + 2 files changed, 29 insertions(+) create mode 100644 pkg/integration/tests/custom_commands/custom_shell.go diff --git a/pkg/integration/tests/custom_commands/custom_shell.go b/pkg/integration/tests/custom_commands/custom_shell.go new file mode 100644 index 00000000000..94ff9d6d43a --- /dev/null +++ b/pkg/integration/tests/custom_commands/custom_shell.go @@ -0,0 +1,28 @@ +package custom_commands + +import ( + "github.com/jesseduffield/lazygit/pkg/config" + . "github.com/jesseduffield/lazygit/pkg/integration/components" +) + +var CustomShell = NewIntegrationTest(NewIntegrationTestArgs{ + Description: "Confirms a popup appears on first opening Lazygit", + ExtraCmdArgs: []string{}, + Skip: false, + SetupConfig: func(config *config.AppConfig) { + config.UserConfig.OS.Shell = "sh" + config.UserConfig.OS.ShellArg = "-c" + }, + SetupRepo: func(shell *Shell) {}, + Run: func(t *TestDriver, keys config.KeybindingConfig) { + t.Views().Files(). + IsEmpty(). + IsFocused(). + Press(keys.Universal.ExecuteCustomCommand) + + t.ExpectPopup().Prompt(). + Title(Equals("Custom command:")). + Type("echo hello world"). + Confirm() + }, +}) diff --git a/pkg/integration/tests/test_list.go b/pkg/integration/tests/test_list.go index cfadde3b133..417ab4a5fe5 100644 --- a/pkg/integration/tests/test_list.go +++ b/pkg/integration/tests/test_list.go @@ -97,6 +97,7 @@ var tests = []*components.IntegrationTest{ custom_commands.BasicCmdFromConfig, custom_commands.CheckForConflicts, custom_commands.ComplexCmdAtRuntime, + custom_commands.CustomShell, custom_commands.FormPrompts, custom_commands.MenuFromCommand, custom_commands.MenuFromCommandsOutput,