summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Haller <stefan@haller-berlin.de>2024-05-03 21:47:28 +0200
committerStefan Haller <stefan@haller-berlin.de>2024-05-03 22:15:12 +0200
commita9f7fc1a548a70902a8e1e41724f895841437003 (patch)
tree2795057824b49aa8ee45a8c0579d9950b62a3f52
parent2602328cfae0335531bb7d28529ff8391026441e (diff)
Add tests for clicking in status side panelfix-clicking-in-status-panel
To prevent this from breaking again. All three tests would fail without the fix from the previous commit.
-rw-r--r--pkg/integration/tests/status/click_repo_name_to_open_repos_menu.go18
-rw-r--r--pkg/integration/tests/status/click_to_focus.go35
-rw-r--r--pkg/integration/tests/status/click_working_tree_state_to_open_rebase_options_menu.go27
-rw-r--r--pkg/integration/tests/test_list.go4
4 files changed, 84 insertions, 0 deletions
diff --git a/pkg/integration/tests/status/click_repo_name_to_open_repos_menu.go b/pkg/integration/tests/status/click_repo_name_to_open_repos_menu.go
new file mode 100644
index 000000000..5e1eab092
--- /dev/null
+++ b/pkg/integration/tests/status/click_repo_name_to_open_repos_menu.go
@@ -0,0 +1,18 @@
+package status
+
+import (
+ "github.com/jesseduffield/lazygit/pkg/config"
+ . "github.com/jesseduffield/lazygit/pkg/integration/components"
+)
+
+var ClickRepoNameToOpenReposMenu = NewIntegrationTest(NewIntegrationTestArgs{
+ Description: "Click on the repo name in the status side panel to open the recent repositories menu",
+ ExtraCmdArgs: []string{},
+ Skip: false,
+ SetupConfig: func(config *config.AppConfig) {},
+ SetupRepo: func(shell *Shell) {},
+ Run: func(t *TestDriver, keys config.KeybindingConfig) {
+ t.Views().Status().Click(1, 0)
+ t.ExpectPopup().Menu().Title(Equals("Recent repositories"))
+ },
+})
diff --git a/pkg/integration/tests/status/click_to_focus.go b/pkg/integration/tests/status/click_to_focus.go
new file mode 100644
index 000000000..3f20733a1
--- /dev/null
+++ b/pkg/integration/tests/status/click_to_focus.go
@@ -0,0 +1,35 @@
+package status
+
+import (
+ "github.com/jesseduffield/lazygit/pkg/config"
+ . "github.com/jesseduffield/lazygit/pkg/integration/components"
+)
+
+var ClickToFocus = NewIntegrationTest(NewIntegrationTestArgs{
+ Description: "Click in the status side panel to activate it",
+ ExtraCmdArgs: []string{},
+ Skip: false,
+ SetupConfig: func(config *config.AppConfig) {},
+ SetupRepo: func(shell *Shell) {},
+ Run: func(t *TestDriver, keys config.KeybindingConfig) {
+ t.Views().Files().Focus()
+ t.Views().Main().Lines(
+ Contains("No changed files"),
+ )
+
+ t.Views().Status().Click(0, 0)
+ t.Views().Status().IsFocused()
+ t.Views().Main().ContainsLines(
+ Contains(` _`),
+ Contains(` | | (_) |`),
+ Contains(` | | __ _ _____ _ __ _ _| |_`),
+ Contains(" | |/ _` |_ / | | |/ _` | | __|"),
+ Contains(` | | (_| |/ /| |_| | (_| | | |_`),
+ Contains(` |_|\__,_/___|\__, |\__, |_|\__|`),
+ Contains(` __/ | __/ |`),
+ Contains(` |___/ |___/`),
+ Contains(``),
+ Contains(`Copyright `),
+ )
+ },
+})
diff --git a/pkg/integration/tests/status/click_working_tree_state_to_open_rebase_options_menu.go b/pkg/integration/tests/status/click_working_tree_state_to_open_rebase_options_menu.go
new file mode 100644
index 000000000..42f221c54
--- /dev/null
+++ b/pkg/integration/tests/status/click_working_tree_state_to_open_rebase_options_menu.go
@@ -0,0 +1,27 @@
+package status
+
+import (
+ "github.com/jesseduffield/lazygit/pkg/config"
+ . "github.com/jesseduffield/lazygit/pkg/integration/components"
+)
+
+var ClickWorkingTreeStateToOpenRebaseOptionsMenu = NewIntegrationTest(NewIntegrationTestArgs{
+ Description: "Click on the working tree state in the status side panel to open the rebase options menu",
+ ExtraCmdArgs: []string{},
+ Skip: false,
+ SetupConfig: func(config *config.AppConfig) {},
+ SetupRepo: func(shell *Shell) {
+ shell.CreateNCommits(2)
+ },
+ Run: func(t *TestDriver, keys config.KeybindingConfig) {
+ t.Views().Commits().
+ Focus().
+ Press(keys.Universal.Edit)
+
+ t.Views().Status().
+ Content(Contains("(rebasing) repo")).
+ Click(1, 0)
+
+ t.ExpectPopup().Menu().Title(Equals("Rebase options"))
+ },
+})
diff --git a/pkg/integration/tests/test_list.go b/pkg/integration/tests/test_list.go
index 1c94e3bbd..bf6264cde 100644
--- a/pkg/integration/tests/test_list.go
+++ b/pkg/integration/tests/test_list.go
@@ -23,6 +23,7 @@ import (
"github.com/jesseduffield/lazygit/pkg/integration/tests/reflog"
"github.com/jesseduffield/lazygit/pkg/integration/tests/staging"
"github.com/jesseduffield/lazygit/pkg/integration/tests/stash"
+ "github.com/jesseduffield/lazygit/pkg/integration/tests/status"
"github.com/jesseduffield/lazygit/pkg/integration/tests/submodule"
"github.com/jesseduffield/lazygit/pkg/integration/tests/sync"
"github.com/jesseduffield/lazygit/pkg/integration/tests/tag"
@@ -257,6 +258,9 @@ var tests = []*components.IntegrationTest{
stash.StashIncludingUntrackedFiles,
stash.StashStaged,
stash.StashUnstaged,
+ status.ClickRepoNameToOpenReposMenu,
+ status.ClickToFocus,
+ status.ClickWorkingTreeStateToOpenRebaseOptionsMenu,
submodule.Add,
submodule.Enter,
submodule.EnterNested,