Skip to content

Commit 380855d

Browse files
committed
Add tests for clicking in status side panel
To prevent this from breaking again. All three tests would fail without the fix from the previous commit.
1 parent 88e7c44 commit 380855d

File tree

4 files changed

+84
-0
lines changed

4 files changed

+84
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package status
2+
3+
import (
4+
"github.com/jesseduffield/lazygit/pkg/config"
5+
. "github.com/jesseduffield/lazygit/pkg/integration/components"
6+
)
7+
8+
var ClickRepoNameToOpenReposMenu = NewIntegrationTest(NewIntegrationTestArgs{
9+
Description: "Click on the repo name in the status side panel to open the recent repositories menu",
10+
ExtraCmdArgs: []string{},
11+
Skip: false,
12+
SetupConfig: func(config *config.AppConfig) {},
13+
SetupRepo: func(shell *Shell) {},
14+
Run: func(t *TestDriver, keys config.KeybindingConfig) {
15+
t.Views().Status().Click(1, 0)
16+
t.ExpectPopup().Menu().Title(Equals("Recent repositories"))
17+
},
18+
})
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
package status
2+
3+
import (
4+
"github.com/jesseduffield/lazygit/pkg/config"
5+
. "github.com/jesseduffield/lazygit/pkg/integration/components"
6+
)
7+
8+
var ClickToFocus = NewIntegrationTest(NewIntegrationTestArgs{
9+
Description: "Click in the status side panel to activate it",
10+
ExtraCmdArgs: []string{},
11+
Skip: false,
12+
SetupConfig: func(config *config.AppConfig) {},
13+
SetupRepo: func(shell *Shell) {},
14+
Run: func(t *TestDriver, keys config.KeybindingConfig) {
15+
t.Views().Files().Focus()
16+
t.Views().Main().Lines(
17+
Contains("No changed files"),
18+
)
19+
20+
t.Views().Status().Click(0, 0)
21+
t.Views().Status().IsFocused()
22+
t.Views().Main().ContainsLines(
23+
Contains(` _`),
24+
Contains(` | | (_) |`),
25+
Contains(` | | __ _ _____ _ __ _ _| |_`),
26+
Contains(" | |/ _` |_ / | | |/ _` | | __|"),
27+
Contains(` | | (_| |/ /| |_| | (_| | | |_`),
28+
Contains(` |_|\__,_/___|\__, |\__, |_|\__|`),
29+
Contains(` __/ | __/ |`),
30+
Contains(` |___/ |___/`),
31+
Contains(``),
32+
Contains(`Copyright `),
33+
)
34+
},
35+
})
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package status
2+
3+
import (
4+
"github.com/jesseduffield/lazygit/pkg/config"
5+
. "github.com/jesseduffield/lazygit/pkg/integration/components"
6+
)
7+
8+
var ClickWorkingTreeStateToOpenRebaseOptionsMenu = NewIntegrationTest(NewIntegrationTestArgs{
9+
Description: "Click on the working tree state in the status side panel to open the rebase options menu",
10+
ExtraCmdArgs: []string{},
11+
Skip: false,
12+
SetupConfig: func(config *config.AppConfig) {},
13+
SetupRepo: func(shell *Shell) {
14+
shell.CreateNCommits(2)
15+
},
16+
Run: func(t *TestDriver, keys config.KeybindingConfig) {
17+
t.Views().Commits().
18+
Focus().
19+
Press(keys.Universal.Edit)
20+
21+
t.Views().Status().
22+
Content(Contains("(rebasing) repo")).
23+
Click(1, 0)
24+
25+
t.ExpectPopup().Menu().Title(Equals("Rebase options"))
26+
},
27+
})

pkg/integration/tests/test_list.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import (
2323
"github.com/jesseduffield/lazygit/pkg/integration/tests/reflog"
2424
"github.com/jesseduffield/lazygit/pkg/integration/tests/staging"
2525
"github.com/jesseduffield/lazygit/pkg/integration/tests/stash"
26+
"github.com/jesseduffield/lazygit/pkg/integration/tests/status"
2627
"github.com/jesseduffield/lazygit/pkg/integration/tests/submodule"
2728
"github.com/jesseduffield/lazygit/pkg/integration/tests/sync"
2829
"github.com/jesseduffield/lazygit/pkg/integration/tests/tag"
@@ -257,6 +258,9 @@ var tests = []*components.IntegrationTest{
257258
stash.StashIncludingUntrackedFiles,
258259
stash.StashStaged,
259260
stash.StashUnstaged,
261+
status.ClickRepoNameToOpenReposMenu,
262+
status.ClickToFocus,
263+
status.ClickWorkingTreeStateToOpenRebaseOptionsMenu,
260264
submodule.Add,
261265
submodule.Enter,
262266
submodule.EnterNested,

0 commit comments

Comments
 (0)