1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-04-19 12:12:42 +02:00

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.
This commit is contained in:
Stefan Haller 2024-05-03 21:47:28 +02:00
parent 88e7c44552
commit 380855d4e8
4 changed files with 84 additions and 0 deletions

View File

@ -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"))
},
})

View File

@ -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 `),
)
},
})

View File

@ -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"))
},
})

View File

@ -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,