repo stringlengths 6 47 | file_url stringlengths 77 269 | file_path stringlengths 5 186 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-07 08:35:43 2026-01-07 08:55:24 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/commit/find_base_commit_for_fixup_only_added_lines.go | pkg/integration/tests/commit/find_base_commit_for_fixup_only_added_lines.go | package commit
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var FindBaseCommitForFixupOnlyAddedLines = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Finds the base commit to create a fixup for, when all staged hunks have only added lines",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.NewBranch("mybranch").
EmptyCommit("1st commit").
CreateFileAndAdd("file1", "line A\nline B\nline C\n").
Commit("2nd commit").
UpdateFileAndAdd("file1", "line A\nline B changed\nline C\n").
Commit("3rd commit").
CreateFileAndAdd("file2", "line X\nline Y\nline Z\n").
Commit("4th commit").
UpdateFile("file1", "line A\nline B changed\nline B'\nline C\n").
UpdateFile("file2", "line W\nline X\nline Y\nline Z\n")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Commits().
Lines(
Contains("4th commit"),
Contains("3rd commit"),
Contains("2nd commit"),
Contains("1st commit"),
)
// Two changes from different commits: this fails
t.Views().Files().
Focus().
Press(keys.Files.FindBaseCommitForFixup)
t.ExpectPopup().Alert().
Title(Equals("Error")).
Content(
MatchesRegexp(
"Multiple base commits found.*\n\n" +
".*4th commit\n" +
".*3rd commit",
),
).
Confirm()
// Stage only one of the files: this succeeds
t.Views().Files().
IsFocused().
NavigateToLine(Contains("file1")).
PressPrimaryAction().
Press(keys.Files.FindBaseCommitForFixup)
t.Views().Commits().
IsFocused().
Lines(
Contains("4th commit"),
Contains("3rd commit").IsSelected(),
Contains("2nd commit"),
Contains("1st commit"),
).
Press(keys.Commits.AmendToCommit)
t.ExpectPopup().Confirmation().
Title(Equals("Amend commit")).
Content(Contains("Are you sure you want to amend this commit with your staged files?")).
Confirm()
// Now only the other file is modified (and unstaged); this works now
t.Views().Files().
Focus().
Press(keys.Files.FindBaseCommitForFixup)
t.Views().Commits().
IsFocused().
Lines(
Contains("4th commit").IsSelected(),
Contains("3rd commit"),
Contains("2nd commit"),
Contains("1st commit"),
)
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/commit/set_author_range.go | pkg/integration/tests/commit/set_author_range.go | package commit
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var SetAuthorRange = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Set author on a range of commits",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.SetConfig("user.email", "Bill@example.com")
shell.SetConfig("user.name", "Bill Smith")
shell.EmptyCommit("fourth")
shell.EmptyCommit("third")
shell.EmptyCommit("second")
shell.EmptyCommit("first")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Commits().
Focus().
Lines(
Contains("BS").Contains("first").IsSelected(),
Contains("BS").Contains("second"),
Contains("BS").Contains("third"),
Contains("BS").Contains("fourth"),
)
t.Views().Commits().
Focus().
SelectNextItem().
Press(keys.Universal.ToggleRangeSelect).
SelectNextItem().
Press(keys.Commits.ResetCommitAuthor).
Tap(func() {
t.ExpectPopup().Menu().
Title(Equals("Amend commit attribute")).
Select(Contains(" Set author")). // adding space at start to distinguish from 'reset author'
Confirm()
t.ExpectPopup().Prompt().
Title(Contains("Set author")).
Type("John Smith <John@example.com>").
Confirm()
}).
PressEscape().
Lines(
Contains("BS").Contains("first"),
Contains("JS").Contains("second"),
Contains("JS").Contains("third").IsSelected(),
Contains("BS").Contains("fourth"),
)
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/commit/copy_tag_to_clipboard.go | pkg/integration/tests/commit/copy_tag_to_clipboard.go | package commit
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
// We're emulating the clipboard by writing to a file called clipboard
var CopyTagToClipboard = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Copy a commit tag to the clipboard",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {
config.GetUserConfig().OS.CopyToClipboardCmd = "printf '%s' {{text}} > clipboard"
},
SetupRepo: func(shell *Shell) {
shell.SetAuthor("John Doe", "john@doe.com")
shell.EmptyCommit("commit")
shell.CreateLightweightTag("tag1", "HEAD")
shell.CreateLightweightTag("tag2", "HEAD")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Commits().
Focus().
Lines(
Contains("commit").IsSelected(),
).
Press(keys.Commits.CopyCommitAttributeToClipboard)
t.ExpectPopup().Menu().
Title(Equals("Copy to clipboard")).
Select(Contains("Commit tags")).
Confirm()
t.ExpectToast(Equals("Commit tags copied to clipboard"))
t.FileSystem().FileContent("clipboard", Equals("tag2\ntag1"))
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/commit/add_co_author_while_committing.go | pkg/integration/tests/commit/add_co_author_while_committing.go | package commit
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var AddCoAuthorWhileCommitting = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Add co-author while typing the commit message",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {
},
SetupRepo: func(shell *Shell) {
shell.CreateFile("file", "file content")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Files().
IsFocused().
PressPrimaryAction(). // stage file
Press(keys.Files.CommitChanges)
t.ExpectPopup().CommitMessagePanel().
Type("Subject").
SwitchToDescription().
Type("Here's my message.").
AddCoAuthor("John Doe <john@doe.com>").
Content(Equals("Here's my message.\n\nCo-authored-by: John Doe <john@doe.com>")).
AddCoAuthor("Jane Smith <jane@smith.com>").
// Second co-author doesn't add a blank line:
Content(Equals("Here's my message.\n\nCo-authored-by: John Doe <john@doe.com>\nCo-authored-by: Jane Smith <jane@smith.com>")).
SwitchToSummary().
Confirm()
t.Views().Commits().
Lines(
Contains("Subject"),
).
Focus().
Tap(func() {
t.Views().Main().ContainsLines(
Equals(" Subject"),
Equals(" "),
Equals(" Here's my message."),
Equals(" "),
Equals(" Co-authored-by: John Doe <john@doe.com>"),
Equals(" Co-authored-by: Jane Smith <jane@smith.com>"),
)
})
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/commit/create_fixup_commit_in_branch_stack.go | pkg/integration/tests/commit/create_fixup_commit_in_branch_stack.go | package commit
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var CreateFixupCommitInBranchStack = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Create a fixup commit in a stack of branches, verify that it is created at the end of the branch it belongs to",
ExtraCmdArgs: []string{},
Skip: false,
GitVersion: AtLeast("2.38.0"),
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.NewBranch("branch1")
shell.EmptyCommit("branch1 commit 1")
shell.EmptyCommit("branch1 commit 2")
shell.EmptyCommit("branch1 commit 3")
shell.NewBranch("branch2")
shell.EmptyCommit("branch2 commit 1")
shell.EmptyCommit("branch2 commit 2")
shell.CreateFileAndAdd("fixup-file", "fixup content")
shell.SetConfig("rebase.updateRefs", "true")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Commits().
Focus().
Lines(
Contains("CI ◯ branch2 commit 2"),
Contains("CI ◯ branch2 commit 1"),
Contains("CI ◯ * branch1 commit 3"),
Contains("CI ◯ branch1 commit 2"),
Contains("CI ◯ branch1 commit 1"),
).
NavigateToLine(Contains("branch1 commit 2")).
Press(keys.Commits.CreateFixupCommit).
Tap(func() {
t.ExpectPopup().Menu().
Title(Equals("Create fixup commit")).
Select(Contains("fixup! commit")).
Confirm()
}).
Lines(
Contains("CI ◯ branch2 commit 2"),
Contains("CI ◯ branch2 commit 1"),
Contains("CI ◯ * fixup! branch1 commit 2"),
Contains("CI ◯ branch1 commit 3"),
Contains("CI ◯ branch1 commit 2"),
Contains("CI ◯ branch1 commit 1"),
)
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/commit/commit_with_prefix.go | pkg/integration/tests/commit/commit_with_prefix.go | package commit
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var CommitWithPrefix = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Commit with defined config commitPrefixes",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(cfg *config.AppConfig) {
cfg.GetUserConfig().Git.CommitPrefixes = map[string][]config.CommitPrefixConfig{
"repo": {{
Pattern: `^\w+/(\w+-\w+).*`,
Replace: "[$1]: ",
}},
}
},
SetupRepo: func(shell *Shell) {
shell.NewBranch("feature/TEST-001")
shell.CreateFile("test-commit-prefix", "This is foo bar")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Commits().
IsEmpty()
t.Views().Files().
IsFocused().
PressPrimaryAction().
Press(keys.Files.CommitChanges)
t.ExpectPopup().CommitMessagePanel().
Title(Equals("Commit summary")).
InitialText(Equals("[TEST-001]: ")).
Cancel()
t.Views().Files().
IsFocused().
Press(keys.Files.CommitChanges)
t.ExpectPopup().CommitMessagePanel().
Title(Equals("Commit summary")).
InitialText(Equals("[TEST-001]: ")).
Type("my commit message").
Cancel()
t.Views().Files().
IsFocused().
Press(keys.Files.CommitChanges)
t.ExpectPopup().CommitMessagePanel().
Title(Equals("Commit summary")).
InitialText(Equals("[TEST-001]: my commit message")).
Type(". Added something else").
Confirm()
t.Views().Commits().Focus()
t.Views().Main().Content(Contains("[TEST-001]: my commit message. Added something else"))
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/commit/find_base_commit_for_fixup_disregard_main_branch.go | pkg/integration/tests/commit/find_base_commit_for_fixup_disregard_main_branch.go | package commit
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var FindBaseCommitForFixupDisregardMainBranch = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Finds the base commit to create a fixup for, disregarding changes to a commit that is already on master",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.
EmptyCommit("1st commit").
CreateFileAndAdd("file1", "file1 content\n").
Commit("2nd commit").
NewBranch("mybranch").
CreateFileAndAdd("file2", "file2 content\n").
Commit("3rd commit").
EmptyCommit("4th commit").
UpdateFile("file1", "file1 changed content").
UpdateFile("file2", "file2 changed content")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Commits().
Lines(
Contains("4th commit").IsSelected(),
Contains("3rd commit"),
Contains("2nd commit"),
Contains("1st commit"),
)
t.Views().Files().
Focus().
Press(keys.Files.FindBaseCommitForFixup)
t.Views().Commits().
IsFocused().
Lines(
Contains("4th commit"),
Contains("3rd commit").IsSelected(),
Contains("2nd commit"),
Contains("1st commit"),
)
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/commit/discard_submodule_changes.go | pkg/integration/tests/commit/discard_submodule_changes.go | package commit
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var DiscardSubmoduleChanges = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Discarding changes to a submodule from an old commit.",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.EmptyCommit("Initial commit")
shell.CloneIntoSubmodule("submodule", "submodule")
shell.Commit("Add submodule")
shell.AddFileInWorktreeOrSubmodule("submodule", "file", "content")
shell.CommitInWorktreeOrSubmodule("submodule", "add file in submodule")
shell.GitAdd("submodule")
shell.Commit("Update submodule")
shell.UpdateFileInWorktreeOrSubmodule("submodule", "file", "changed content")
shell.CommitInWorktreeOrSubmodule("submodule", "change file in submodule")
shell.GitAdd("submodule")
shell.Commit("Update submodule again")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Commits().
Focus().
Lines(
Contains("Update submodule again").IsSelected(),
Contains("Update submodule"),
Contains("Add submodule"),
Contains("Initial commit"),
).
PressEnter()
t.Views().CommitFiles().
IsFocused().
Lines(
Equals("M submodule").IsSelected(),
).
Press(keys.Universal.Remove)
t.ExpectPopup().Confirmation().
Title(Equals("Discard file changes")).
Content(Contains("Are you sure you want to remove changes to the selected file(s) from this commit?")).
Confirm()
t.Shell().RunCommand([]string{"git", "submodule", "update"})
t.FileSystem().FileContent("submodule/file", Equals("content"))
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/commit/history.go | pkg/integration/tests/commit/history.go | package commit
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var History = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Cycling through commit message history in the commit message panel",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.EmptyCommit("initial commit")
shell.EmptyCommit("commit 2")
shell.EmptyCommit("commit 3")
shell.CreateFile("myfile", "myfile content")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Files().
IsFocused().
PressPrimaryAction(). // stage file
Press(keys.Files.CommitChanges)
t.ExpectPopup().CommitMessagePanel().
InitialText(Equals("")).
Type("my commit message").
SelectPreviousMessage().
Content(Equals("commit 3")).
SelectPreviousMessage().
Content(Equals("commit 2")).
SelectPreviousMessage().
Content(Equals("initial commit")).
SelectPreviousMessage().
Content(Equals("initial commit")). // we hit the end
SelectNextMessage().
Content(Equals("commit 2")).
SelectNextMessage().
Content(Equals("commit 3")).
SelectNextMessage().
Content(Equals("my commit message")).
SelectNextMessage().
Content(Equals("my commit message")). // we hit the beginning
Type(" with extra added").
Confirm()
t.Views().Commits().
TopLines(
Contains("my commit message with extra added").IsSelected(),
)
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/commit/search.go | pkg/integration/tests/commit/search.go | package commit
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var Search = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Search for a commit",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
// Creating a branch avoids that searching for 't' will unexpectedly match the first commit
// (since it finds it in the extra info line, which is "HEAD -> master")
shell.NewBranch("branch")
shell.EmptyCommit("one")
shell.EmptyCommit("two")
shell.EmptyCommit("three")
shell.EmptyCommit("four")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Commits().
Focus().
Lines(
Contains("four").IsSelected(),
Contains("three"),
Contains("two"),
Contains("one"),
).
Press(keys.Universal.StartSearch).
Tap(func() {
t.ExpectSearch().
Type("two").
Confirm()
t.Views().Search().IsVisible().Content(Contains("matches for 'two' (1 of 1)"))
}).
Lines(
Contains("four"),
Contains("three"),
Contains("two").IsSelected(),
Contains("one"),
).
Press(keys.Universal.StartSearch).
Tap(func() {
t.ExpectSearch().
Clear().
Type("o").
Confirm()
t.Views().Search().IsVisible().Content(Contains("matches for 'o' (2 of 3)"))
}).
Lines(
Contains("four"),
Contains("three"),
Contains("two").IsSelected(),
Contains("one"),
).
Press("n").
Tap(func() {
t.Views().Search().IsVisible().Content(Contains("matches for 'o' (3 of 3)"))
}).
Lines(
Contains("four"),
Contains("three"),
Contains("two"),
Contains("one").IsSelected(),
).
Press("n").
Tap(func() {
t.Views().Search().IsVisible().Content(Contains("matches for 'o' (1 of 3)"))
}).
Lines(
Contains("four").IsSelected(),
Contains("three"),
Contains("two"),
Contains("one"),
).
Press("n").
Tap(func() {
t.Views().Search().IsVisible().Content(Contains("matches for 'o' (2 of 3)"))
}).
Lines(
Contains("four"),
Contains("three"),
Contains("two").IsSelected(),
Contains("one"),
).
Press("N").
Tap(func() {
t.Views().Search().IsVisible().Content(Contains("matches for 'o' (1 of 3)"))
}).
Lines(
Contains("four").IsSelected(),
Contains("three"),
Contains("two"),
Contains("one"),
).
Press("N").
Tap(func() {
t.Views().Search().IsVisible().Content(Contains("matches for 'o' (3 of 3)"))
}).
Lines(
Contains("four"),
Contains("three"),
Contains("two"),
Contains("one").IsSelected(),
).
NavigateToLine(Contains("three")).
Tap(func() {
t.Views().Search().IsVisible().Content(Contains("matches for 'o' (1 of 3)"))
}).
Press("N").
Tap(func() {
t.Views().Search().IsVisible().Content(Contains("matches for 'o' (1 of 3)"))
}).
Lines(
Contains("four").IsSelected(),
Contains("three"),
Contains("two"),
Contains("one"),
).
Press(keys.Universal.StartSearch).
Tap(func() {
t.ExpectSearch().
Type("t").
Confirm()
t.Views().Search().IsVisible().Content(Contains("matches for 't' (1 of 2)"))
}).
Lines(
Contains("four"),
Contains("three").IsSelected(),
Contains("two"),
Contains("one"),
).
SelectPreviousItem().
Tap(func() {
t.Views().Search().IsVisible().Content(Contains("matches for 't' (1 of 2)"))
}).
Lines(
Contains("four").IsSelected(),
Contains("three"),
Contains("two"),
Contains("one"),
).
Press("n").
Tap(func() {
t.Views().Search().IsVisible().Content(Contains("matches for 't' (1 of 2)"))
}).
Lines(
Contains("four"),
Contains("three").IsSelected(),
Contains("two"),
Contains("one"),
)
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/commit/shared.go | pkg/integration/tests/commit/shared.go | package commit
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
func setupForAmendTests(shell *Shell) {
shell.EmptyCommit("base commit")
shell.NewBranch("branch")
shell.Checkout("master")
shell.CreateFileAndAdd("file1", "master")
shell.Commit("file1 changed in master")
shell.Checkout("branch")
shell.UpdateFileAndAdd("file2", "two")
shell.Commit("commit two")
shell.CreateFileAndAdd("file1", "branch")
shell.Commit("file1 changed in branch")
shell.UpdateFileAndAdd("file3", "three")
shell.Commit("commit three")
}
func doTheRebaseForAmendTests(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Commits().
Focus().
Lines(
Contains("commit three").IsSelected(),
Contains("file1 changed in branch"),
Contains("commit two"),
Contains("base commit"),
)
t.Views().Branches().
Focus().
NavigateToLine(Contains("master")).
Press(keys.Branches.RebaseBranch).
Tap(func() {
t.ExpectPopup().Menu().
Title(Equals("Rebase 'branch'")).
Select(Contains("Simple rebase")).
Confirm()
t.Common().AcknowledgeConflicts()
})
t.Views().Commits().
Lines(
Contains("--- Pending rebase todos ---"),
Contains("pick").Contains("commit three"),
Contains("pick").Contains("<-- CONFLICT --- file1 changed in branch"),
Contains("--- Commits ---"),
Contains("commit two"),
Contains("file1 changed in master"),
Contains("base commit"),
)
t.Views().Files().
Focus().
PressEnter()
t.Views().MergeConflicts().
IsFocused().
SelectNextItem(). // choose "incoming"
PressPrimaryAction()
t.ExpectPopup().Confirmation().
Title(Equals("Continue")).
Content(Contains("All merge conflicts resolved. Continue the rebase?")).
Cancel()
}
func checkCommitContainsChange(t *TestDriver, commitSubject string, change string) {
t.Views().Commits().
Focus().
NavigateToLine(Contains(commitSubject))
t.Views().Main().
Content(Contains(change))
}
func checkBlockingHook(t *TestDriver, keys config.KeybindingConfig) {
// Shared function for tests using the blockingHook pre-commit hook for testing hook skipping
// Stage first file
t.Views().Files().
IsFocused().
PressPrimaryAction().
Press(keys.Files.CommitChanges)
// Try to commit with hook
t.ExpectPopup().CommitMessagePanel().
Title(Equals("Commit summary")).
Type("Commit should fail").
Confirm()
t.ExpectPopup().Alert().
Title(Equals("Error")).
Content(Contains("Git command failed.")).
Confirm()
// Clear the message
t.Views().Files().
IsFocused().
Press(keys.Files.CommitChanges)
t.ExpectPopup().CommitMessagePanel().
Title(Equals("Commit summary")).
Clear().
Cancel()
// Unstage the file
t.Views().Files().
IsFocused().
PressPrimaryAction()
}
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/commit/staged_without_hooks.go | pkg/integration/tests/commit/staged_without_hooks.go | package commit
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var StagedWithoutHooks = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Staging a couple files, going in the staged files menu, unstaging a line then committing without pre-commit hooks",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.CreateFile(".git/hooks/pre-commit", blockingHook)
shell.MakeExecutable(".git/hooks/pre-commit")
shell.
CreateFile("myfile", "myfile content\nwith a second line").
CreateFile("myfile2", "myfile2 content")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Commits().
IsEmpty()
checkBlockingHook(t, keys)
// stage the file
t.Views().Files().
IsFocused().
Lines(
Equals("▼ /").IsSelected(),
Contains("myfile"),
Contains("myfile2"),
).
SelectNextItem().
PressPrimaryAction().
PressEnter()
// we start with both lines having been staged
t.Views().StagingSecondary().Content(
Contains("+myfile content").Contains("+with a second line"),
)
t.Views().Staging().Content(
DoesNotContain("+myfile content").DoesNotContain("+with a second line"),
)
// unstage the selected line
t.Views().StagingSecondary().
IsFocused().
PressPrimaryAction().
Tap(func() {
// the line should have been moved to the main view
t.Views().Staging().Content(Contains("+myfile content").DoesNotContain("+with a second line"))
}).
Content(DoesNotContain("+myfile content").Contains("+with a second line")).
Press(keys.Files.CommitChangesWithoutHook)
commitMessage := "my commit message"
t.ExpectPopup().CommitMessagePanel().Type(commitMessage).Confirm()
t.Views().Commits().
Lines(
Contains(commitMessage),
)
t.Views().StagingSecondary().
IsEmpty()
t.Views().Staging().
IsFocused().
Content(Contains("+myfile content")).
Content(DoesNotContain("+with a second line"))
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/commit/create_amend_commit.go | pkg/integration/tests/commit/create_amend_commit.go | package commit
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var CreateAmendCommit = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Create an amend commit for an existing commit",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.
CreateNCommits(3).
CreateFileAndAdd("fixup-file", "fixup content")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Commits().
Focus().
Lines(
Contains("commit 03"),
Contains("commit 02"),
Contains("commit 01"),
).
NavigateToLine(Contains("commit 02")).
Press(keys.Commits.CreateFixupCommit).
Tap(func() {
t.ExpectPopup().Menu().
Title(Equals("Create fixup commit")).
Select(Contains("amend! commit with changes")).
Confirm()
t.ExpectPopup().CommitMessagePanel().
Content(Equals("commit 02")).
Type(" amended").Confirm()
}).
Lines(
Contains("amend! commit 02"),
Contains("commit 03"),
Contains("commit 02").IsSelected(),
Contains("commit 01"),
)
t.Views().Commits().
Press(keys.Commits.SquashAboveCommits).
Tap(func() {
t.ExpectPopup().Menu().
Title(Equals("Apply fixup commits")).
Select(Contains("Above the selected commit")).
Confirm()
}).
Lines(
Contains("commit 03"),
Contains("commit 02 amended").IsSelected(),
Contains("commit 01"),
)
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/commit/discard_old_file_changes.go | pkg/integration/tests/commit/discard_old_file_changes.go | package commit
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var DiscardOldFileChanges = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Discarding a range of files from an old commit.",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.CreateFileAndAdd("dir1/d1_file0", "file0\n")
shell.CreateFileAndAdd("dir1/subd1/subfile0", "file1\n")
shell.CreateFileAndAdd("dir2/d2_file1", "d2f1 content\n")
shell.CreateFileAndAdd("dir2/d2_file2", "d2f4 content\n")
shell.Commit("remove one file from this commit")
shell.UpdateFileAndAdd("dir2/d2_file1", "d2f1 content\nsecond line\n")
shell.DeleteFileAndAdd("dir2/d2_file2")
shell.CreateFileAndAdd("dir2/d2_file3", "d2f3 content\n")
shell.CreateFileAndAdd("dir2/d2_file4", "d2f2 content\n")
shell.Commit("remove four files from this commit")
shell.CreateFileAndAdd("dir1/fileToRemove", "file to remove content\n")
shell.CreateFileAndAdd("dir1/multiLineFile", "this file has\ncontent on\nthree lines\n")
shell.CreateFileAndAdd("dir1/subd1/file2ToRemove", "file2 to remove content\n")
shell.Commit("remove changes in multiple dirs from this commit")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Commits().
Focus().
Lines(
Contains("remove changes in multiple dirs from this commit").IsSelected(),
Contains("remove four files from this commit"),
Contains("remove one file from this commit"),
).
NavigateToLine(Contains("remove one file from this commit")).
PressEnter()
// Check removing a single file from an old commit
t.Views().CommitFiles().
IsFocused().
Lines(
Equals("▼ /").IsSelected(),
Equals(" ▼ dir1"),
Equals(" ▼ subd1"),
Equals(" A subfile0"),
Equals(" A d1_file0"),
Equals(" ▼ dir2"),
Equals(" A d2_file1"),
Equals(" A d2_file2"),
).
NavigateToLine(Contains("d1_file0")).
Press(keys.Universal.Remove)
t.ExpectPopup().Confirmation().
Title(Equals("Discard file changes")).
Content(Equals("Are you sure you want to remove changes to the selected file(s) from this commit?\n\nThis action will start a rebase, reverting these file changes. Be aware that if subsequent commits depend on these changes, you may need to resolve conflicts.\nNote: This will also reset any active custom patches.")).
Confirm()
t.Views().CommitFiles().
IsFocused().
Lines(
Equals("▼ /"),
Equals(" ▼ dir1/subd1"),
Equals(" A subfile0"),
Equals(" ▼ dir2"),
Equals(" A d2_file1").IsSelected(),
Equals(" A d2_file2"),
).
PressEscape()
// Check removing 4 files in the same directory
t.Views().Commits().
Focus().
Lines(
Contains("remove changes in multiple dirs from this commit"),
Contains("remove four files from this commit"),
Contains("remove one file from this commit").IsSelected(),
).
NavigateToLine(Contains("remove four files from this commit")).
PressEnter()
t.Views().CommitFiles().
IsFocused().
Lines(
Equals("▼ dir2").IsSelected(),
Equals(" M d2_file1"),
Equals(" D d2_file2"),
Equals(" A d2_file3"),
Equals(" A d2_file4"),
).
NavigateToLine(Contains("d2_file1")).
Press(keys.Universal.ToggleRangeSelect).
NavigateToLine(Contains("d2_file4")).
Press(keys.Universal.Remove)
t.ExpectPopup().Confirmation().
Title(Equals("Discard file changes")).
Content(Equals("Are you sure you want to remove changes to the selected file(s) from this commit?\n\nThis action will start a rebase, reverting these file changes. Be aware that if subsequent commits depend on these changes, you may need to resolve conflicts.\nNote: This will also reset any active custom patches.")).
Confirm()
t.Views().CommitFiles().
IsFocused().
Lines(
Contains("(none)"),
).
PressEscape()
// Check removing multiple files from 2 directories w/ a custom patch.
// This checks node selection logic & if the custom patch is getting reset.
t.Views().Commits().
IsFocused().
Lines(
Contains("remove changes in multiple dirs from this commit"),
Contains("remove four files from this commit").IsSelected(),
Contains("remove one file from this commit"),
).
NavigateToLine(Contains("remove changes in multiple dirs from this commit")).
PressEnter()
t.Views().CommitFiles().
IsFocused().
Lines(
Equals("▼ dir1").IsSelected(),
Equals(" ▼ subd1"),
Equals(" A file2ToRemove"),
Equals(" A fileToRemove"),
Equals(" A multiLineFile"),
).
NavigateToLine(Contains("multiLineFile")).
PressEnter()
t.Views().PatchBuilding().
IsFocused().
SelectedLine(
Contains("+this file has"),
).
PressPrimaryAction().
PressEscape()
t.Views().CommitFiles().
IsFocused().
Lines(
Equals("▼ dir1"),
Equals(" ▼ subd1"),
Equals(" A file2ToRemove"),
Equals(" A fileToRemove"),
Equals(" ◐ multiLineFile").IsSelected(),
).
NavigateToLine(Contains("dir1")).
Press(keys.Universal.ToggleRangeSelect).
NavigateToLine(Contains("subd1")).
Press(keys.Universal.Remove)
t.ExpectPopup().Confirmation().
Title(Equals("Discard file changes")).
Content(Equals("Are you sure you want to remove changes to the selected file(s) from this commit?\n\nThis action will start a rebase, reverting these file changes. Be aware that if subsequent commits depend on these changes, you may need to resolve conflicts.\nNote: This will also reset any active custom patches.")).
Confirm()
// "Building patch" will still be in this view if the patch isn't reset properly
t.Views().Information().Content(DoesNotContain("Building patch"))
t.Views().CommitFiles().
IsFocused().
Lines(
Contains("(none)"),
)
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/commit/reword.go | pkg/integration/tests/commit/reword.go | package commit
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var Reword = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Staging a couple files and committing",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.CreateFile("myfile", "myfile content")
shell.CreateFile("myfile2", "myfile2 content")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Commits().
IsEmpty()
t.Views().Files().
IsFocused().
Lines(
Equals("▼ /").IsSelected(),
Contains("myfile"),
Contains("myfile2"),
).
SelectNextItem().
PressPrimaryAction().
Press(keys.Files.CommitChanges)
commitMessage := "my commit message"
t.ExpectPopup().CommitMessagePanel().Type(commitMessage).Confirm()
t.Views().Commits().
Lines(
Contains(commitMessage),
)
t.Views().Files().
IsFocused().
PressPrimaryAction().
Press(keys.Files.CommitChanges)
wipCommitMessage := "my commit message wip"
t.ExpectPopup().CommitMessagePanel().Type(wipCommitMessage).Close()
t.Views().Commits().Focus().
Lines(
Contains(commitMessage),
).Press(keys.Commits.RenameCommit)
t.ExpectPopup().CommitMessagePanel().
SwitchToDescription().
Type("some description").
SwitchToSummary().
Confirm()
t.Views().Main().Content(MatchesRegexp("my commit message\n\\s*some description"))
t.Views().Files().
Focus().
Press(keys.Files.CommitChanges)
t.ExpectPopup().CommitMessagePanel().Confirm()
t.Views().Commits().
Lines(
Contains(wipCommitMessage),
Contains(commitMessage),
)
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/commit/paste_commit_message.go | pkg/integration/tests/commit/paste_commit_message.go | package commit
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var PasteCommitMessage = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Paste a commit message into the commit message panel",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {
config.GetUserConfig().OS.CopyToClipboardCmd = "printf '%s' {{text}} > ../clipboard"
config.GetUserConfig().OS.ReadFromClipboardCmd = "cat ../clipboard"
},
SetupRepo: func(shell *Shell) {
shell.EmptyCommit("subject\n\nbody 1st line\nbody 2nd line")
shell.CreateFileAndAdd("file", "file content")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Commits().
Focus().
ContainsLines(
Contains("subject").IsSelected(),
).
Press(keys.Commits.CopyCommitAttributeToClipboard)
t.ExpectPopup().Menu().Title(Equals("Copy to clipboard")).
Select(Contains("Commit message (subject and body)")).Confirm()
t.ExpectToast(Equals("Commit message copied to clipboard"))
t.Views().Files().
Focus().
Press(keys.Files.CommitChanges)
t.ExpectPopup().CommitMessagePanel().
OpenCommitMenu()
t.ExpectPopup().Menu().Title(Equals("Commit Menu")).
Select(Contains("Paste commit message from clipboard")).
Confirm()
t.ExpectPopup().CommitMessagePanel().
Content(Equals("subject")).
SwitchToDescription().
Content(Equals("body 1st line\nbody 2nd line"))
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/commit/amend_when_there_are_conflicts_and_continue.go | pkg/integration/tests/commit/amend_when_there_are_conflicts_and_continue.go | package commit
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var AmendWhenThereAreConflictsAndContinue = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Amends the last commit from the files panel while a rebase is stopped due to conflicts, and continues the rebase",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
setupForAmendTests(shell)
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
doTheRebaseForAmendTests(t, keys)
t.Views().Files().
Press(keys.Commits.AmendToCommit)
t.ExpectPopup().Menu().
Title(Equals("Amend commit")).
Select(Equals("No, continue rebase")).
Confirm()
t.Views().Files().IsEmpty()
t.Views().Commits().
Focus().
Lines(
Contains("commit three"),
Contains("file1 changed in branch"),
Contains("commit two"),
Contains("file1 changed in master"),
Contains("base commit"),
)
checkCommitContainsChange(t, "file1 changed in branch", "+branch")
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/commit/new_branch.go | pkg/integration/tests/commit/new_branch.go | package commit
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var NewBranch = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Creating a new branch from a commit",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.
EmptyCommit("commit 1").
EmptyCommit("commit 2").
EmptyCommit("commit 3")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Commits().
Focus().
Lines(
Contains("commit 3").IsSelected(),
Contains("commit 2"),
Contains("commit 1"),
).
SelectNextItem().
Press(keys.Universal.New).
Tap(func() {
branchName := "my-branch-name"
t.ExpectPopup().Prompt().Title(Contains("New branch name")).Type(branchName).Confirm()
t.Git().CurrentBranchName(branchName)
}).
Lines(
Contains("commit 2"),
Contains("commit 1"),
)
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/commit/amend_when_there_are_conflicts_and_cancel.go | pkg/integration/tests/commit/amend_when_there_are_conflicts_and_cancel.go | package commit
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var AmendWhenThereAreConflictsAndCancel = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Amends the last commit from the files panel while a rebase is stopped due to conflicts, and cancels the confirmation",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
setupForAmendTests(shell)
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
doTheRebaseForAmendTests(t, keys)
t.Views().Files().
Press(keys.Commits.AmendToCommit)
t.ExpectPopup().Menu().
Title(Equals("Amend commit")).
Select(Equals("Cancel")).
Confirm()
// Check that nothing happened:
t.Views().Files().
Lines(
Contains("M file1"),
)
t.Views().Commits().
Focus().
Lines(
Contains("--- Pending rebase todos ---"),
Contains("pick").Contains("commit three"),
Contains("pick").Contains("<-- CONFLICT --- file1 changed in branch"),
Contains("--- Commits ---"),
Contains("commit two"),
Contains("file1 changed in master"),
Contains("base commit"),
)
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/commit/create_tag.go | pkg/integration/tests/commit/create_tag.go | package commit
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var CreateTag = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Create a new tag on a commit",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.EmptyCommit("one")
shell.EmptyCommit("two")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Commits().
Focus().
Lines(
Contains("two").IsSelected(),
Contains("one"),
).
Press(keys.Commits.CreateTag)
t.ExpectPopup().CommitMessagePanel().
Title(Equals("Tag name")).
Type("new-tag").
Confirm()
t.Views().Commits().
Lines(
MatchesRegexp(`new-tag.*two`).IsSelected(),
MatchesRegexp(`one`),
)
t.Views().Tags().
Focus().
Lines(
MatchesRegexp(`new-tag.*two`).IsSelected(),
)
t.Git().
TagNamesAt("HEAD", []string{"new-tag"})
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/commit/commit_skip_hooks.go | pkg/integration/tests/commit/commit_skip_hooks.go | package commit
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var blockingHook = `#!/bin/bash
# For this test all we need is a hook that always fails
exit 1
`
var CommitSkipHooks = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Commit with skip hook using CommitChangesWithoutHook",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.CreateFile(".git/hooks/pre-commit", blockingHook)
shell.MakeExecutable(".git/hooks/pre-commit")
shell.CreateFile("file.txt", "content")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
checkBlockingHook(t, keys)
t.Views().Files().
IsFocused().
PressPrimaryAction().
Lines(
Equals("A file.txt"),
).
Press(keys.Files.CommitChangesWithoutHook)
t.ExpectPopup().CommitMessagePanel().
Title(Equals("Commit summary")).
Type("foo bar").
Confirm()
t.Views().Commits().Focus()
t.Views().Main().Content(Contains("foo bar"))
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/commit/checkout.go | pkg/integration/tests/commit/checkout.go | package commit
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var Checkout = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Checkout a commit as a detached head, or checkout an existing branch at a commit",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {
config.GetUserConfig().Git.LocalBranchSortOrder = "alphabetical"
},
SetupRepo: func(shell *Shell) {
shell.EmptyCommit("one")
shell.EmptyCommit("two")
shell.NewBranch("branch1")
shell.NewBranch("branch2")
shell.EmptyCommit("three")
shell.EmptyCommit("four")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Commits().
Focus().
Lines(
Contains("four").IsSelected(),
Contains("three"),
Contains("two"),
Contains("one"),
).
PressPrimaryAction()
t.ExpectPopup().Menu().
Title(Contains("Checkout branch or commit")).
Lines(
MatchesRegexp("Checkout commit [a-f0-9]+ as detached head").IsSelected(),
Contains("Checkout branch"),
Contains("Cancel"),
).
Select(Contains("Checkout branch")).
Tooltip(Contains("Disabled: No branches found at selected commit.")).
Select(MatchesRegexp("Checkout commit [a-f0-9]+ as detached head")).
Confirm()
t.Views().Branches().
IsFocused().
Lines(
Contains("* (HEAD detached at").IsSelected(),
Contains("branch1"),
Contains("branch2"),
Contains("master"),
)
t.Views().Commits().
Focus().
NavigateToLine(Contains("two")).
PressPrimaryAction()
t.ExpectPopup().Menu().
Title(Contains("Checkout branch or commit")).
Lines(
MatchesRegexp("Checkout commit [a-f0-9]+ as detached head").IsSelected(),
Contains("Checkout branch 'branch1'"),
Contains("Checkout branch 'master'"),
Contains("Cancel"),
).
Select(Contains("Checkout branch 'master'")).
Confirm()
t.Views().Branches().
IsFocused().
Lines(
Contains("master").IsSelected(),
Contains("branch1"),
Contains("branch2"),
)
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/commit/disable_copy_commit_message_body.go | pkg/integration/tests/commit/disable_copy_commit_message_body.go | package commit
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var DisableCopyCommitMessageBody = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Disables copy commit message body when there is no body",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.EmptyCommit("commit")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Commits().
Focus().
Lines(
Contains("commit").IsSelected(),
).
Press(keys.Commits.CopyCommitAttributeToClipboard)
t.ExpectPopup().Menu().
Title(Equals("Copy to clipboard")).
Select(Contains("Commit message body")).
Confirm()
t.ExpectToast(Equals("Disabled: Commit has no message body"))
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/commit/do_not_show_branch_marker_for_head_commit.go | pkg/integration/tests/commit/do_not_show_branch_marker_for_head_commit.go | package commit
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var DoNotShowBranchMarkerForHeadCommit = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Verify that no branch heads are shown for the branch head if there is a tag with the same name as the branch",
ExtraCmdArgs: []string{},
Skip: false,
GitVersion: AtLeast("2.38.0"),
SetupConfig: func(config *config.AppConfig) {
config.GetUserConfig().Git.Log.ShowGraph = "never"
},
SetupRepo: func(shell *Shell) {
shell.EmptyCommit("one")
shell.NewBranch("branch1")
shell.EmptyCommit("two")
shell.EmptyCommit("three")
shell.CreateLightweightTag("branch1", "master")
shell.SetConfig("rebase.updateRefs", "true")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
// Check that the local commits view does show a branch marker for the head commit
t.Views().Commits().
Lines(
Contains("CI three"),
Contains("CI two"),
Contains("CI branch1 one"),
)
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/commit/amend_when_there_are_conflicts_and_amend.go | pkg/integration/tests/commit/amend_when_there_are_conflicts_and_amend.go | package commit
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var AmendWhenThereAreConflictsAndAmend = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Amends the last commit from the files panel while a rebase is stopped due to conflicts, and amends the commit",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
setupForAmendTests(shell)
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
doTheRebaseForAmendTests(t, keys)
t.Views().Files().
Press(keys.Commits.AmendToCommit)
t.ExpectPopup().Menu().
Title(Equals("Amend commit")).
Select(Equals("Yes, amend previous commit")).
Confirm()
t.Views().Files().IsEmpty()
t.Views().Commits().
Focus().
Lines(
Contains("--- Pending rebase todos ---"),
Contains("pick").Contains("commit three"),
Contains("pick").Contains("<-- CONFLICT --- file1 changed in branch"),
Contains("--- Commits ---"),
Contains("commit two"),
Contains("file1 changed in master"),
Contains("base commit"),
)
checkCommitContainsChange(t, "commit two", "+branch")
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/commit/history_complex.go | pkg/integration/tests/commit/history_complex.go | package commit
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var HistoryComplex = NewIntegrationTest(NewIntegrationTestArgs{
Description: "More complex flow for cycling commit message history",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.EmptyCommit("initial commit")
shell.EmptyCommit("commit 2")
shell.EmptyCommit("commit 3")
shell.CreateFileAndAdd("myfile", "myfile content")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
// We're going to start a new commit message,
// then leave and try to reword a commit, then
// come back to original message and confirm we haven't lost our message.
// This shows that we're storing the preserved message for a new commit separately
// to the message when cycling history.
t.Views().Files().
IsFocused().
Press(keys.Files.CommitChanges)
t.ExpectPopup().CommitMessagePanel().
InitialText(Equals("")).
Type("my commit message").
Cancel()
t.Views().Commits().
Focus().
SelectedLine(Contains("commit 3")).
Press(keys.Commits.RenameCommit)
t.ExpectPopup().CommitMessagePanel().
InitialText(Equals("commit 3")).
SelectNextMessage().
Content(Equals("")).
Type("reworded message").
SelectPreviousMessage().
Content(Equals("commit 3")).
SelectNextMessage().
Content(Equals("reworded message")).
Cancel()
t.Views().Files().
Focus().
Press(keys.Files.CommitChanges)
t.ExpectPopup().CommitMessagePanel().
InitialText(Equals("my commit message"))
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/commit/checkout_file_from_range_selection_of_commits.go | pkg/integration/tests/commit/checkout_file_from_range_selection_of_commits.go | package commit
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var CheckoutFileFromRangeSelectionOfCommits = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Checkout a file from a range selection of commits",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.CreateFileAndAdd("file.txt", "one\n")
shell.Commit("one")
shell.CreateFileAndAdd("file.txt", "two\n")
shell.Commit("two")
shell.CreateFileAndAdd("file.txt", "three\n")
shell.Commit("three")
shell.CreateFileAndAdd("file.txt", "four\n")
shell.Commit("four")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Commits().
Focus().
Lines(
Contains("four").IsSelected(),
Contains("three"),
Contains("two"),
Contains("one"),
).
NavigateToLine(Contains("three")).
Press(keys.Universal.RangeSelectDown).
Tap(func() {
t.Views().Main().ContainsLines(
Contains("-one"),
Contains("+three"),
)
}).
PressEnter()
t.Views().CommitFiles().
IsFocused().
Lines(
Equals("M file.txt"),
).
Press(keys.CommitFiles.CheckoutCommitFile)
t.Views().Files().
Lines(
Equals("M file.txt"),
)
t.FileSystem().FileContent("file.txt", Equals("three\n"))
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/commit/find_base_commit_for_fixup_warning_for_added_lines.go | pkg/integration/tests/commit/find_base_commit_for_fixup_warning_for_added_lines.go | package commit
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var FindBaseCommitForFixupWarningForAddedLines = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Finds the base commit to create a fixup for, and warns that there are hunks with only added lines",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.NewBranch("mybranch").
EmptyCommit("1st commit").
CreateFileAndAdd("file1", "file1 content\n").
Commit("2nd commit").
CreateFileAndAdd("file2", "file2 content\n").
Commit("3rd commit").
UpdateFile("file1", "file1 changed content").
UpdateFile("file2", "file2 content\nadded content")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Commits().
Lines(
Contains("3rd commit").IsSelected(),
Contains("2nd commit"),
Contains("1st commit"),
)
t.Views().Files().
Focus().
Press(keys.Files.FindBaseCommitForFixup)
t.ExpectPopup().Confirmation().
Title(Equals("Find base commit for fixup")).
Content(Contains("There are ranges of only added lines in the diff; be careful to check that these belong in the found base commit.")).
Confirm()
t.Views().Commits().
IsFocused().
Lines(
Contains("3rd commit"),
Contains("2nd commit").IsSelected(),
Contains("1st commit"),
)
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/commit/commit_switch_to_editor_skip_hooks.go | pkg/integration/tests/commit/commit_switch_to_editor_skip_hooks.go | package commit
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var CommitSwitchToEditorSkipHooks = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Commit, then switch from built-in commit message panel to editor",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.CreateFile(".git/hooks/pre-commit", blockingHook)
shell.MakeExecutable(".git/hooks/pre-commit")
shell.CreateFile("file1", "file1 content")
shell.CreateFile("file2", "file2 content")
// Set an editor that appends a line to the existing message. Since
// git adds all this "# Please enter the commit message for your changes"
// stuff, this will result in an extra blank line before the added line.
shell.SetConfig("core.editor", "sh -c 'echo third line >>.git/COMMIT_EDITMSG'")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Commits().
IsEmpty()
checkBlockingHook(t, keys)
t.Views().Files().
IsFocused().
Lines(
Equals("▼ /").IsSelected(),
Equals(" ?? file1"),
Equals(" ?? file2"),
).
SelectNextItem().
PressPrimaryAction(). // stage one of the files
Press(keys.Files.CommitChangesWithoutHook)
t.ExpectPopup().CommitMessagePanel().
Type("first line").
SwitchToDescription().
Type("second line").
SwitchToSummary().
SwitchToEditor()
t.Views().Commits().
Lines(
Contains("first line"),
)
t.Views().Commits().Focus()
t.Views().Main().Content(MatchesRegexp(`first line\n\s*\n\s*second line\n\s*\n\s*third line`))
// Now check that the preserved commit message was cleared:
t.Views().Files().
Focus().
PressPrimaryAction(). // stage the other file
Press(keys.Files.CommitChanges)
t.ExpectPopup().CommitMessagePanel().
InitialText(Equals(""))
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/commit/fail_hooks_then_commit_no_hooks.go | pkg/integration/tests/commit/fail_hooks_then_commit_no_hooks.go | package commit
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var FailHooksThenCommitNoHooks = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Verify that commit message can be reused in commit without hook after failing commit with hooks",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {
},
SetupRepo: func(shell *Shell) {
shell.CreateFile(".git/hooks/pre-commit", blockingHook)
shell.MakeExecutable(".git/hooks/pre-commit")
shell.CreateFileAndAdd("one", "one")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Files().
IsFocused().
Lines(
Contains("one"),
).
Press(keys.Files.CommitChanges).
Tap(func() {
t.ExpectPopup().CommitMessagePanel().Type("my message").Confirm()
t.ExpectPopup().Alert().Title(Equals("Error")).Content(Contains("Git command failed")).Confirm()
}).
Press(keys.Files.CommitChangesWithoutHook).
Tap(func() {
t.ExpectPopup().CommitMessagePanel().
InitialText(Equals("my message")). // it remembered the commit message
Confirm()
t.Views().Commits().
Lines(
Contains("my message"),
)
})
t.Views().Commits().Focus()
t.Views().Main().Content(Contains("my message"))
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/commit/staged.go | pkg/integration/tests/commit/staged.go | package commit
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var Staged = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Staging a couple files, going in the staged files menu, unstaging a line then committing",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.
CreateFile("myfile", "myfile content\nwith a second line").
CreateFile("myfile2", "myfile2 content")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Commits().
IsEmpty()
t.Views().Files().
IsFocused().
Lines(
Equals("▼ /").IsSelected(),
Contains("myfile"),
Contains("myfile2"),
).
SelectNextItem().
PressPrimaryAction(). // stage the file
PressEnter()
t.Views().StagingSecondary().
IsFocused().
Tap(func() {
// we start with both lines having been staged
t.Views().StagingSecondary().Content(Contains("+myfile content"))
t.Views().StagingSecondary().Content(Contains("+with a second line"))
t.Views().Staging().Content(DoesNotContain("+myfile content"))
t.Views().Staging().Content(DoesNotContain("+with a second line"))
}).
// unstage the selected line
PressPrimaryAction().
Tap(func() {
// the line should have been moved to the main view
t.Views().StagingSecondary().Content(DoesNotContain("+myfile content"))
t.Views().StagingSecondary().Content(Contains("+with a second line"))
t.Views().Staging().Content(Contains("+myfile content"))
t.Views().Staging().Content(DoesNotContain("+with a second line"))
}).
Press(keys.Files.CommitChanges)
commitMessage := "my commit message"
t.ExpectPopup().CommitMessagePanel().Type(commitMessage).Confirm()
t.Views().Commits().
Lines(
Contains(commitMessage),
)
t.Views().StagingSecondary().
IsEmpty()
t.Views().Staging().
IsFocused().
Content(Contains("+myfile content")).
Content(DoesNotContain("+with a second line"))
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/commit/commit_with_global_prefix.go | pkg/integration/tests/commit/commit_with_global_prefix.go | package commit
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var CommitWithGlobalPrefix = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Commit with defined config commitPrefix",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(cfg *config.AppConfig) {
cfg.GetUserConfig().Git.CommitPrefix = []config.CommitPrefixConfig{{Pattern: "^\\w+\\/(\\w+-\\w+).*", Replace: "[$1]: "}}
},
SetupRepo: func(shell *Shell) {
shell.NewBranch("feature/TEST-001")
shell.CreateFile("test-commit-prefix", "This is foo bar")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Commits().
IsEmpty()
t.Views().Files().
IsFocused().
PressPrimaryAction().
Press(keys.Files.CommitChanges)
t.ExpectPopup().CommitMessagePanel().
Title(Equals("Commit summary")).
InitialText(Equals("[TEST-001]: ")).
Type("my commit message").
Cancel()
t.Views().Files().
IsFocused().
Press(keys.Files.CommitChanges)
t.ExpectPopup().CommitMessagePanel().
Title(Equals("Commit summary")).
InitialText(Equals("[TEST-001]: my commit message")).
Type(". Added something else").
Confirm()
t.Views().Commits().Focus()
t.Views().Main().Content(Contains("[TEST-001]: my commit message. Added something else"))
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/commit/copy_message_body_to_clipboard.go | pkg/integration/tests/commit/copy_message_body_to_clipboard.go | package commit
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
// We're emulating the clipboard by writing to a file called clipboard
var CopyMessageBodyToClipboard = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Copy a commit message body to the clipboard",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {
config.GetUserConfig().OS.CopyToClipboardCmd = "printf '%s' {{text}} > clipboard"
},
SetupRepo: func(shell *Shell) {
shell.EmptyCommitWithBody("My Subject", "My awesome commit message body")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Commits().
Focus().
Lines(
Contains("My Subject").IsSelected(),
).
Press(keys.Commits.CopyCommitAttributeToClipboard)
t.ExpectPopup().Menu().
Title(Equals("Copy to clipboard")).
Select(Contains("Commit message body")).
Confirm()
t.ExpectToast(Equals("Commit message body copied to clipboard"))
t.FileSystem().FileContent("clipboard", Equals("My awesome commit message body"))
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/commit/commit_wip_with_prefix.go | pkg/integration/tests/commit/commit_wip_with_prefix.go | package commit
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var CommitWipWithPrefix = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Commit with skip hook and config commitPrefix is defined. Prefix is ignored when creating WIP commits.",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(cfg *config.AppConfig) {
cfg.GetUserConfig().Git.CommitPrefixes = map[string][]config.CommitPrefixConfig{"repo": {{Pattern: "^\\w+\\/(\\w+-\\w+).*", Replace: "[$1]: "}}}
},
SetupRepo: func(shell *Shell) {
shell.CreateFile(".git/hooks/pre-commit", blockingHook)
shell.MakeExecutable(".git/hooks/pre-commit")
shell.NewBranch("feature/TEST-002")
shell.CreateFile("test-wip-commit-prefix", "This is foo bar")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Commits().
IsEmpty()
checkBlockingHook(t, keys)
t.Views().Files().
IsFocused().
PressPrimaryAction().
Press(keys.Files.CommitChangesWithoutHook)
t.ExpectPopup().CommitMessagePanel().
Title(Equals("Commit summary")).
InitialText(Equals("WIP")).
Type(" foo").
Cancel()
t.Views().Files().
IsFocused().
Press(keys.Files.CommitChangesWithoutHook)
t.ExpectPopup().CommitMessagePanel().
Title(Equals("Commit summary")).
InitialText(Equals("WIP foo")).
Type(" bar").
Cancel()
t.Views().Files().
IsFocused().
Press(keys.Files.CommitChangesWithoutHook)
t.ExpectPopup().CommitMessagePanel().
Title(Equals("Commit summary")).
InitialText(Equals("WIP foo bar")).
Type(". Added something else").
Confirm()
t.Views().Commits().Focus()
t.Views().Main().Content(Contains("WIP foo bar. Added something else"))
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/commit/set_author.go | pkg/integration/tests/commit/set_author.go | package commit
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
// Originally we only suggested authors present in the current branch, but now
// we include authors from other branches whose commits you've looked at in the
// lazygit session.
var SetAuthor = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Set author on a commit",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.NewBranch("original")
shell.SetConfig("user.email", "Bill@example.com")
shell.SetConfig("user.name", "Bill Smith")
shell.EmptyCommit("one")
shell.NewBranch("other")
shell.SetConfig("user.email", "John@example.com")
shell.SetConfig("user.name", "John Smith")
shell.EmptyCommit("two")
shell.Checkout("original")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Commits().
Focus().
Lines(
Contains("BS").Contains("one").IsSelected(),
)
t.Views().Branches().
Focus().
Lines(
Contains("original").IsSelected(),
Contains("other"),
).
NavigateToLine(Contains("other")).
PressEnter()
// ensuring we get these commit authors as suggestions
t.Views().SubCommits().
IsFocused().
Lines(
Contains("JS").Contains("two").IsSelected(),
Contains("BS").Contains("one"),
)
t.Views().Commits().
Focus().
Press(keys.Commits.ResetCommitAuthor).
Tap(func() {
t.ExpectPopup().Menu().
Title(Equals("Amend commit attribute")).
Select(Contains(" Set author")). // adding space at start to distinguish from 'reset author'
Confirm()
t.ExpectPopup().Prompt().
Title(Contains("Set author")).
SuggestionLines(
Contains("Bill Smith"),
Contains("John Smith"),
).
ConfirmSuggestion(Contains("John Smith"))
}).
Lines(
Contains("JS").Contains("one").IsSelected(),
)
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/commit/add_co_author.go | pkg/integration/tests/commit/add_co_author.go | package commit
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var AddCoAuthor = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Add co-author on a commit",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.EmptyCommit("initial commit")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Commits().
Focus().
Lines(
Contains("initial commit").IsSelected(),
).
Press(keys.Commits.ResetCommitAuthor).
Tap(func() {
t.ExpectPopup().Menu().
Title(Equals("Amend commit attribute")).
Select(Contains("Add co-author")).
Confirm()
t.ExpectPopup().Prompt().
Title(Contains("Add co-author")).
Type("John Smith <jsmith@gmail.com>").
Confirm()
})
t.Views().Main().ContainsLines(
Equals(" initial commit"),
Equals(" "),
Equals(" Co-authored-by: John Smith <jsmith@gmail.com>"),
)
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/commit/checkout_file_from_commit.go | pkg/integration/tests/commit/checkout_file_from_commit.go | package commit
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var CheckoutFileFromCommit = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Checkout a file from a commit",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.CreateFileAndAdd("file.txt", "one\n")
shell.Commit("one")
shell.CreateFileAndAdd("file.txt", "two\n")
shell.Commit("two")
shell.CreateFileAndAdd("file.txt", "three\n")
shell.Commit("three")
shell.CreateFileAndAdd("file.txt", "four\n")
shell.Commit("four")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Commits().
Focus().
Lines(
Contains("four").IsSelected(),
Contains("three"),
Contains("two"),
Contains("one"),
).
NavigateToLine(Contains("three")).
Tap(func() {
t.Views().Main().ContainsLines(
Contains("-two"),
Contains("+three"),
)
}).
PressEnter()
t.Views().CommitFiles().
IsFocused().
Lines(
Equals("M file.txt"),
).
Press(keys.CommitFiles.CheckoutCommitFile)
t.Views().Files().
Lines(
Equals("M file.txt"),
)
t.FileSystem().FileContent("file.txt", Equals("three\n"))
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/commit/auto_wrap_message.go | pkg/integration/tests/commit/auto_wrap_message.go | package commit
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var AutoWrapMessage = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Commit, and test how the commit message body is auto-wrapped",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {
// Use a ridiculously small width so that we don't have to use so much test data
config.GetUserConfig().Git.Commit.AutoWrapWidth = 20
},
SetupRepo: func(shell *Shell) {
shell.CreateFile("file", "file content")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Commits().
IsEmpty()
t.Views().Files().
IsFocused().
PressPrimaryAction(). // stage file
Press(keys.Files.CommitChanges)
t.ExpectPopup().CommitMessagePanel().
Type("subject").
SwitchToDescription().
Type("Lorem ipsum dolor sit amet, consectetur adipiscing elit.").
// See how it automatically inserted line feeds to wrap the text:
Content(Equals("Lorem ipsum dolor \nsit amet, \nconsectetur \nadipiscing elit.")).
SwitchToSummary().
Confirm()
t.Views().Commits().
Lines(
Contains("subject"),
).
Focus().
Tap(func() {
t.Views().Main().Content(Contains(
"subject\n \n Lorem ipsum dolor\n sit amet,\n consectetur\n adipiscing elit."))
}).
Press(keys.Commits.RenameCommit)
// Test that when rewording, the hard line breaks are turned back into
// soft ones, so that we can insert text at the beginning and have the
// paragraph reflow nicely.
t.ExpectPopup().CommitMessagePanel().
InitialText(Equals("subject")).
SwitchToDescription().
Content(Equals("Lorem ipsum dolor \nsit amet, \nconsectetur \nadipiscing elit.")).
GoToBeginning().
Type("More text. ").
Content(Equals("More text. Lorem \nipsum dolor sit \namet, consectetur \nadipiscing elit."))
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/commit/stage_range_of_lines.go | pkg/integration/tests/commit/stage_range_of_lines.go | package commit
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var StageRangeOfLines = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Staging a range of lines",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {
config.GetUserConfig().Gui.UseHunkModeInStagingView = false
},
SetupRepo: func(shell *Shell) {
shell.CreateFileAndAdd("myfile", "1st\n2nd\n3rd\n4th\n5th\n6th\n")
shell.Commit("Add file")
shell.UpdateFile("myfile", "1st changed\n2nd changed\n3rd\n4th\n5th changed\n6th\n")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Files().
IsFocused().
PressEnter()
t.Views().Staging().
Content(
Contains("-1st\n-2nd\n+1st changed\n+2nd changed\n 3rd\n 4th\n-5th\n+5th changed\n 6th"),
).
SelectedLine(Equals("-1st")).
Press(keys.Universal.ToggleRangeSelect).
SelectNextItem().
SelectNextItem().
SelectNextItem().
SelectNextItem().
PressPrimaryAction().
Content(
Contains(" 3rd\n 4th\n-5th\n+5th changed\n 6th"),
).
SelectedLine(Equals("-5th"))
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/commit/reset_author.go | pkg/integration/tests/commit/reset_author.go | package commit
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var ResetAuthor = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Reset author on a commit",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.SetConfig("user.email", "Bill@example.com")
shell.SetConfig("user.name", "Bill Smith")
shell.EmptyCommit("one")
shell.SetConfig("user.email", "John@example.com")
shell.SetConfig("user.name", "John Smith")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Commits().
Focus().
Lines(
Contains("BS").Contains("one").IsSelected(),
).
Press(keys.Commits.ResetCommitAuthor).
Tap(func() {
t.ExpectPopup().Menu().
Title(Equals("Amend commit attribute")).
Select(Contains("Reset author")).
Confirm()
}).
Lines(
Contains("JS").Contains("one").IsSelected(),
)
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/status/log_cmd_status_panel_all_branches_log.go | pkg/integration/tests/status/log_cmd_status_panel_all_branches_log.go | package status
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var LogCmdStatusPanelAllBranchesLog = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Cycle between two different log commands in the Status view when it has status panel AllBranchesLog",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {
config.GetUserConfig().Git.AllBranchesLogCmds = []string{`echo "view1"`, `echo "view2"`}
config.GetUserConfig().Gui.StatusPanelView = "allBranchesLog"
},
SetupRepo: func(shell *Shell) {},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Status().
Focus()
t.Views().Main().Content(Contains("view1"))
// We head to the branches view and return
t.Views().Branches().
Focus()
t.Views().Status().
Focus()
t.Views().Main().Content(Contains("view1").DoesNotContain("view2"))
t.Views().Status().
Press(keys.Status.AllBranchesLogGraph)
t.Views().Main().Content(Contains("view2").DoesNotContain("view1"))
t.Views().Status().
Press(keys.Status.AllBranchesLogGraph)
t.Views().Main().Content(Contains("view1").DoesNotContain("view2"))
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/status/log_cmd.go | pkg/integration/tests/status/log_cmd.go | package status
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var LogCmd = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Cycle between two different log commands in the Status view",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {
config.GetUserConfig().Git.AllBranchesLogCmds = []string{`echo "view1"`, `echo "view2"`}
},
SetupRepo: func(shell *Shell) {},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Status().
Focus().
Press(keys.Status.AllBranchesLogGraph)
t.Views().Main().Content(Contains("view1"))
t.Views().Status().
Focus().
Press(keys.Status.AllBranchesLogGraph)
t.Views().Main().Content(Contains("view2").DoesNotContain("view1"))
t.Views().Status().
Focus().
Press(keys.Status.AllBranchesLogGraph)
t.Views().Main().Content(Contains("view1").DoesNotContain("view2"))
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/status/click_repo_name_to_open_repos_menu.go | pkg/integration/tests/status/click_repo_name_to_open_repos_menu.go | 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"))
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/status/click_working_tree_state_to_open_rebase_options_menu.go | pkg/integration/tests/status/click_working_tree_state_to_open_rebase_options_menu.go | 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"))
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/status/click_to_focus.go | pkg/integration/tests/status/click_to_focus.go | 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 `),
)
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/tag/reset.go | pkg/integration/tests/tag/reset.go | package tag
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var Reset = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Hard reset to a tag",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.EmptyCommit("one")
shell.EmptyCommit("two")
shell.CreateLightweightTag("tag", "HEAD^") // creating tag on commit "one"
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Commits().Lines(
Contains("two"),
Contains("one"),
)
t.Views().Tags().
Focus().
Lines(
Contains("tag").IsSelected(),
).
Press(keys.Commits.ViewResetOptions)
t.ExpectPopup().Menu().
Title(Contains("Reset to tag")).
Select(Contains("Hard reset")).
Confirm()
t.Views().Commits().Lines(
Contains("one"),
)
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/tag/delete_remote_tag_when_branch_with_same_name_exists.go | pkg/integration/tests/tag/delete_remote_tag_when_branch_with_same_name_exists.go | package tag
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var DeleteRemoteTagWhenBranchWithSameNameExists = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Delete a remote tag when a remote branch with the same name exists",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.EmptyCommit("initial commit")
shell.CloneIntoRemote("origin")
shell.CreateLightweightTag("xyz", "HEAD")
shell.PushBranch("origin", "HEAD:refs/tags/xyz") // abusing PushBranch to push a tag
shell.PushBranch("origin", "HEAD:refs/heads/xyz")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Tags().
Focus().
Lines(
Contains("xyz").IsSelected(),
).
Press(keys.Universal.Remove)
t.ExpectPopup().
Menu().
Title(Equals("Delete tag 'xyz'?")).
Select(Contains("Delete remote tag")).
Confirm()
t.ExpectPopup().Prompt().
Title(Equals("Remote from which to remove tag 'xyz':")).
InitialText(Equals("origin")).
SuggestionLines(
Contains("origin"),
).
Confirm()
t.ExpectPopup().
Confirmation().
Title(Equals("Delete tag 'xyz'?")).
Content(Equals("Are you sure you want to delete the remote tag 'xyz' from 'origin'?")).
Confirm()
t.ExpectToast(Equals("Remote tag deleted"))
t.Shell().AssertRemoteTagNotFound("origin", "xyz")
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/tag/force_tag_lightweight.go | pkg/integration/tests/tag/force_tag_lightweight.go | package tag
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var ForceTagLightweight = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Overwrite a lightweight tag that already exists",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.EmptyCommit("first commit")
shell.CreateLightweightTag("new-tag", "HEAD")
shell.EmptyCommit("second commit")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Commits().
Focus().
Lines(
Contains("second commit").IsSelected(),
Contains("new-tag").Contains("first commit"),
).
Press(keys.Commits.CreateTag).
Tap(func() {
t.ExpectPopup().CommitMessagePanel().
Title(Equals("Tag name")).
Type("new-tag").
Confirm()
}).
Tap(func() {
t.ExpectPopup().Confirmation().
Title(Equals("Force Tag")).
Content(Contains("The tag 'new-tag' exists already. Press <esc> to cancel, or <enter> to overwrite.")).
Confirm()
}).
Lines(
Contains("new-tag").Contains("second commit"),
DoesNotContain("new-tag").Contains("first commit"),
)
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/tag/reset_to_duplicate_named_branch.go | pkg/integration/tests/tag/reset_to_duplicate_named_branch.go | package tag
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var ResetToDuplicateNamedBranch = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Hard reset to a tag when a branch shares the same name",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.NewBranch("current-branch")
shell.EmptyCommit("other-branch-tag commit")
shell.CreateLightweightTag("other-branch", "HEAD")
shell.EmptyCommit("other-branch commit")
shell.NewBranch("other-branch")
shell.Checkout("current-branch")
shell.EmptyCommit("current-branch commit")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Commits().Lines(
Contains("current-branch commit"),
Contains("other-branch commit"),
Contains("other-branch-tag commit"),
)
t.Views().Tags().
Focus().
Lines(
Contains("other-branch").IsSelected(),
).
Press(keys.Commits.ViewResetOptions)
t.ExpectPopup().Menu().
Title(Contains("Reset to other-branch")).
Select(Contains("Hard reset")).
Confirm()
t.Views().Commits().Lines(
Contains("other-branch-tag commit"),
)
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/tag/create_while_committing.go | pkg/integration/tests/tag/create_while_committing.go | package tag
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var CreateWhileCommitting = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Draft a commit message, escape out, and make a tag. Verify the draft message doesn't appear in the tag create prompt",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.EmptyCommit("initial commit")
shell.CreateFileAndAdd("file.txt", "file contents")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Files().
Press(keys.Files.CommitChanges).
Tap(func() {
t.ExpectPopup().CommitMessagePanel().
Title(Equals("Commit summary")).
Type("draft message").
Cancel()
})
t.Views().Tags().
Focus().
IsEmpty().
Press(keys.Universal.New).
Tap(func() {
t.ExpectPopup().CommitMessagePanel().
Title(Equals("Tag name")).
InitialText(Equals(""))
})
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/tag/crud_annotated.go | pkg/integration/tests/tag/crud_annotated.go | package tag
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var CrudAnnotated = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Create and delete an annotated tag in the tags panel",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.EmptyCommit("initial commit")
shell.CloneIntoRemote("origin")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Tags().
Focus().
IsEmpty().
Press(keys.Universal.New).
Tap(func() {
t.ExpectPopup().CommitMessagePanel().
Title(Equals("Tag name")).
Type("new-tag").
SwitchToDescription().
Title(Equals("Tag description")).
Type("message").
SwitchToSummary().
Confirm()
}).
Lines(
MatchesRegexp(`new-tag.*message`).IsSelected(),
).
Tap(func() {
t.Views().Main().ContainsLines(
Equals("Annotated tag: new-tag"),
Equals(""),
Contains("Tagger:"),
Contains("TaggerDate:"),
Equals(""),
Equals("message"),
Equals(""),
Equals("---"),
)
}).
Press(keys.Universal.Push).
Tap(func() {
t.ExpectPopup().Prompt().
Title(Equals("Remote to push tag 'new-tag' to:")).
InitialText(Equals("origin")).
SuggestionLines(
Contains("origin"),
).
Confirm()
}).
Press(keys.Universal.Remove).
Tap(func() {
t.ExpectPopup().
Menu().
Title(Equals("Delete tag 'new-tag'?")).
Select(Contains("Delete remote tag")).
Confirm()
}).
Tap(func() {
t.ExpectPopup().Prompt().
Title(Equals("Remote from which to remove tag 'new-tag':")).
InitialText(Equals("origin")).
SuggestionLines(
Contains("origin"),
).
Confirm()
}).
Tap(func() {
t.ExpectPopup().
Confirmation().
Title(Equals("Delete tag 'new-tag'?")).
Content(Equals("Are you sure you want to delete the remote tag 'new-tag' from 'origin'?")).
Confirm()
t.ExpectToast(Equals("Remote tag deleted"))
}).
Lines(
MatchesRegexp(`new-tag.*message`).IsSelected(),
).
Tap(func() {
t.Git().
RemoteTagDeleted("origin", "new-tag")
}).
Press(keys.Universal.Remove).
Tap(func() {
t.ExpectPopup().
Menu().
Title(Equals("Delete tag 'new-tag'?")).
Select(Contains("Delete local tag")).
Confirm()
}).
IsEmpty().
Press(keys.Universal.New).
Tap(func() {
// confirm content is cleared on next tag create
t.ExpectPopup().CommitMessagePanel().
Title(Equals("Tag name")).
InitialText(Equals(""))
})
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/tag/checkout.go | pkg/integration/tests/tag/checkout.go | package tag
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var Checkout = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Checkout a tag",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.EmptyCommit("one")
shell.EmptyCommit("two")
shell.CreateLightweightTag("tag", "HEAD^")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Tags().
Focus().
Lines(
Contains("tag").IsSelected(),
).
PressPrimaryAction() // checkout tag
t.Views().Branches().IsFocused().Lines(
Contains("HEAD detached at tag").IsSelected(),
Contains("master"),
)
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/tag/delete_local_and_remote.go | pkg/integration/tests/tag/delete_local_and_remote.go | package tag
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var DeleteLocalAndRemote = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Create and delete both local and remote annotated tag",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.EmptyCommit("initial commit")
shell.CloneIntoRemote("origin")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Tags().
Focus().
IsEmpty().
Press(keys.Universal.New).
Tap(func() {
t.ExpectPopup().CommitMessagePanel().
Title(Equals("Tag name")).
Type("new-tag").
SwitchToDescription().
Title(Equals("Tag description")).
Type("message").
SwitchToSummary().
Confirm()
}).
Lines(
MatchesRegexp(`new-tag.*message`).IsSelected(),
).
Press(keys.Universal.Push).
Tap(func() {
t.ExpectPopup().Prompt().
Title(Equals("Remote to push tag 'new-tag' to:")).
InitialText(Equals("origin")).
SuggestionLines(
Contains("origin"),
).
Confirm()
}).
Press(keys.Universal.Remove).
Tap(func() {
t.ExpectPopup().
Menu().
Title(Equals("Delete tag 'new-tag'?")).
Select(Contains("Delete local and remote tag")).
Confirm()
}).
Tap(func() {
t.ExpectPopup().Prompt().
Title(Equals("Remote from which to remove tag 'new-tag':")).
InitialText(Equals("origin")).
SuggestionLines(
Contains("origin"),
).
Confirm()
}).
Tap(func() {
t.ExpectPopup().
Confirmation().
Title(Equals("Delete tag 'new-tag'?")).
Content(Equals("Are you sure you want to delete 'new-tag' from both your machine and from 'origin'?")).
Confirm()
}).
IsEmpty().
Tap(func() {
t.Shell().AssertRemoteTagNotFound("origin", "new-tag")
})
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/tag/crud_lightweight.go | pkg/integration/tests/tag/crud_lightweight.go | package tag
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var CrudLightweight = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Create and delete a lightweight tag in the tags panel",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.EmptyCommit("initial commit")
shell.CloneIntoRemote("origin")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Tags().
Focus().
IsEmpty().
Press(keys.Universal.New).
Tap(func() {
t.ExpectPopup().CommitMessagePanel().
Title(Equals("Tag name")).
Type("new-tag").
Confirm()
}).
Lines(
MatchesRegexp(`new-tag.*initial commit`).IsSelected(),
).
Tap(func() {
t.Views().Main().ContainsLines(
Equals("Lightweight tag: new-tag"),
Equals(""),
Equals("---"),
)
}).
PressEnter().
Tap(func() {
// view the commits of the tag
t.Views().SubCommits().IsFocused().
Lines(
Contains("initial commit"),
).
PressEscape()
}).
Press(keys.Universal.Push).
Tap(func() {
t.ExpectPopup().Prompt().
Title(Equals("Remote to push tag 'new-tag' to:")).
InitialText(Equals("origin")).
SuggestionLines(
Contains("origin"),
).
Confirm()
}).
Press(keys.Universal.Remove).
Tap(func() {
t.ExpectPopup().
Menu().
Title(Equals("Delete tag 'new-tag'?")).
Select(Contains("Delete remote tag")).
Confirm()
}).
Tap(func() {
t.ExpectPopup().Prompt().
Title(Equals("Remote from which to remove tag 'new-tag':")).
InitialText(Equals("origin")).
SuggestionLines(
Contains("origin"),
).
Confirm()
}).
Tap(func() {
t.ExpectPopup().
Confirmation().
Title(Equals("Delete tag 'new-tag'?")).
Content(Equals("Are you sure you want to delete the remote tag 'new-tag' from 'origin'?")).
Confirm()
t.ExpectToast(Equals("Remote tag deleted"))
}).
Lines(
MatchesRegexp(`new-tag.*initial commit`).IsSelected(),
).
Tap(func() {
t.Git().
RemoteTagDeleted("origin", "new-tag")
}).
Press(keys.Universal.Remove).
Tap(func() {
t.ExpectPopup().
Menu().
Title(Equals("Delete tag 'new-tag'?")).
Select(Contains("Delete local tag")).
Confirm()
}).
IsEmpty()
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/tag/copy_to_clipboard.go | pkg/integration/tests/tag/copy_to_clipboard.go | package tag
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var CopyToClipboard = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Copy the tag to the clipboard",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {
config.GetUserConfig().OS.CopyToClipboardCmd = "printf '%s' {{text}} > clipboard"
},
SetupRepo: func(shell *Shell) {
shell.EmptyCommit("one")
shell.CreateLightweightTag("super.l000ongtag", "HEAD")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Tags().
Focus().
Lines(
Contains("tag").IsSelected(),
).
Press(keys.Universal.CopyToClipboard)
t.ExpectToast(Equals("'super.l000ongtag' copied to clipboard"))
t.FileSystem().FileContent("clipboard", Equals("super.l000ongtag"))
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/tag/force_tag_annotated.go | pkg/integration/tests/tag/force_tag_annotated.go | package tag
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var ForceTagAnnotated = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Overwrite an annotated tag that already exists",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.EmptyCommit("first commit")
shell.CreateAnnotatedTag("new-tag", "message", "HEAD")
shell.EmptyCommit("second commit")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Commits().
Focus().
Lines(
Contains("second commit").IsSelected(),
Contains("new-tag").Contains("first commit"),
).
Press(keys.Commits.CreateTag).
Tap(func() {
t.ExpectPopup().CommitMessagePanel().
Title(Equals("Tag name")).
Type("new-tag").
SwitchToDescription().
Title(Equals("Tag description")).
Type("message").
SwitchToSummary().
Confirm()
}).
Tap(func() {
t.ExpectPopup().Confirmation().
Title(Equals("Force Tag")).
Content(Contains("The tag 'new-tag' exists already. Press <esc> to cancel, or <enter> to overwrite.")).
Confirm()
}).
Lines(
Contains("new-tag").Contains("second commit"),
DoesNotContain("new-tag").Contains("first commit"),
)
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/tag/checkout_when_branch_with_same_name_exists.go | pkg/integration/tests/tag/checkout_when_branch_with_same_name_exists.go | package tag
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var CheckoutWhenBranchWithSameNameExists = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Checkout a tag when there's a branch with the same name",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.EmptyCommit("one")
shell.NewBranch("tag")
shell.Checkout("master")
shell.EmptyCommit("two")
shell.CreateLightweightTag("tag", "HEAD")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Tags().
Focus().
Lines(
Contains("tag").IsSelected(),
).
PressPrimaryAction() // checkout tag
t.Views().Branches().IsFocused().Lines(
Contains("HEAD detached at tag").IsSelected(),
Contains("master"),
Contains("tag"),
)
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/shared/conflicts.go | pkg/integration/tests/shared/conflicts.go | package shared
import (
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var OriginalFileContent = `
This
Is
The
Original
File
`
var FirstChangeFileContent = `
This
Is
The
First Change
File
`
var SecondChangeFileContent = `
This
Is
The
Second Change
File
`
// prepares us for a rebase/merge that has conflicts
var MergeConflictsSetup = func(shell *Shell) {
shell.
NewBranch("original-branch").
EmptyCommit("one").
EmptyCommit("two").
EmptyCommit("three").
CreateFileAndAdd("file", OriginalFileContent).
Commit("original").
NewBranch("first-change-branch").
UpdateFileAndAdd("file", FirstChangeFileContent).
Commit("first change").
Checkout("original-branch").
NewBranch("second-change-branch").
UpdateFileAndAdd("file", SecondChangeFileContent).
Commit("second change").
EmptyCommit("second-change-branch unrelated change").
Checkout("first-change-branch")
}
var CreateMergeConflictFile = func(shell *Shell) {
MergeConflictsSetup(shell)
shell.RunCommandExpectError([]string{"git", "merge", "--no-edit", "second-change-branch"})
}
var CreateMergeCommit = func(shell *Shell) {
CreateMergeConflictFile(shell)
shell.UpdateFileAndAdd("file", SecondChangeFileContent)
shell.ContinueMerge()
}
// creates a merge conflict where there are two files with conflicts and a separate file without conflicts
var CreateMergeConflictFiles = func(shell *Shell) {
shell.
NewBranch("original-branch").
EmptyCommit("one").
EmptyCommit("two").
EmptyCommit("three").
CreateFileAndAdd("file1", OriginalFileContent).
CreateFileAndAdd("file2", OriginalFileContent).
Commit("original").
NewBranch("first-change-branch").
UpdateFileAndAdd("file1", FirstChangeFileContent).
UpdateFileAndAdd("file2", FirstChangeFileContent).
Commit("first change").
Checkout("original-branch").
NewBranch("second-change-branch").
UpdateFileAndAdd("file1", SecondChangeFileContent).
UpdateFileAndAdd("file2", SecondChangeFileContent).
// this file is not changed in the second branch
CreateFileAndAdd("file3", "content").
Commit("second change").
EmptyCommit("second-change-branch unrelated change").
Checkout("first-change-branch")
shell.RunCommandExpectError([]string{"git", "merge", "--no-edit", "second-change-branch"})
}
// These 'multiple' variants are just like the short ones but with longer file contents and with multiple conflicts within the file.
var OriginalFileContentMultiple = `
This
Is
The
Original
File
..
It
Is
Longer
Than
The
Other
Options
`
var FirstChangeFileContentMultiple = `
This
Is
The
First Change
File
..
It
Is
Longer
Than
The
Other
Other First Change
`
var SecondChangeFileContentMultiple = `
This
Is
The
Second Change
File
..
It
Is
Longer
Than
The
Other
Other Second Change
`
var CreateMergeConflictFileMultiple = func(shell *Shell) {
shell.
NewBranch("original-branch").
EmptyCommit("one").
EmptyCommit("two").
EmptyCommit("three").
CreateFileAndAdd("file", OriginalFileContentMultiple).
Commit("original").
NewBranch("first-change-branch").
UpdateFileAndAdd("file", FirstChangeFileContentMultiple).
Commit("first change").
Checkout("original-branch").
NewBranch("second-change-branch").
UpdateFileAndAdd("file", SecondChangeFileContentMultiple).
Commit("second change").
EmptyCommit("second-change-branch unrelated change").
Checkout("first-change-branch")
shell.RunCommandExpectError([]string{"git", "merge", "--no-edit", "second-change-branch"})
}
var CreateMergeConflictFileForMergeFileTests = func(shell *Shell, originalFileContent string, currentChangeFileContent string, incomingChangeFileContent string) {
shell.
NewBranch("original-branch").
EmptyCommit("one").
CreateFileAndAdd("file", originalFileContent).
Commit("original").
NewBranch("current-change-branch").
UpdateFileAndAdd("file", currentChangeFileContent).
Commit("first change").
Checkout("original-branch").
NewBranch("incoming-change-branch").
UpdateFileAndAdd("file", incomingChangeFileContent).
Commit("second change").
Checkout("current-change-branch").
RunCommandExpectError([]string{"git", "merge", "--no-edit", "incoming-change-branch"})
}
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/ui/switch_tab_from_menu.go | pkg/integration/tests/ui/switch_tab_from_menu.go | package ui
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var SwitchTabFromMenu = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Switch tab via the options menu",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Files().IsFocused().
Press(keys.Universal.OptionMenuAlt1)
t.ExpectPopup().Menu().Title(Equals("Keybindings")).
Select(Contains("Next tab")).
Confirm()
t.Views().Worktrees().IsFocused()
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/ui/disable_switch_tab_with_panel_jump_keys.go | pkg/integration/tests/ui/disable_switch_tab_with_panel_jump_keys.go | package ui
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var DisableSwitchTabWithPanelJumpKeys = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Verify that the tab does not change by default when jumping to an already focused panel",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {
},
SetupRepo: func(shell *Shell) {
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Status().Focus().
Press(keys.Universal.JumpToBlock[1])
t.Views().Files().IsFocused().
Press(keys.Universal.JumpToBlock[1])
// Despite jumping to an already focused panel,
// the tab should not change from the base files view
t.Views().Files().IsFocused()
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/ui/range_select.go | pkg/integration/tests/ui/range_select.go | package ui
import (
"fmt"
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
// Here's the state machine we need to verify:
// (no range, press 'v') -> sticky range
// (no range, press arrow) -> no range
// (no range, press shift+arrow) -> nonsticky range
// (sticky range, press 'v') -> no range
// (sticky range, press 'escape') -> no range
// (sticky range, press arrow) -> sticky range
// (sticky range, press `<`/`>` or `,`/`.`) -> sticky range
// (sticky range, press shift+arrow) -> nonsticky range
// (nonsticky range, press 'v') -> no range
// (nonsticky range, press 'escape') -> no range
// (nonsticky range, press arrow) -> no range
// (nonsticky range, press shift+arrow) -> nonsticky range
// Importantly, if you press 'v' when in a nonsticky range, it clears the range,
// so no matter which mode you're in, 'v' will cancel the range.
// And, if you press shift+up/down when in a sticky range, it switches to a non-
// sticky range, meaning if you then press up/down without shift, it clears
// the range.
var RangeSelect = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Verify range select works as expected in list views and in patch explorer views",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {
config.GetUserConfig().Gui.UseHunkModeInStagingView = false
},
SetupRepo: func(shell *Shell) {
// We're testing the commits view as our representative list context,
// as well as the staging view, and we're using the exact same code to test
// both to ensure they have the exact same behaviour (they are currently implemented
// separately)
// In both views we're going to have 10 lines starting from 'line 1' going down to
// 'line 10'.
fileContent := "staged\n"
total := 10
for i := 1; i <= total; i++ {
remaining := total - i + 1
// Commits are displayed in reverse order so to we need to create them in reverse to have them appear as 'line 1', 'line 2' etc.
shell.EmptyCommit(fmt.Sprintf("line %d", remaining))
fileContent = fmt.Sprintf("%sline %d\n", fileContent, i)
}
shell.CreateFileAndAdd("file1", "staged\n")
shell.UpdateFile("file1", fileContent)
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
assertRangeSelectBehaviour := func(v *ViewDriver, focusOtherView func(), lineIdxOfFirstItem int) {
v.
SelectedLines(
Contains("line 1"),
).
// (no range, press 'v') -> sticky range
Press(keys.Universal.ToggleRangeSelect).
SelectedLines(
Contains("line 1"),
).
// (sticky range, press arrow) -> sticky range
SelectNextItem().
SelectedLines(
Contains("line 1"),
Contains("line 2"),
).
// (sticky range, press 'v') -> no range
Press(keys.Universal.ToggleRangeSelect).
SelectedLines(
Contains("line 2"),
).
// (no range, press arrow) -> no range
SelectPreviousItem().
SelectedLines(
Contains("line 1"),
).
// (no range, press shift+arrow) -> nonsticky range
Press(keys.Universal.RangeSelectDown).
SelectedLines(
Contains("line 1"),
Contains("line 2"),
).
// (nonsticky range, press shift+arrow) -> nonsticky range
Press(keys.Universal.RangeSelectDown).
SelectedLines(
Contains("line 1"),
Contains("line 2"),
Contains("line 3"),
).
Press(keys.Universal.RangeSelectUp).
SelectedLines(
Contains("line 1"),
Contains("line 2"),
).
// (nonsticky range, press arrow) -> no range
SelectNextItem().
SelectedLines(
Contains("line 3"),
).
Press(keys.Universal.ToggleRangeSelect).
SelectedLines(
Contains("line 3"),
).
SelectNextItem().
SelectedLines(
Contains("line 3"),
Contains("line 4"),
).
// (sticky range, press shift+arrow) -> nonsticky range
Press(keys.Universal.RangeSelectDown).
SelectedLines(
Contains("line 3"),
Contains("line 4"),
Contains("line 5"),
).
SelectNextItem().
SelectedLines(
Contains("line 6"),
).
Press(keys.Universal.RangeSelectDown).
SelectedLines(
Contains("line 6"),
Contains("line 7"),
).
// (nonsticky range, press 'v') -> no range
Press(keys.Universal.ToggleRangeSelect).
SelectedLines(
Contains("line 7"),
).
Press(keys.Universal.RangeSelectDown).
SelectedLines(
Contains("line 7"),
Contains("line 8"),
).
// (nonsticky range, press 'escape') -> no range
PressEscape().
SelectedLines(
Contains("line 8"),
).
// (sticky range, press '>') -> sticky range
Press(keys.Universal.ToggleRangeSelect).
Press(keys.Universal.GotoBottom).
SelectedLines(
Contains("line 8"),
Contains("line 9"),
Contains("line 10"),
).
// (sticky range, press 'escape') -> no range
PressEscape().
SelectedLines(
Contains("line 10"),
)
// Click in view, press shift+arrow -> nonsticky range
focusOtherView()
v.Click(1, lineIdxOfFirstItem).
SelectedLines(
Contains("line 1"),
).
Press(keys.Universal.RangeSelectDown).
SelectedLines(
Contains("line 1"),
Contains("line 2"),
)
}
assertRangeSelectBehaviour(t.Views().Commits().Focus(), func() { t.Views().Branches().Focus() }, 0)
t.Views().Files().
Focus().
SelectedLine(
Contains("file1"),
).
PressEnter()
assertRangeSelectBehaviour(t.Views().Staging().IsFocused(), func() { t.Views().Staging().PressTab() }, 6)
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/ui/switch_tab_with_panel_jump_keys.go | pkg/integration/tests/ui/switch_tab_with_panel_jump_keys.go | package ui
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var SwitchTabWithPanelJumpKeys = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Switch tab with the panel jump keys after enabling the feature",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {
config.GetUserConfig().Gui.SwitchTabsWithPanelJumpKeys = true
},
SetupRepo: func(shell *Shell) {
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Worktrees().Focus().
Press(keys.Universal.JumpToBlock[2])
t.Views().Branches().IsFocused().
Press(keys.Universal.JumpToBlock[2])
t.Views().Remotes().IsFocused().
Press(keys.Universal.JumpToBlock[2])
t.Views().Tags().IsFocused().
Press(keys.Universal.JumpToBlock[2])
t.Views().Branches().IsFocused().
Press(keys.Universal.JumpToBlock[1])
// When jumping to a panel from a different one, keep its current tab:
t.Views().Worktrees().IsFocused()
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/ui/keybinding_suggestions_when_switching_repos.go | pkg/integration/tests/ui/keybinding_suggestions_when_switching_repos.go | package ui
import (
"path/filepath"
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var KeybindingSuggestionsWhenSwitchingRepos = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Show correct keybinding suggestions after switching between repos",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {
otherRepo, _ := filepath.Abs("../other")
config.GetAppState().RecentRepos = []string{otherRepo}
},
SetupRepo: func(shell *Shell) {
shell.CloneNonBare("other")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
switchToRepo := func(repo string) {
t.GlobalPress(keys.Universal.OpenRecentRepos)
t.ExpectPopup().Menu().Title(Equals("Recent repositories")).
Lines(
Contains(repo).IsSelected(),
Contains("Cancel"),
).Confirm()
t.Views().Status().Content(Contains(repo + " → master"))
}
t.Views().Files().Focus()
t.Views().Options().Content(
Equals("Commit: c | Stash: s | Reset: D | Keybindings: ?"))
switchToRepo("other")
switchToRepo("repo")
t.Views().Options().Content(
Equals("Commit: c | Stash: s | Reset: D | Keybindings: ?"))
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/ui/open_link_failure.go | pkg/integration/tests/ui/open_link_failure.go | package ui
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var OpenLinkFailure = NewIntegrationTest(NewIntegrationTestArgs{
Description: "When opening links via the OS fails, show a dialog instead.",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {
config.GetUserConfig().OS.OpenLink = "exit 42"
},
SetupRepo: func(shell *Shell) {},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Information().Click(0, 0)
t.ExpectPopup().Confirmation().
Title(Equals("Error")).
Content(Equals("Failed to open URL https://github.com/sponsors/jesseduffield\n\nError: exit status 42")).
Confirm()
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/ui/mode_specific_keybinding_suggestions.go | pkg/integration/tests/ui/mode_specific_keybinding_suggestions.go | package ui
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
"github.com/jesseduffield/lazygit/pkg/integration/tests/shared"
)
var ModeSpecificKeybindingSuggestions = NewIntegrationTest(NewIntegrationTestArgs{
Description: "When in various modes, we should corresponding keybinding suggestions onscreen",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.CreateNCommits(2)
shell.NewBranch("base-branch")
shared.MergeConflictsSetup(shell)
shell.Checkout("base-branch")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
rebaseSuggestion := "View rebase options: m"
cherryPickSuggestion := "Paste (cherry-pick): V"
bisectSuggestion := "View bisect options: b"
customPatchSuggestion := "View custom patch options: <c-p>"
mergeSuggestion := "View merge options: m"
t.Views().Commits().
Focus().
Lines(
Contains("commit 02").IsSelected(),
Contains("commit 01"),
).
Tap(func() {
// These suggestions are mode-specific so are not shown by default
t.Views().Options().Content(
DoesNotContain(rebaseSuggestion).
DoesNotContain(mergeSuggestion).
DoesNotContain(cherryPickSuggestion).
DoesNotContain(bisectSuggestion).
DoesNotContain(customPatchSuggestion),
)
}).
// Start an interactive rebase
Press(keys.Universal.Edit).
Tap(func() {
// Confirm the rebase suggestion now appears
t.Views().Options().Content(Contains(rebaseSuggestion))
}).
Press(keys.Commits.CherryPickCopy).
Tap(func() {
// Confirm the cherry pick suggestion now appears
t.Views().Options().Content(Contains(cherryPickSuggestion))
// Importantly, we show multiple of these suggestions at once
t.Views().Options().Content(Contains(rebaseSuggestion))
}).
// Cancel the cherry pick
PressEscape().
Tap(func() {
t.Views().Options().Content(DoesNotContain(cherryPickSuggestion))
}).
// Cancel the rebase
Tap(func() {
t.Common().AbortRebase()
t.Views().Options().Content(DoesNotContain(rebaseSuggestion))
}).
Press(keys.Commits.ViewBisectOptions).
Tap(func() {
t.ExpectPopup().Menu().
Title(Equals("Bisect")).
Select(MatchesRegexp("Mark.* as bad")).
Confirm()
t.Views().Options().Content(Contains(bisectSuggestion))
// Cancel bisect
t.Common().ResetBisect()
t.Views().Options().Content(DoesNotContain(bisectSuggestion))
}).
// Enter commit files view
PressEnter()
t.Views().CommitFiles().
IsFocused().
// Add a commit file to the patch
Press(keys.Universal.Select).
Tap(func() {
t.Views().Options().Content(Contains(customPatchSuggestion))
t.Common().ResetCustomPatch()
t.Views().Options().Content(DoesNotContain(customPatchSuggestion))
})
// Test merge options suggestion
t.Views().Branches().
Focus().
NavigateToLine(Contains("first-change-branch")).
Press(keys.Universal.Select).
NavigateToLine(Contains("second-change-branch")).
Press(keys.Branches.MergeIntoCurrentBranch).
Tap(func() {
t.ExpectPopup().Menu().
Title(Equals("Merge")).
Select(Contains("Regular merge (with merge commit)")).
Confirm()
t.Common().AcknowledgeConflicts()
t.Views().Options().Content(Contains(mergeSuggestion))
t.Common().AbortMerge()
t.Views().Options().Content(DoesNotContain(mergeSuggestion))
})
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/ui/accordion.go | pkg/integration/tests/ui/accordion.go | package ui
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
// When in accordion mode, Lazygit looks like this:
//
// ╶─Status─────────────────────────╴┌─Patch──────────────────────────────────────────────────────────┐
// ╶─Files - Submodules──────0 of 0─╴│commit 6e56dd04b70e548976f7f2928c4d9c359574e2bc ▲
// ╶─Local branches - Remotes1 of 1─╴│Author: CI <CI@example.com> █
// ┌─Commits - Reflog───────────────┐│Date: Wed Jul 19 22:00:03 2023 +1000 │
// │7fe02805 CI commit 12 ▲│ ▼
// │6e56dd04 CI commit 11 █└────────────────────────────────────────────────────────────────┘
// │a35c687d CI commit 10 ▼┌─Command log────────────────────────────────────────────────────┐
// └───────────────────────10 of 20─┘│Random tip: To filter commits by path, press '<c-s>' │
// ╶─Stash───────────────────0 of 0─╴└────────────────────────────────────────────────────────────────┘
// <pgup>/<pgdown>: Scroll, <esc>: Cancel, q: Quit, ?: Keybindings, 1-Donate Ask Question unversioned
var Accordion = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Verify accordion mode kicks in when the screen height is too small",
ExtraCmdArgs: []string{},
Width: 100,
Height: 10,
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.CreateNCommits(20)
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Commits().
Focus().
VisibleLines(
Contains("commit 20").IsSelected(),
Contains("commit 19"),
Contains("commit 18"),
).
// go past commit 11, then come back, so that it ends up in the centre of the viewport
NavigateToLine(Contains("commit 11")).
NavigateToLine(Contains("commit 10")).
NavigateToLine(Contains("commit 11")).
VisibleLines(
Contains("commit 12"),
Contains("commit 11").IsSelected(),
Contains("commit 10"),
)
t.Views().Files().
Focus()
// ensure we retain the same viewport upon re-focus
t.Views().Commits().
Focus().
VisibleLines(
Contains("commit 12"),
Contains("commit 11").IsSelected(),
Contains("commit 10"),
)
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/ui/empty_menu.go | pkg/integration/tests/ui/empty_menu.go | package ui
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var EmptyMenu = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Verify that we don't crash on an empty menu",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Files().
IsFocused().
Press(keys.Universal.OptionMenu)
t.Views().Menu().
IsFocused().
// a string that filters everything out
FilterOrSearch("ljasldkjaslkdjalskdjalsdjaslkd").
IsEmpty().
Press(keys.Universal.Select).
Tap(func() {
t.ExpectToast(Equals("Disabled: No item selected"))
}).
// escape the search
PressEscape().
// escape the view
PressEscape()
// back in the files view, selecting the non-existing menu item was a no-op
t.Views().Files().
IsFocused()
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/filter_and_search/nested_filter.go | pkg/integration/tests/filter_and_search/nested_filter.go | package filter_and_search
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var NestedFilter = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Filter in the several nested panels and verify the filters are preserved as you escape back to the surface",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {
config.GetUserConfig().Git.LocalBranchSortOrder = "alphabetical"
},
SetupRepo: func(shell *Shell) {
// need to create some branches, each with their own commits
shell.NewBranch("branch-gold")
shell.CreateFileAndAdd("apple", "apple")
shell.CreateFileAndAdd("orange", "orange")
shell.CreateFileAndAdd("grape", "grape")
shell.Commit("commit-knife")
shell.NewBranch("branch-silver")
shell.UpdateFileAndAdd("apple", "apple-2")
shell.UpdateFileAndAdd("orange", "orange-2")
shell.UpdateFileAndAdd("grape", "grape-2")
shell.Commit("commit-spoon")
shell.NewBranch("branch-bronze")
shell.UpdateFileAndAdd("apple", "apple-3")
shell.UpdateFileAndAdd("orange", "orange-3")
shell.UpdateFileAndAdd("grape", "grape-3")
shell.Commit("commit-fork")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Branches().
Focus().
Lines(
Contains(`branch-bronze`).IsSelected(),
Contains(`branch-gold`),
Contains(`branch-silver`),
).
FilterOrSearch("sil").
Lines(
Contains(`branch-silver`).IsSelected(),
).
PressEnter()
t.Views().SubCommits().
IsFocused().
Lines(
Contains(`commit-spoon`).IsSelected(),
Contains(`commit-knife`),
).
FilterOrSearch("knife").
Lines(
// sub-commits view searches, it doesn't filter, so we haven't filtered down the list
Contains(`commit-spoon`),
Contains(`commit-knife`).IsSelected(),
).
PressEnter()
t.Views().CommitFiles().
IsFocused().
Lines(
Equals("▼ /").IsSelected(),
Equals(" A apple"),
Equals(" A grape"),
Equals(" A orange"),
).
FilterOrSearch("grape").
Lines(
Equals("▼ /"),
Equals(" A apple"),
Equals(" A grape").IsSelected(),
Equals(" A orange"),
).
PressEnter()
t.Views().PatchBuilding().
IsFocused().
FilterOrSearch("newline").
SelectedLine(Contains("No newline at end of file")).
PressEscape(). // cancel search
Tap(func() {
t.Views().Search().IsInvisible()
}).
// escape to commit-files view
PressEscape()
t.Views().CommitFiles().
IsFocused().
Lines(
Equals("▼ /"),
Equals(" A apple"),
Equals(" A grape").IsSelected(),
Equals(" A orange"),
).
Tap(func() {
t.Views().Search().IsVisible().Content(Contains("matches for 'grape'"))
}).
// cancel search
PressEscape().
Tap(func() {
t.Views().Search().IsInvisible()
}).
Lines(
Equals("▼ /"),
Equals(" A apple"),
Equals(" A grape").IsSelected(),
Equals(" A orange"),
).
// escape to sub-commits view
PressEscape()
t.Views().SubCommits().
IsFocused().
Lines(
Contains(`commit-spoon`),
Contains(`commit-knife`).IsSelected(),
).
Tap(func() {
t.Views().Search().IsVisible().Content(Contains("matches for 'knife'"))
}).
// cancel search
PressEscape().
Tap(func() {
t.Views().Search().IsInvisible()
}).
Lines(
Contains(`commit-spoon`),
// still selected
Contains(`commit-knife`).IsSelected(),
).
// escape to branches view
PressEscape()
t.Views().Branches().
IsFocused().
Lines(
Contains(`branch-silver`).IsSelected(),
).
Tap(func() {
t.Views().Search().IsVisible().Content(Contains("matches for 'sil'"))
}).
// cancel search
PressEscape().
Tap(func() {
t.Views().Search().IsInvisible()
}).
Lines(
Contains(`branch-bronze`),
Contains(`branch-gold`),
Contains(`branch-silver`).IsSelected(),
)
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/filter_and_search/nested_filter_transient.go | pkg/integration/tests/filter_and_search/nested_filter_transient.go | package filter_and_search
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
// This one requires some explanation: the sub-commits and diff-file contexts are
// 'transient' in that they are spawned inside a window when you need them, but
// can be relocated elsewhere if you need them somewhere else. So for example if
// I hit enter on a branch I'll see the sub-commits view, but if I then navigate
// to the reflog context and hit enter on a reflog, the sub-commits view is moved
// to the reflog window. This is because we reuse the same view (it's a limitation
// that would be nice to remove in the future).
// Nonetheless, we need to ensure that upon moving the view, the filter is cancelled.
var NestedFilterTransient = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Filter in a transient panel (sub-commits and diff-files) and ensure filter is cancelled when the panel is moved",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
// need to create some branches, each with their own commits
shell.NewBranch("mybranch")
shell.CreateFileAndAdd("file-one", "file-one")
shell.CreateFileAndAdd("file-two", "file-two")
shell.Commit("commit-one")
shell.EmptyCommit("commit-two")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Branches().
Focus().
Lines(
Contains(`mybranch`).IsSelected(),
).
PressEnter()
t.Views().SubCommits().
IsFocused().
Lines(
Contains(`commit-two`).IsSelected(),
Contains(`commit-one`),
).
FilterOrSearch("one").
Lines(
Contains(`commit-two`),
Contains(`commit-one`).IsSelected(),
)
t.Views().ReflogCommits().
Focus().
SelectedLine(Contains("commit: commit-two")).
PressEnter()
t.Views().SubCommits().
IsFocused().
// the search on the sub-commits context has been cancelled
Lines(
Contains(`commit-two`).IsSelected(),
Contains(`commit-one`),
).
Tap(func() {
t.Views().Search().IsInvisible()
}).
NavigateToLine(Contains("commit-one")).
PressEnter()
// Now let's test the commit files context
t.Views().CommitFiles().
IsFocused().
Lines(
Equals("▼ /").IsSelected(),
Equals(" A file-one"),
Equals(" A file-two"),
).
FilterOrSearch("two").
Lines(
Equals("▼ /"),
Equals(" A file-one"),
Equals(" A file-two").IsSelected(),
)
t.Views().Branches().
Focus().
SelectedLine(Contains("mybranch")).
PressEnter()
t.Views().SubCommits().
IsFocused().
Lines(
Contains(`commit-two`).IsSelected(),
Contains(`commit-one`),
).
NavigateToLine(Contains("commit-one")).
PressEnter()
t.Views().CommitFiles().
IsFocused().
// the search on the commit-files context has been cancelled
Lines(
Equals("▼ /").IsSelected(),
Equals(" A file-one"),
Equals(" A file-two"),
).
Tap(func() {
t.Views().Search().IsInvisible()
})
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/filter_and_search/stage_all_stages_only_tracked_files_in_tracked_only_filter.go | pkg/integration/tests/filter_and_search/stage_all_stages_only_tracked_files_in_tracked_only_filter.go | package filter_and_search
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var StageAllStagesOnlyTrackedFilesInTrackedOnlyFilter = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Staging all files in tracked only view should stage only tracked files",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {
},
SetupRepo: func(shell *Shell) {
shell.CreateFileAndAdd("file-tracked", "foo")
shell.Commit("first commit")
shell.CreateFile("file-untracked", "bar")
shell.UpdateFile("file-tracked", "baz")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Files().
Focus().
Lines(
Equals("▼ /").IsSelected(),
Equals(" M file-tracked"),
Equals(" ?? file-untracked"),
).
Press(keys.Files.OpenStatusFilter).
Tap(func() {
t.ExpectPopup().Menu().
Title(Equals("Filtering")).
Select(Contains("Show only tracked files")).
Confirm()
}).
Lines(
Equals(" M file-tracked"),
).
Press(keys.Files.ToggleStagedAll).
Press(keys.Files.OpenStatusFilter).
Tap(func() {
t.ExpectPopup().Menu().
Title(Equals("Filtering")).
Select(Contains("No filter")).
Confirm()
}).
Lines(
Equals("▼ /").IsSelected(),
Equals(" M file-tracked"), // 'M' is now in the left column, so file is staged
Equals(" ?? file-untracked"),
)
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/filter_and_search/filter_remotes.go | pkg/integration/tests/filter_and_search/filter_remotes.go | package filter_and_search
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var FilterRemotes = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Filtering remotes",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.EmptyCommit("commit-one")
shell.CloneIntoRemote("remote1")
shell.CloneIntoRemote("remote2")
shell.CloneIntoRemote("remote3")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Remotes().
Focus().
Lines(
Contains("remote1").IsSelected(),
Contains("remote2"),
Contains("remote3"),
).
FilterOrSearch("2").
Lines(
Contains("remote2").IsSelected(),
).
// cancel the filter
PressEscape().
Tap(func() {
t.Views().Search().IsInvisible()
}).
Lines(
Contains("remote1"),
Contains("remote2").IsSelected(),
Contains("remote3"),
)
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/filter_and_search/staging_folder_stages_only_tracked_files_in_tracked_only_filter.go | pkg/integration/tests/filter_and_search/staging_folder_stages_only_tracked_files_in_tracked_only_filter.go | package filter_and_search
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var StagingFolderStagesOnlyTrackedFilesInTrackedOnlyFilter = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Staging entire folder in tracked only view, should stage only tracked files",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {
},
SetupRepo: func(shell *Shell) {
shell.CreateDir("test")
shell.CreateFileAndAdd("test/file-tracked", "foo")
shell.Commit("first commit")
shell.CreateFile("test/file-untracked", "bar")
shell.UpdateFile("test/file-tracked", "baz")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Files().
Focus().
Lines(
Equals("▼ test").IsSelected(),
Equals(" M file-tracked"),
Equals(" ?? file-untracked"),
).
Press(keys.Files.OpenStatusFilter).
Tap(func() {
t.ExpectPopup().Menu().
Title(Equals("Filtering")).
Select(Contains("Show only tracked files")).
Confirm()
}).
Lines(
Equals("▼ test").IsSelected(),
Equals(" M file-tracked"),
).
PressPrimaryAction().
Press(keys.Files.OpenStatusFilter).
Tap(func() {
t.ExpectPopup().Menu().
Title(Equals("Filtering")).
Select(Contains("No filter")).
Confirm()
}).
Lines(
Equals("▼ test").IsSelected(),
Equals(" M file-tracked"), // 'M' is now in the left column, so file is staged
Equals(" ?? file-untracked"),
)
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/filter_and_search/new_search.go | pkg/integration/tests/filter_and_search/new_search.go | package filter_and_search
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
// This is a regression test to ensure https://github.com/jesseduffield/lazygit/issues/2971
// doesn't happen again
var NewSearch = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Start a new search and verify the search begins from the current cursor position, not from the current search match",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
// need to create some branches, each with their own commits
shell.EmptyCommit("Add foo")
shell.EmptyCommit("Remove foo")
shell.EmptyCommit("Add bar")
shell.EmptyCommit("Remove bar")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Commits().
Focus().
Lines(
Contains(`Remove bar`).IsSelected(),
Contains(`Add bar`),
Contains(`Remove foo`),
Contains(`Add foo`),
).
FilterOrSearch("Add").
SelectedLine(Contains(`Add bar`)).
SelectPreviousItem().
SelectedLine(Contains(`Remove bar`)).
FilterOrSearch("Remove").
SelectedLine(Contains(`Remove bar`))
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/filter_and_search/filter_remote_branches.go | pkg/integration/tests/filter_and_search/filter_remote_branches.go | package filter_and_search
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var FilterRemoteBranches = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Filtering remote branches",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.NewBranch("branch-apple")
shell.EmptyCommit("commit-one")
shell.NewBranch("branch-grape")
shell.NewBranch("branch-orange")
shell.CloneIntoRemote("origin")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Remotes().
Focus().
Lines(
Contains(`origin`).IsSelected(),
).
PressEnter()
t.Views().RemoteBranches().
IsFocused().
Lines(
Contains(`branch-apple`).IsSelected(),
Contains(`branch-grape`),
Contains(`branch-orange`),
).
FilterOrSearch("grape").
Lines(
Contains(`branch-grape`).IsSelected(),
).
// cancel the filter
PressEscape().
Tap(func() {
t.Views().Search().IsInvisible()
}).
Lines(
Contains(`branch-apple`),
Contains(`branch-grape`).IsSelected(),
Contains(`branch-orange`),
).
// return to remotes view
PressEscape()
t.Views().Remotes().
IsFocused().
Lines(
Contains(`origin`).IsSelected(),
)
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/filter_and_search/filter_by_file_status.go | pkg/integration/tests/filter_and_search/filter_by_file_status.go | package filter_and_search
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var FilterByFileStatus = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Filtering to show untracked files in repo that hides them by default",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {
},
SetupRepo: func(shell *Shell) {
// need to set untracked files to not be displayed in git config
shell.SetConfig("status.showUntrackedFiles", "no")
shell.CreateFileAndAdd("file-tracked", "foo")
shell.Commit("first commit")
shell.CreateFile("file-untracked", "bar")
shell.UpdateFile("file-tracked", "baz")
shell.CreateFile("file-staged-but-untracked", "qux")
shell.GitAdd("file-staged-but-untracked")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Files().
Focus().
Lines(
Equals("▼ /").IsSelected(),
Equals(" A file-staged-but-untracked"),
Equals(" M file-tracked"),
).
Press(keys.Files.OpenStatusFilter).
Tap(func() {
t.ExpectPopup().Menu().
Title(Equals("Filtering")).
Select(Contains("Show only untracked files")).
Confirm()
}).
Lines(
Equals("?? file-untracked").IsSelected(),
).
Press(keys.Files.OpenStatusFilter).
Tap(func() {
t.ExpectPopup().Menu().
Title(Equals("Filtering")).
Select(Contains("Show only tracked files")).
Confirm()
}).
Lines(
Equals("▼ /").IsSelected(),
Equals(" A file-staged-but-untracked"),
Equals(" M file-tracked"),
).
Press(keys.Files.OpenStatusFilter).
Tap(func() {
t.ExpectPopup().Menu().
Title(Equals("Filtering")).
Select(Contains("No filter")).
Confirm()
}).
Lines(
Equals("▼ /").IsSelected(),
Equals(" A file-staged-but-untracked"),
Equals(" M file-tracked"),
)
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/filter_and_search/filter_commit_files.go | pkg/integration/tests/filter_and_search/filter_commit_files.go | package filter_and_search
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var FilterCommitFiles = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Basic commit file filtering by text",
ExtraCmdArgs: []string{},
Skip: true, // skipping until we have implemented file view filtering
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.CreateDir("folder1")
shell.CreateFileAndAdd("folder1/apple-grape", "apple-grape")
shell.CreateFileAndAdd("folder1/apple-orange", "apple-orange")
shell.CreateFileAndAdd("folder1/grape-orange", "grape-orange")
shell.Commit("first commit")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Commits().
Focus().
Lines(
Contains(`first commit`).IsSelected(),
).
Press(keys.Universal.Confirm)
t.Views().CommitFiles().
IsFocused().
Lines(
Contains(`folder1`).IsSelected(),
Contains(`apple-grape`),
Contains(`apple-orange`),
Contains(`grape-orange`),
).
Press(keys.Files.ToggleTreeView).
Lines(
Contains(`folder1/apple-grape`).IsSelected(),
Contains(`folder1/apple-orange`),
Contains(`folder1/grape-orange`),
).
FilterOrSearch("apple").
Lines(
Contains(`folder1/apple-grape`).IsSelected(),
Contains(`folder1/apple-orange`),
).
Press(keys.Files.ToggleTreeView).
// filter still applies when we toggle tree view
Lines(
Contains(`folder1`),
Contains(`apple-grape`).IsSelected(),
Contains(`apple-orange`),
).
Press(keys.Files.ToggleTreeView).
Lines(
Contains(`folder1/apple-grape`).IsSelected(),
Contains(`folder1/apple-orange`),
).
NavigateToLine(Contains(`folder1/apple-orange`)).
Press(keys.Universal.Return).
Lines(
Contains(`folder1/apple-grape`),
// selection is retained after escaping filter mode
Contains(`folder1/apple-orange`).IsSelected(),
Contains(`folder1/grape-orange`),
).
Tap(func() {
t.Views().Search().IsInvisible()
}).
Press(keys.Files.ToggleTreeView).
Lines(
Contains(`folder1`),
Contains(`apple-grape`),
Contains(`apple-orange`).IsSelected(),
Contains(`grape-orange`),
).
FilterOrSearch("folder1/grape").
Lines(
// first item is always selected after filtering
Contains(`folder1`).IsSelected(),
Contains(`grape-orange`),
)
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/filter_and_search/filter_menu_by_keybinding.go | pkg/integration/tests/filter_and_search/filter_menu_by_keybinding.go | package filter_and_search
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var FilterMenuByKeybinding = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Filtering the keybindings menu by keybinding",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Files().
Press(keys.Universal.OptionMenu).
Tap(func() {
t.ExpectPopup().Menu().
Title(Equals("Keybindings")).
Filter("@+").
Lines(
// menu has filtered down to the one item that matches the filter
Contains("--- Global ---"),
Contains("+ Next screen mode").IsSelected(),
).
Confirm()
}).
// Upon opening the menu again, the filter should have been reset
Press(keys.Universal.OptionMenu).
Tap(func() {
t.ExpectPopup().Menu().
Title(Equals("Keybindings")).
LineCount(GreaterThan(1))
})
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/filter_and_search/filter_menu_with_no_keybindings.go | pkg/integration/tests/filter_and_search/filter_menu_with_no_keybindings.go | package filter_and_search
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var FilterMenuWithNoKeybindings = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Filtering the keybindings menu so that only entries without keybinding are left",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {
config.GetUserConfig().Keybinding.Universal.ToggleWhitespaceInDiffView = "<disabled>"
},
SetupRepo: func(shell *Shell) {
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Files().
IsFocused().
Press(keys.Universal.OptionMenu)
t.ExpectPopup().Menu().
Title(Equals("Keybindings")).
Filter("whitespace").
Lines(
// menu has filtered down to the one item that matches the
// filter, and it doesn't have a keybinding
Equals("--- Global ---"),
Equals("Toggle whitespace").IsSelected(),
)
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/filter_and_search/filter_menu_cancel_filter_with_escape.go | pkg/integration/tests/filter_and_search/filter_menu_cancel_filter_with_escape.go | package filter_and_search
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var FilterMenuCancelFilterWithEscape = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Filtering the keybindings menu, then pressing esc to turn off the filter",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Files().IsFocused().
Press(keys.Universal.OptionMenu)
t.ExpectPopup().Menu().
Title(Equals("Keybindings")).
Filter("Ignore").
Lines(
// menu has filtered down to the one item that matches the filter
Contains(`--- Local ---`),
Contains(`Ignore`).IsSelected(),
)
// Escape should cancel the filter, not close the menu
t.GlobalPress(keys.Universal.Return)
t.ExpectPopup().Menu().
Title(Equals("Keybindings")).
LineCount(GreaterThan(1))
// Another escape closes the menu
t.GlobalPress(keys.Universal.Return)
t.Views().Files().IsFocused()
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/filter_and_search/filter_fuzzy.go | pkg/integration/tests/filter_and_search/filter_fuzzy.go | package filter_and_search
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var FilterFuzzy = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Verify that fuzzy filtering works (not just exact matches)",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {
config.GetUserConfig().Gui.FilterMode = "fuzzy"
},
SetupRepo: func(shell *Shell) {
shell.NewBranch("this-is-my-branch")
shell.EmptyCommit("first commit")
shell.NewBranch("other-branch")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Branches().
Focus().
Lines(
Contains(`other-branch`).IsSelected(),
Contains(`this-is-my-branch`),
).
FilterOrSearch("timb"). // using first letters of words
Lines(
Contains(`this-is-my-branch`).IsSelected(),
).
FilterOrSearch("brnch"). // allows missing letter
Lines(
Contains(`other-branch`).IsSelected(),
Contains(`this-is-my-branch`),
)
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/filter_and_search/filter_files.go | pkg/integration/tests/filter_and_search/filter_files.go | package filter_and_search
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var FilterFiles = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Basic file filtering by text",
ExtraCmdArgs: []string{},
Skip: true, // Skipping until we have implemented file view filtering
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.CreateDir("folder1")
shell.CreateFile("folder1/apple-grape", "apple-grape")
shell.CreateFile("folder1/apple-orange", "apple-orange")
shell.CreateFile("folder1/grape-orange", "grape-orange")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Files().
Focus().
Lines(
Contains(`folder1`).IsSelected(),
Contains(`apple-grape`),
Contains(`apple-orange`),
Contains(`grape-orange`),
).
Press(keys.Files.ToggleTreeView).
Lines(
Contains(`folder1/apple-grape`).IsSelected(),
Contains(`folder1/apple-orange`),
Contains(`folder1/grape-orange`),
).
FilterOrSearch("apple").
Lines(
Contains(`folder1/apple-grape`).IsSelected(),
Contains(`folder1/apple-orange`),
).
Press(keys.Files.ToggleTreeView).
// filter still applies when we toggle tree view
Lines(
Contains(`folder1`),
Contains(`apple-grape`).IsSelected(),
Contains(`apple-orange`),
).
Press(keys.Files.ToggleTreeView).
Lines(
Contains(`folder1/apple-grape`).IsSelected(),
Contains(`folder1/apple-orange`),
).
NavigateToLine(Contains(`folder1/apple-orange`)).
Press(keys.Universal.Return).
Lines(
Contains(`folder1/apple-grape`),
// selection is retained after escaping filter mode
Contains(`folder1/apple-orange`).IsSelected(),
Contains(`folder1/grape-orange`),
).
Tap(func() {
t.Views().Search().IsInvisible()
}).
Press(keys.Files.ToggleTreeView).
Lines(
Contains(`folder1`),
Contains(`apple-grape`),
Contains(`apple-orange`).IsSelected(),
Contains(`grape-orange`),
).
FilterOrSearch("folder1/grape").
Lines(
// first item is always selected after filtering
Contains(`folder1`).IsSelected(),
Contains(`grape-orange`),
)
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/filter_and_search/filter_menu.go | pkg/integration/tests/filter_and_search/filter_menu.go | package filter_and_search
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var FilterMenu = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Filtering the keybindings menu",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.CreateFile("myfile", "myfile")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Files().
IsFocused().
Lines(
Contains(`??`).Contains(`myfile`).IsSelected(),
).
Press(keys.Universal.OptionMenu).
Tap(func() {
t.ExpectPopup().Menu().
Title(Equals("Keybindings")).
Filter("Ignore").
Lines(
// menu has filtered down to the one item that matches the filter
Contains(`--- Local ---`),
Contains(`Ignore`).IsSelected(),
).
Confirm()
t.ExpectPopup().Menu().
Title(Equals("Ignore or exclude file")).
Select(Contains("Add to .gitignore")).
Confirm()
})
t.Views().Files().
IsFocused().
Lines(
// file has been ignored
Contains(`.gitignore`).IsSelected(),
).
// Upon opening the menu again, the filter should have been reset
Press(keys.Universal.OptionMenu).
Tap(func() {
t.ExpectPopup().Menu().
Title(Equals("Keybindings")).
LineCount(GreaterThan(2))
})
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/filter_and_search/filter_updates_when_model_changes.go | pkg/integration/tests/filter_and_search/filter_updates_when_model_changes.go | package filter_and_search
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var FilterUpdatesWhenModelChanges = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Verify that after deleting a branch the filter is reapplied to show only the remaining branches",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.EmptyCommit("first commit")
shell.NewBranch("branch-to-delete")
shell.NewBranch("other")
shell.NewBranch("checked-out-branch")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Branches().
Focus().
Lines(
Contains("checked-out-branch").IsSelected(),
Contains("branch-to-delete"),
Contains("master"),
Contains("other"),
).
FilterOrSearch("branch").
Lines(
Contains("checked-out-branch").IsSelected(),
Contains("branch-to-delete"),
).
SelectNextItem().
Press(keys.Universal.Remove).
Tap(func() {
t.ExpectPopup().
Menu().
Title(Equals("Delete branch 'branch-to-delete'?")).
Select(Contains("Delete local branch")).
Confirm()
}).
Lines(
Contains("checked-out-branch").IsSelected(),
)
// Verify that updating the filter works even if the view is not the active one
t.Views().Files().Focus()
// To do that, we use a custom command to create a new branch that matches the filter
t.GlobalPress(keys.Universal.ExecuteShellCommand)
t.ExpectPopup().Prompt().
Title(Equals("Shell command:")).
Type("git branch new-branch").
Confirm()
t.Views().Branches().
Lines(
Contains("checked-out-branch").IsSelected(),
Contains("new-branch"),
)
t.Views().Branches().
Focus().
// cancel the filter
PressEscape().
Lines(
Contains("checked-out-branch").IsSelected(),
Contains("master"),
Contains("new-branch"),
Contains("other"),
)
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/filter_and_search/filter_search_history.go | pkg/integration/tests/filter_and_search/filter_search_history.go | package filter_and_search
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var FilterSearchHistory = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Navigating search history",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Files().
// populate search history with some values
FilterOrSearch("1").
FilterOrSearch("2").
FilterOrSearch("3").
Press(keys.Universal.StartSearch).
// clear initial search value
Tap(func() {
t.ExpectSearch().Clear()
}).
// test main search history functionality
Tap(func() {
t.Views().Search().
Press(keys.Universal.PrevItem).
Content(Contains("3")).
Press(keys.Universal.PrevItem).
Content(Contains("2")).
Press(keys.Universal.PrevItem).
Content(Contains("1")).
Press(keys.Universal.PrevItem).
Content(Contains("1")).
Press(keys.Universal.NextItem).
Content(Contains("2")).
Press(keys.Universal.NextItem).
Content(Contains("3")).
Press(keys.Universal.NextItem).
Content(Contains("")).
Press(keys.Universal.NextItem).
Content(Contains("")).
Press(keys.Universal.PrevItem).
Content(Contains("3")).
PressEscape()
}).
// test that it resets after you enter and exit a search
Press(keys.Universal.StartSearch).
Tap(func() {
t.Views().Search().
Press(keys.Universal.PrevItem).
Content(Contains("3")).
PressEscape()
})
// test that the histories are separate for each view
t.Views().Commits().
Focus().
FilterOrSearch("a").
FilterOrSearch("b").
FilterOrSearch("c").
Press(keys.Universal.StartSearch).
Tap(func() {
t.ExpectSearch().Clear()
}).
Tap(func() {
t.Views().Search().
Press(keys.Universal.PrevItem).
Content(Contains("c")).
Press(keys.Universal.PrevItem).
Content(Contains("b")).
Press(keys.Universal.PrevItem).
Content(Contains("a"))
})
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/custom_commands/form_prompts.go | pkg/integration/tests/custom_commands/form_prompts.go | package custom_commands
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var FormPrompts = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Using a custom command referring prompt responses by name",
ExtraCmdArgs: []string{},
Skip: false,
SetupRepo: func(shell *Shell) {
shell.EmptyCommit("blah")
},
SetupConfig: func(cfg *config.AppConfig) {
cfg.GetUserConfig().CustomCommands = []config.CustomCommand{
{
Key: "a",
Context: "files",
Command: `echo {{.Form.FileContent | quote}} > {{.Form.FileName | quote}}`,
Prompts: []config.CustomCommandPrompt{
{
Key: "FileName",
Type: "input",
Title: "Enter a file name",
},
{
Key: "FileContent",
Type: "menu",
Title: "Choose file content",
Options: []config.CustomCommandMenuOption{
{
Name: "foo",
Description: "Foo",
Value: "FOO",
},
{
Name: "bar",
Description: "Bar",
Value: `"BAR"`,
},
{
Name: "baz",
Description: "Baz",
Value: "BAZ",
},
},
},
{
Type: "confirm",
Title: "Are you sure?",
Body: "Are you REALLY sure you want to make this file? Up to you buddy.",
},
},
},
}
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Files().
IsEmpty().
IsFocused().
Press("a")
t.ExpectPopup().Prompt().Title(Equals("Enter a file name")).Type("my file").Confirm()
t.ExpectPopup().Menu().Title(Equals("Choose file content")).Select(Contains("bar")).Confirm()
t.ExpectPopup().Confirmation().
Title(Equals("Are you sure?")).
Content(Equals("Are you REALLY sure you want to make this file? Up to you buddy.")).
Confirm()
t.Views().Files().
Lines(
Contains("my file").IsSelected(),
)
t.Views().Main().Content(Contains(`"BAR"`))
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/custom_commands/suggestions_command.go | pkg/integration/tests/custom_commands/suggestions_command.go | package custom_commands
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var SuggestionsCommand = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Using a custom command that uses a suggestions command in a prompt step",
ExtraCmdArgs: []string{},
Skip: false,
SetupRepo: func(shell *Shell) {
shell.NewBranch("branch-one")
shell.EmptyCommit("blah")
shell.NewBranch("branch-two")
shell.EmptyCommit("blah")
shell.NewBranch("branch-three")
shell.EmptyCommit("blah")
shell.NewBranch("branch-four")
shell.EmptyCommit("blah")
},
SetupConfig: func(cfg *config.AppConfig) {
cfg.GetUserConfig().CustomCommands = []config.CustomCommand{
{
Key: "a",
Context: "localBranches",
Command: `git checkout {{.Form.Branch}}`,
Prompts: []config.CustomCommandPrompt{
{
Key: "Branch",
Type: "input",
Title: "Enter a branch name",
Suggestions: config.CustomCommandSuggestions{
Command: "git branch --format='%(refname:short)'",
},
},
},
},
}
cfg.GetUserConfig().Git.LocalBranchSortOrder = "alphabetical"
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Branches().
Focus().
Lines(
Contains("branch-four").IsSelected(),
Contains("branch-one"),
Contains("branch-three"),
Contains("branch-two"),
).
Press("a")
t.ExpectPopup().Prompt().
Title(Equals("Enter a branch name")).
Type("three").
SuggestionLines(Contains("branch-three")).
ConfirmFirstSuggestion()
t.Views().Branches().
Lines(
Contains("branch-three"),
Contains("branch-four").IsSelected(),
Contains("branch-one"),
Contains("branch-two"),
)
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/custom_commands/access_commit_properties.go | pkg/integration/tests/custom_commands/access_commit_properties.go | package custom_commands
import (
"fmt"
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var AccessCommitProperties = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Run a command that accesses properties of a commit",
ExtraCmdArgs: []string{},
Skip: false,
SetupRepo: func(shell *Shell) {
shell.EmptyCommit("my change")
},
SetupConfig: func(cfg *config.AppConfig) {
cfg.GetUserConfig().CustomCommands = []config.CustomCommand{
{
Key: "X",
Context: "commits",
Command: "printf '%s\n%s\n%s' '{{ .SelectedLocalCommit.Name }}' '{{ .SelectedLocalCommit.Hash }}' '{{ .SelectedLocalCommit.Sha }}' > file.txt",
},
}
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Commits().
Focus().
Lines(
Contains("my change").IsSelected(),
).
Press("X")
hash := t.Git().GetCommitHash("HEAD")
t.FileSystem().FileContent("file.txt", Equals(fmt.Sprintf("my change\n%s\n%s", hash, hash)))
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/custom_commands/suggestions_preset.go | pkg/integration/tests/custom_commands/suggestions_preset.go | package custom_commands
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var SuggestionsPreset = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Using a custom command that uses a suggestions preset in a prompt step",
ExtraCmdArgs: []string{},
Skip: false,
SetupRepo: func(shell *Shell) {
shell.NewBranch("branch-one")
shell.EmptyCommit("blah")
shell.NewBranch("branch-two")
shell.EmptyCommit("blah")
shell.NewBranch("branch-three")
shell.EmptyCommit("blah")
shell.NewBranch("branch-four")
shell.EmptyCommit("blah")
},
SetupConfig: func(cfg *config.AppConfig) {
cfg.GetUserConfig().CustomCommands = []config.CustomCommand{
{
Key: "a",
Context: "localBranches",
Command: `git checkout {{.Form.Branch}}`,
Prompts: []config.CustomCommandPrompt{
{
Key: "Branch",
Type: "input",
Title: "Enter a branch name",
Suggestions: config.CustomCommandSuggestions{
Preset: "branches",
},
},
},
},
}
cfg.GetUserConfig().Git.LocalBranchSortOrder = "alphabetical"
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Branches().
Focus().
Lines(
Contains("branch-four").IsSelected(),
Contains("branch-one"),
Contains("branch-three"),
Contains("branch-two"),
).
Press("a")
t.ExpectPopup().Prompt().
Title(Equals("Enter a branch name")).
Type("three").
SuggestionLines(Contains("branch-three")).
ConfirmFirstSuggestion()
t.Views().Branches().
Lines(
Contains("branch-three"),
Contains("branch-four").IsSelected(),
Contains("branch-one"),
Contains("branch-two"),
)
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/custom_commands/show_output_in_panel.go | pkg/integration/tests/custom_commands/show_output_in_panel.go | package custom_commands
import (
"fmt"
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var ShowOutputInPanel = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Run a command and show the output in a panel",
ExtraCmdArgs: []string{},
Skip: false,
SetupRepo: func(shell *Shell) {
shell.EmptyCommit("my change")
},
SetupConfig: func(cfg *config.AppConfig) {
cfg.GetUserConfig().CustomCommands = []config.CustomCommand{
{
Key: "X",
Context: "commits",
Command: "printf '%s' '{{ .SelectedLocalCommit.Name }}'",
Output: "popup",
},
{
Key: "Y",
Context: "commits",
Command: "printf '%s' '{{ .SelectedLocalCommit.Name }}'",
Output: "popup",
OutputTitle: "Subject of commit {{ .SelectedLocalCommit.Hash }}",
},
}
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Commits().
Focus().
Lines(
Contains("my change").IsSelected(),
).
Press("X")
t.ExpectPopup().Alert().
// Uses cmd string as title if no outputTitle is provided
Title(Equals("printf '%s' 'my change'")).
Content(Equals("my change")).
Confirm()
t.Views().Commits().
Press("Y")
hash := t.Git().GetCommitHash("HEAD")
t.ExpectPopup().Alert().
// Uses provided outputTitle with template fields resolved
Title(Equals(fmt.Sprintf("Subject of commit %s", hash))).
Content(Equals("my change"))
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/custom_commands/menu_from_command.go | pkg/integration/tests/custom_commands/menu_from_command.go | package custom_commands
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
// NOTE: we're getting a weird offset in the popup prompt for some reason. Not sure what's behind that.
var MenuFromCommand = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Using menuFromCommand prompt type",
ExtraCmdArgs: []string{},
Skip: false,
SetupRepo: func(shell *Shell) {
shell.
EmptyCommit("foo").
EmptyCommit("bar").
EmptyCommit("baz").
NewBranch("feature/foo")
},
SetupConfig: func(cfg *config.AppConfig) {
cfg.GetUserConfig().CustomCommands = []config.CustomCommand{
{
Key: "a",
Context: "localBranches",
Command: `echo "{{index .PromptResponses 0}} {{index .PromptResponses 1}} {{ .SelectedLocalBranch.Name }}" > output.txt`,
Prompts: []config.CustomCommandPrompt{
{
Type: "menuFromCommand",
Title: "Choose commit message",
Command: `git log --oneline --pretty=%B`,
Filter: `(?P<commit_message>.*)`,
ValueFormat: `{{ .commit_message }}`,
LabelFormat: `{{ .commit_message | yellow }}`,
},
{
Type: "input",
Title: "Description",
InitialValue: `{{ if .SelectedLocalBranch.Name }}Branch: #{{ .SelectedLocalBranch.Name }}{{end}}`,
},
},
},
}
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Files().
IsEmpty()
t.Views().Branches().
Focus().
Press("a")
t.ExpectPopup().Menu().Title(Equals("Choose commit message")).Select(Contains("bar")).Confirm()
t.ExpectPopup().Prompt().Title(Equals("Description")).Type(" my branch").Confirm()
t.Views().Files().
Focus().
Lines(
Contains("output.txt").IsSelected(),
)
t.Views().Main().Content(Contains("bar Branch: #feature/foo my branch feature/foo"))
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/custom_commands/selected_commit.go | pkg/integration/tests/custom_commands/selected_commit.go | package custom_commands
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var SelectedCommit = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Use the {{ .SelectedCommit }} template variable in different contexts",
ExtraCmdArgs: []string{},
Skip: false,
SetupRepo: func(shell *Shell) {
shell.CreateNCommits(3)
},
SetupConfig: func(cfg *config.AppConfig) {
cfg.GetUserConfig().CustomCommands = []config.CustomCommand{
{
Key: "X",
Context: "global",
Command: "printf '%s' '{{ .SelectedCommit.Name }}' > file.txt",
},
}
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
// Select different commits in each of the commit views
t.Views().Commits().Focus().
NavigateToLine(Contains("commit 01"))
t.Views().ReflogCommits().Focus().
NavigateToLine(Contains("commit 02"))
t.Views().Branches().Focus().
Lines(Contains("master").IsSelected()).
PressEnter()
t.Views().SubCommits().IsFocused().
NavigateToLine(Contains("commit 03"))
// SubCommits
t.GlobalPress("X")
t.FileSystem().FileContent("file.txt", Equals("commit 03"))
t.Views().SubCommits().PressEnter()
t.GlobalPress("X")
t.FileSystem().FileContent("file.txt", Equals("commit 03"))
// ReflogCommits
t.Views().ReflogCommits().Focus()
t.GlobalPress("X")
t.FileSystem().FileContent("file.txt", Equals("commit: commit 02"))
t.Views().ReflogCommits().PressEnter()
t.GlobalPress("X")
t.FileSystem().FileContent("file.txt", Equals("commit: commit 02"))
// LocalCommits
t.Views().Commits().Focus()
t.GlobalPress("X")
t.FileSystem().FileContent("file.txt", Equals("commit 01"))
t.Views().Commits().PressEnter()
t.GlobalPress("X")
t.FileSystem().FileContent("file.txt", Equals("commit 01"))
// None of these
t.Views().Files().Focus()
t.GlobalPress("X")
t.FileSystem().FileContent("file.txt", Equals("commit 01"))
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/custom_commands/global_context.go | pkg/integration/tests/custom_commands/global_context.go | package custom_commands
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var GlobalContext = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Ensure global context works",
ExtraCmdArgs: []string{},
Skip: false,
SetupRepo: func(shell *Shell) {
shell.EmptyCommit("my change")
},
SetupConfig: func(cfg *config.AppConfig) {
cfg.GetUserConfig().CustomCommands = []config.CustomCommand{
{
Key: "X",
Context: "global",
Command: "touch myfile",
},
}
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
// commits
t.Views().Commits().
Focus().
Press("X")
t.Views().Files().
Focus().
Lines(Contains("myfile"))
t.Shell().DeleteFile("myfile")
t.GlobalPress(keys.Files.RefreshFiles)
// branches
t.Views().Branches().
Focus().
Press("X")
t.Views().Files().
Focus().
Lines(Contains("myfile"))
t.Shell().DeleteFile("myfile")
t.GlobalPress(keys.Files.RefreshFiles)
// files
t.Views().Files().
Focus().
Press("X")
t.Views().Files().
Focus().
Lines(Contains("myfile"))
t.Shell().DeleteFile("myfile")
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/custom_commands/custom_commands_submenu.go | pkg/integration/tests/custom_commands/custom_commands_submenu.go | package custom_commands
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var CustomCommandsSubmenu = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Using custom commands from a custom commands menu",
ExtraCmdArgs: []string{},
Skip: false,
SetupRepo: func(shell *Shell) {},
SetupConfig: func(cfg *config.AppConfig) {
cfg.GetUserConfig().CustomCommands = []config.CustomCommand{
{
Key: "x",
Description: "My Custom Commands",
CommandMenu: []config.CustomCommand{
{
Key: "1",
Context: "global",
Command: "touch myfile-global",
},
{
Key: "2",
Context: "files",
Command: "touch myfile-files",
},
{
Key: "3",
Context: "commits",
Command: "touch myfile-commits",
},
},
},
}
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Files().
Focus().
IsEmpty().
Press("x").
Tap(func() {
t.ExpectPopup().Menu().
Title(Equals("My Custom Commands")).
Lines(
Contains("1 touch myfile-global"),
Contains("2 touch myfile-files"),
).
Select(Contains("touch myfile-files")).Confirm()
}).
Lines(
Contains("myfile-files"),
)
t.Views().Commits().
Focus().
Press("x").
Tap(func() {
t.ExpectPopup().Menu().
Title(Equals("My Custom Commands")).
Lines(
Contains("1 touch myfile-global"),
Contains("3 touch myfile-commits"),
)
t.GlobalPress("3")
})
t.Views().Files().
Lines(
Equals("▼ /"),
Contains("myfile-commits"),
Contains("myfile-files"),
)
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/custom_commands/run_command.go | pkg/integration/tests/custom_commands/run_command.go | package custom_commands
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var RunCommand = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Using a custom command that uses runCommand template function in a prompt step",
ExtraCmdArgs: []string{},
Skip: false,
SetupRepo: func(shell *Shell) {
shell.EmptyCommit("blah")
},
SetupConfig: func(cfg *config.AppConfig) {
cfg.GetUserConfig().CustomCommands = []config.CustomCommand{
{
Key: "a",
Context: "localBranches",
Command: `git checkout {{.Form.Branch}}`,
Prompts: []config.CustomCommandPrompt{
{
Key: "Branch",
Type: "input",
Title: "Enter a branch name",
InitialValue: "myprefix/{{ runCommand \"echo dynamic\" }}/",
},
},
},
}
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Branches().
Focus().
Press("a")
t.ExpectPopup().Prompt().
Title(Equals("Enter a branch name")).
InitialText(Contains("myprefix/dynamic/")).
Confirm()
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/custom_commands/basic_command.go | pkg/integration/tests/custom_commands/basic_command.go | package custom_commands
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var BasicCommand = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Using a custom command to create a new file",
ExtraCmdArgs: []string{},
Skip: false,
SetupRepo: func(shell *Shell) {
shell.EmptyCommit("blah")
},
SetupConfig: func(cfg *config.AppConfig) {
cfg.GetUserConfig().CustomCommands = []config.CustomCommand{
{
Key: "a",
Context: "files",
Command: "touch myfile",
},
}
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Files().
IsEmpty().
IsFocused().
Press("a").
Lines(
Contains("myfile"),
)
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/custom_commands/multiple_contexts.go | pkg/integration/tests/custom_commands/multiple_contexts.go | package custom_commands
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var MultipleContexts = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Test that multiple contexts works",
ExtraCmdArgs: []string{},
Skip: false,
SetupRepo: func(shell *Shell) {
shell.EmptyCommit("my change")
},
SetupConfig: func(cfg *config.AppConfig) {
cfg.GetUserConfig().CustomCommands = []config.CustomCommand{
{
Key: "X",
Context: "commits, reflogCommits",
Command: "touch myfile",
},
}
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
// commits
t.Views().Commits().
Focus().
Press("X")
t.Views().Files().
Focus().
Lines(Contains("myfile"))
t.Shell().DeleteFile("myfile")
t.GlobalPress(keys.Files.RefreshFiles)
// branches
t.Views().Branches().
Focus().
Press("X")
t.Views().Files().
Focus().
IsEmpty()
// files
t.Views().ReflogCommits().
Focus().
Press("X")
t.Views().Files().
Focus().
Lines(Contains("myfile"))
t.Shell().DeleteFile("myfile")
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/custom_commands/multiple_prompts.go | pkg/integration/tests/custom_commands/multiple_prompts.go | package custom_commands
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var MultiplePrompts = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Using a custom command with multiple prompts",
ExtraCmdArgs: []string{},
Skip: false,
SetupRepo: func(shell *Shell) {
shell.EmptyCommit("blah")
},
SetupConfig: func(cfg *config.AppConfig) {
cfg.GetUserConfig().CustomCommands = []config.CustomCommand{
{
Key: "a",
Context: "files",
Command: `echo "{{index .PromptResponses 1}}" > {{index .PromptResponses 0}}`,
Prompts: []config.CustomCommandPrompt{
{
Type: "input",
Title: "Enter a file name",
},
{
Type: "menu",
Title: "Choose file content",
Options: []config.CustomCommandMenuOption{
{
Name: "foo",
Description: "Foo",
Value: "FOO",
},
{
Name: "bar",
Description: "Bar",
Value: "BAR",
},
{
Name: "baz",
Description: "Baz",
Value: "BAZ",
},
},
},
{
Type: "confirm",
Title: "Are you sure?",
Body: "Are you REALLY sure you want to make this file? Up to you buddy.",
},
},
},
}
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Files().
IsEmpty().
IsFocused().
Press("a")
t.ExpectPopup().Prompt().Title(Equals("Enter a file name")).Type("myfile").Confirm()
t.ExpectPopup().Menu().Title(Equals("Choose file content")).Select(Contains("bar")).Confirm()
t.ExpectPopup().Confirmation().
Title(Equals("Are you sure?")).
Content(Equals("Are you REALLY sure you want to make this file? Up to you buddy.")).
Confirm()
t.Views().Files().
Focus().
Lines(
Contains("myfile").IsSelected(),
)
t.Views().Main().Content(Contains("BAR"))
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/custom_commands/check_for_conflicts.go | pkg/integration/tests/custom_commands/check_for_conflicts.go | package custom_commands
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
"github.com/jesseduffield/lazygit/pkg/integration/tests/shared"
)
var CheckForConflicts = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Run a command and check for conflicts after",
ExtraCmdArgs: []string{},
Skip: false,
SetupRepo: func(shell *Shell) {
shared.MergeConflictsSetup(shell)
},
SetupConfig: func(cfg *config.AppConfig) {
cfg.GetUserConfig().CustomCommands = []config.CustomCommand{
{
Key: "m",
Context: "localBranches",
Command: "git merge {{ .SelectedLocalBranch.Name | quote }}",
After: &config.CustomCommandAfterHook{
CheckForConflicts: true,
},
},
}
cfg.GetUserConfig().Git.LocalBranchSortOrder = "recency"
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Branches().
Focus().
TopLines(
Contains("first-change-branch"),
Contains("second-change-branch"),
).
NavigateToLine(Contains("second-change-branch")).
Press("m")
t.Common().AcknowledgeConflicts()
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/custom_commands/menu_prompt_with_keys.go | pkg/integration/tests/custom_commands/menu_prompt_with_keys.go | package custom_commands
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var MenuPromptWithKeys = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Using a custom command with menu options that have keybindings",
ExtraCmdArgs: []string{},
Skip: false,
SetupRepo: func(shell *Shell) {
shell.EmptyCommit("initial commit")
},
SetupConfig: func(cfg *config.AppConfig) {
cfg.GetUserConfig().CustomCommands = []config.CustomCommand{
{
Key: "a",
Context: "files",
Command: `echo {{.Form.Choice | quote}} > result.txt`,
Prompts: []config.CustomCommandPrompt{
{
Key: "Choice",
Type: "menu",
Title: "Choose an option",
Options: []config.CustomCommandMenuOption{
{
Name: "first",
Description: "First option",
Value: "FIRST",
Key: "1",
},
{
Name: "second",
Description: "Second option",
Value: "SECOND",
Key: "H",
},
{
Name: "third",
Description: "Third option",
Value: "THIRD",
Key: "3",
},
},
},
},
},
}
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Files().
IsFocused().
Press("a")
t.ExpectPopup().Menu().
Title(Equals("Choose an option"))
// 'H' is normally a navigation key (ScrollLeft), so this tests that menu item
// keybindings have proper precedence over non-essential navigation keys
t.Views().Menu().Press("H")
t.FileSystem().FileContent("result.txt", Equals("SECOND\n"))
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
jesseduffield/lazygit | https://github.com/jesseduffield/lazygit/blob/80dd695d7a8d32714603f5a6307f26f589802b1d/pkg/integration/tests/custom_commands/menu_from_commands_output.go | pkg/integration/tests/custom_commands/menu_from_commands_output.go | package custom_commands
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var MenuFromCommandsOutput = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Using prompt response in menuFromCommand entries",
ExtraCmdArgs: []string{},
Skip: false,
SetupRepo: func(shell *Shell) {
shell.
EmptyCommit("foo").
NewBranch("feature/foo").
EmptyCommit("bar").
NewBranch("feature/bar").
EmptyCommit("baz")
},
SetupConfig: func(cfg *config.AppConfig) {
cfg.GetUserConfig().CustomCommands = []config.CustomCommand{
{
Key: "a",
Context: "localBranches",
Command: "git checkout {{ index .PromptResponses 1 }}",
Prompts: []config.CustomCommandPrompt{
{
Type: "input",
Title: "Which git command do you want to run?",
InitialValue: "branch",
},
{
Type: "menuFromCommand",
Title: "Branch:",
Command: `git {{ index .PromptResponses 0 }} --format='%(refname:short)'`,
Filter: "(?P<branch>.*)",
ValueFormat: `{{ .branch }}`,
LabelFormat: `{{ .branch | green }}`,
},
},
},
}
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Git().CurrentBranchName("feature/bar")
t.Views().Branches().
Focus().
Press("a")
t.ExpectPopup().Prompt().
Title(Equals("Which git command do you want to run?")).
InitialText(Equals("branch")).
Confirm()
t.ExpectPopup().Menu().Title(Equals("Branch:")).Select(Equals("master")).Confirm()
t.Git().CurrentBranchName("master")
},
})
| go | MIT | 80dd695d7a8d32714603f5a6307f26f589802b1d | 2026-01-07T08:35:43.445894Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.