mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-06-20 01:19:23 +02:00
Add integration tests for configuring the side panels
Cover the three things gui.sidePanels enables: reordering the panels (swapping branches and commits, checked via their jump keys), hiding a panel (omitting stash, checked by cycling past the last panel and wrapping to the first), and promoting a tab to its own panel (worktrees becomes a top-level panel reachable by a jump key, and the files panel's remaining tabs cycle straight to submodules). The tests drive focus with explicit jump keys rather than ViewDriver.Focus, which assumes the default panel layout. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -473,11 +473,14 @@ var tests = []*components.IntegrationTest{
|
||||
ui.Accordion,
|
||||
ui.DisableSwitchTabWithPanelJumpKeys,
|
||||
ui.EmptyMenu,
|
||||
ui.HideSidePanel,
|
||||
ui.KeybindingSuggestionsDontCrashOnDisabledBindings,
|
||||
ui.KeybindingSuggestionsWhenSwitchingRepos,
|
||||
ui.ModeSpecificKeybindingSuggestions,
|
||||
ui.OpenLinkFailure,
|
||||
ui.PromoteTabToSidePanel,
|
||||
ui.RangeSelect,
|
||||
ui.ReorderSidePanels,
|
||||
ui.SwitchTabFromMenu,
|
||||
ui.SwitchTabWithPanelJumpKeys,
|
||||
undo.UndoCheckoutAndDrop,
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package ui
|
||||
|
||||
import (
|
||||
"github.com/jesseduffield/lazygit/pkg/config"
|
||||
. "github.com/jesseduffield/lazygit/pkg/integration/components"
|
||||
)
|
||||
|
||||
var HideSidePanel = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Description: "Hide a side panel by omitting it from gui.sidePanels",
|
||||
ExtraCmdArgs: []string{},
|
||||
Skip: false,
|
||||
SetupConfig: func(cfg *config.AppConfig) {
|
||||
// No stash panel.
|
||||
cfg.GetUserConfig().Gui.SidePanels = []config.SidePanel{
|
||||
{"status"},
|
||||
{"files", "worktrees", "submodules"},
|
||||
{"branches", "remotes", "tags"},
|
||||
{"commits", "reflog"},
|
||||
}
|
||||
},
|
||||
SetupRepo: func(shell *Shell) {
|
||||
shell.CreateNCommits(2)
|
||||
},
|
||||
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
||||
// Commits is now the last panel; cycling forward from it wraps around to
|
||||
// the status panel, skipping the hidden stash panel entirely.
|
||||
t.Views().Files().IsFocused().
|
||||
Press(keys.Universal.JumpToBlock[3])
|
||||
t.Views().Commits().IsFocused().
|
||||
Press(keys.Universal.NextBlock)
|
||||
t.Views().Status().IsFocused()
|
||||
},
|
||||
})
|
||||
@@ -0,0 +1,40 @@
|
||||
package ui
|
||||
|
||||
import (
|
||||
"github.com/jesseduffield/lazygit/pkg/config"
|
||||
. "github.com/jesseduffield/lazygit/pkg/integration/components"
|
||||
)
|
||||
|
||||
var PromoteTabToSidePanel = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Description: "Promote the worktrees tab to its own top-level side panel via gui.sidePanels",
|
||||
ExtraCmdArgs: []string{},
|
||||
Skip: false,
|
||||
SetupConfig: func(cfg *config.AppConfig) {
|
||||
// Worktrees is pulled out of the files panel into its own panel.
|
||||
cfg.GetUserConfig().Gui.SidePanels = []config.SidePanel{
|
||||
{"status"},
|
||||
{"files", "submodules"},
|
||||
{"worktrees"},
|
||||
{"branches", "remotes", "tags"},
|
||||
{"commits", "reflog"},
|
||||
{"stash"},
|
||||
}
|
||||
},
|
||||
SetupRepo: func(shell *Shell) {
|
||||
shell.CreateNCommits(2)
|
||||
},
|
||||
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
||||
// Worktrees is now its own panel in the third position, reachable by its
|
||||
// jump key rather than as a tab of the files panel.
|
||||
t.Views().Files().IsFocused().
|
||||
Press(keys.Universal.JumpToBlock[2])
|
||||
t.Views().Worktrees().IsFocused().
|
||||
Press(keys.Universal.JumpToBlock[1])
|
||||
|
||||
// The files panel's tabs are now just files and submodules, so cycling
|
||||
// tabs from files goes straight to submodules.
|
||||
t.Views().Files().IsFocused().
|
||||
Press(keys.Universal.NextTab)
|
||||
t.Views().Submodules().IsFocused()
|
||||
},
|
||||
})
|
||||
@@ -0,0 +1,33 @@
|
||||
package ui
|
||||
|
||||
import (
|
||||
"github.com/jesseduffield/lazygit/pkg/config"
|
||||
. "github.com/jesseduffield/lazygit/pkg/integration/components"
|
||||
)
|
||||
|
||||
var ReorderSidePanels = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Description: "Reorder the side panels with gui.sidePanels, swapping the branches and commits panels",
|
||||
ExtraCmdArgs: []string{},
|
||||
Skip: false,
|
||||
SetupConfig: func(cfg *config.AppConfig) {
|
||||
cfg.GetUserConfig().Gui.SidePanels = []config.SidePanel{
|
||||
{"status"},
|
||||
{"files", "worktrees", "submodules"},
|
||||
{"commits", "reflog"},
|
||||
{"branches", "remotes", "tags"},
|
||||
{"stash"},
|
||||
}
|
||||
},
|
||||
SetupRepo: func(shell *Shell) {
|
||||
shell.CreateNCommits(2)
|
||||
},
|
||||
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
||||
// The third panel is now commits and the fourth is branches (the reverse
|
||||
// of the default order), so their jump keys are swapped.
|
||||
t.Views().Files().IsFocused().
|
||||
Press(keys.Universal.JumpToBlock[2])
|
||||
t.Views().Commits().IsFocused().
|
||||
Press(keys.Universal.JumpToBlock[3])
|
||||
t.Views().Branches().IsFocused()
|
||||
},
|
||||
})
|
||||
Reference in New Issue
Block a user