lazygit
The atago project wrote these specs on its own initiative and runs them in its own CI, to exercise atago against a real program. They are not lazygit’s official test suite, and the lazygit project is not affiliated with atago.
Summary #
1 suite · 21 scenarios
Contents #
- lazygit (third-party git TUI) — 21 scenarios
- version prints the pinned release
- opening a dirty repository shows unstaged changes and quits cleanly
- opening from a nested repository path rejects the subdirectory as invalid
- space stages the selected unstaged file
- space stages an untracked file into the index
- down then space stages only the second modified file
- space toggles a staged file back to unstaged
- space toggles an added file back to untracked
- capital C commits staged changes through git’s editor
- capital C commits pre-staged changes and leaves a clean worktree
- escape cancels the discard dialog and preserves the diff
- enter accepts the discard dialog and reverts the diff
- down then discard reverts only the second modified file
- n creates a new branch from the branch panel
- n creates a slash branch name from the branch panel
- escape cancels the new branch dialog and keeps the current branch
- space checks out the selected branch
- s opens the stash prompt and records a named stash entry
- escape cancels the stash prompt and leaves the diff in place
- g then enter pops the selected stash entry back into the worktree
- g then escape cancels stash pop and keeps the stash stored
lazygit (third-party git TUI) #
lazygit is a terminal interface in front of a real repository: keystrokes stage files, write commits, discard changes, create branches, and push and pop stashes.
Both sides of that are asserted. The rendered screen must show the user what they expect at each checkpoint — otherwise the tool is unusable even when it works — and the repository underneath must have actually changed, checked by reading git state afterwards. A TUI test that only looked at the screen would pass on a version that draws a commit it never made.
Source: test/e2e/thirdparty/lazygit/lazygit.atago.yaml
Scenario: version prints the pinned release #
only when lazygit --version succeeds
When #
lazygit --version
Then #
- exit code is
0 - stdout contains
version=0.63.1
Scenario: opening a dirty repository shows unstaged changes and quits cleanly #
only when lazygit --version succeeds · skipped on Windows
Given #
- Fixture file
repo/a.txtis created. - Fixture file
cfg/config.ymlis created. - The command runs with a cleared environment (passing through: PATH).
Inputs #
Fixture repo/a.txt:
hello
Fixture cfg/config.yml:
gui:
nerdFontsVersion: "3"
showFileTree: false
showBottomLine: false
showCommandLog: false
showRandomTip: false
showFileIcons: false
showListFooter: false
disableStartupPopups: true
promptToReturnFromSubprocess: false
When #
git init -q repo
git -C repo add a.txt
git -C repo -c user.name=atago -c user.email=atago@example.com commit -q -m initial
printf 'more\n' >> repo/a.txt
# interactive (pty): lazygit -ucd ${workdir}/cfg -p ${workdir}/repo
Then #
- after
printf 'more\n' >> repo/a.txt:- exit code is
0
- exit code is
Scenario: opening from a nested repository path rejects the subdirectory as invalid #
only when lazygit --version succeeds · skipped on Windows
Given #
- Fixture file
repo/sub/note.txtis created. - Fixture file
cfg/config.ymlis created. - The command runs with a cleared environment (passing through: PATH).
Inputs #
Fixture repo/sub/note.txt:
hello
Fixture cfg/config.yml:
gui:
nerdFontsVersion: "3"
showFileTree: false
showBottomLine: false
showCommandLog: false
showRandomTip: false
showFileIcons: false
showListFooter: false
disableStartupPopups: true
promptToReturnFromSubprocess: false
When #
git init -q repo
git -C repo add sub/note.txt
git -C repo -c user.name=atago -c user.email=atago@example.com commit -q -m initial
printf 'nested\n' >> repo/sub/note.txt
# interactive (pty): lazygit -ucd ${workdir}/cfg -p ${workdir}/repo/sub
git -C repo status --porcelain
Then #
- after
git -C repo status --porcelain:- exit code is
0 - stdout equals an exact value
- exit code is
Scenario: space stages the selected unstaged file #
only when lazygit --version succeeds · skipped on Windows
Given #
- Fixture file
repo/a.txtis created. - Fixture file
repo/b.txtis created. - Fixture file
cfg/config.ymlis created. - The command runs with a cleared environment (passing through: PATH).
Inputs #
Fixture repo/a.txt:
hello
Fixture repo/b.txt:
new
Fixture cfg/config.yml:
gui:
nerdFontsVersion: "3"
showFileTree: false
showBottomLine: false
showCommandLog: false
showRandomTip: false
showFileIcons: false
showListFooter: false
disableStartupPopups: true
promptToReturnFromSubprocess: false
When #
git init -q repo
git -C repo add a.txt
git -C repo -c user.name=atago -c user.email=atago@example.com commit -q -m initial
printf 'more\n' >> repo/a.txt
# interactive (pty): lazygit -ucd ${workdir}/cfg -p ${workdir}/repo
git -C repo status --porcelain
Then #
- after
git -C repo status --porcelain:- exit code is
0 - stdout contains
M a.txt,?? b.txt
- exit code is
Scenario: space stages an untracked file into the index #
only when lazygit --version succeeds · skipped on Windows
Given #
- Fixture file
repo/a.txtis created. - Fixture file
repo/b.txtis created. - Fixture file
cfg/config.ymlis created. - The command runs with a cleared environment (passing through: PATH).
Inputs #
Fixture repo/a.txt:
hello
Fixture repo/b.txt:
new
Fixture cfg/config.yml:
gui:
nerdFontsVersion: "3"
showFileTree: false
showBottomLine: false
showCommandLog: false
showRandomTip: false
showFileIcons: false
showListFooter: false
disableStartupPopups: true
promptToReturnFromSubprocess: false
When #
git init -q repo
git -C repo add a.txt
git -C repo -c user.name=atago -c user.email=atago@example.com commit -q -m initial
# interactive (pty): lazygit -ucd ${workdir}/cfg -p ${workdir}/repo
git -C repo status --porcelain
Then #
- after
git -C repo status --porcelain:- exit code is
0 - stdout equals an exact value
- exit code is
Scenario: down then space stages only the second modified file #
only when lazygit --version succeeds · skipped on Windows
Given #
- Fixture file
repo/a.txtis created. - Fixture file
repo/b.txtis created. - Fixture file
cfg/config.ymlis created. - The command runs with a cleared environment (passing through: PATH).
Inputs #
Fixture repo/a.txt:
hello
Fixture repo/b.txt:
world
Fixture cfg/config.yml:
gui:
nerdFontsVersion: "3"
showFileTree: false
showBottomLine: false
showCommandLog: false
showRandomTip: false
showFileIcons: false
showListFooter: false
disableStartupPopups: true
promptToReturnFromSubprocess: false
When #
git init -q repo
git -C repo add a.txt b.txt
git -C repo -c user.name=atago -c user.email=atago@example.com commit -q -m initial
printf 'more-a\n' >> repo/a.txt && printf 'more-b\n' >> repo/b.txt
# interactive (pty): lazygit -ucd ${workdir}/cfg -p ${workdir}/repo
git -C repo status --porcelain
Then #
- after
git -C repo status --porcelain:- exit code is
0 - stdout contains
M a.txt,M b.txt
- exit code is
Scenario: space toggles a staged file back to unstaged #
only when lazygit --version succeeds · skipped on Windows
Given #
- Fixture file
repo/a.txtis created. - Fixture file
cfg/config.ymlis created. - The command runs with a cleared environment (passing through: PATH).
Inputs #
Fixture repo/a.txt:
hello
Fixture cfg/config.yml:
gui:
nerdFontsVersion: "3"
showFileTree: false
showBottomLine: false
showCommandLog: false
showRandomTip: false
showFileIcons: false
showListFooter: false
disableStartupPopups: true
promptToReturnFromSubprocess: false
When #
git init -q repo
git -C repo add a.txt
git -C repo -c user.name=atago -c user.email=atago@example.com commit -q -m initial
printf 'more\n' >> repo/a.txt && git -C repo add a.txt
# interactive (pty): lazygit -ucd ${workdir}/cfg -p ${workdir}/repo
git -C repo status --porcelain
Then #
- after
git -C repo status --porcelain:- exit code is
0 - stdout equals an exact value
- exit code is
Scenario: space toggles an added file back to untracked #
only when lazygit --version succeeds · skipped on Windows
Given #
- Fixture file
repo/a.txtis created. - Fixture file
repo/b.txtis created. - Fixture file
cfg/config.ymlis created. - The command runs with a cleared environment (passing through: PATH).
Inputs #
Fixture repo/a.txt:
hello
Fixture repo/b.txt:
new
Fixture cfg/config.yml:
gui:
nerdFontsVersion: "3"
showFileTree: false
showBottomLine: false
showCommandLog: false
showRandomTip: false
showFileIcons: false
showListFooter: false
disableStartupPopups: true
promptToReturnFromSubprocess: false
When #
git init -q repo
git -C repo add a.txt
git -C repo -c user.name=atago -c user.email=atago@example.com commit -q -m initial
git -C repo add b.txt
# interactive (pty): lazygit -ucd ${workdir}/cfg -p ${workdir}/repo
git -C repo status --porcelain
Then #
- after
git -C repo status --porcelain:- exit code is
0 - stdout equals an exact value
- exit code is
Scenario: capital C commits staged changes through git’s editor #
only when lazygit --version succeeds · skipped on Windows
Given #
- Fixture file
repo/a.txtis created. - Fixture file
editor.shis created. - Fixture file
cfg/config.ymlis created. - The command runs with a cleared environment (passing through: PATH).
Inputs #
Fixture repo/a.txt:
hello
Fixture editor.sh:
#!/bin/sh
printf 'editor commit\n' > "$1"
Fixture cfg/config.yml:
gui:
nerdFontsVersion: "3"
showFileTree: false
showBottomLine: false
showCommandLog: false
showRandomTip: false
showFileIcons: false
showListFooter: false
disableStartupPopups: true
promptToReturnFromSubprocess: false
When #
git init -q repo
git -C repo add a.txt
git -C repo -c user.name=atago -c user.email=atago@example.com commit -q -m initial
git -C repo config user.name atago
git -C repo config user.email atago@example.com
printf 'more\n' >> repo/a.txt
chmod +x editor.sh
git -C repo config core.editor ${workdir}/editor.sh
# interactive (pty): lazygit -ucd ${workdir}/cfg -p ${workdir}/repo
git -C repo log --oneline -1
Then #
- after
git -C repo log --oneline -1:- exit code is
0 - stdout contains
editor commit
- exit code is
Scenario: capital C commits pre-staged changes and leaves a clean worktree #
only when lazygit --version succeeds · skipped on Windows
Given #
- Fixture file
repo/a.txtis created. - Fixture file
editor.shis created. - Fixture file
cfg/config.ymlis created. - The command runs with a cleared environment (passing through: PATH).
Inputs #
Fixture repo/a.txt:
hello
Fixture editor.sh:
#!/bin/sh
printf 'pre-staged commit\n' > "$1"
Fixture cfg/config.yml:
gui:
nerdFontsVersion: "3"
showFileTree: false
showBottomLine: false
showCommandLog: false
showRandomTip: false
showFileIcons: false
showListFooter: false
disableStartupPopups: true
promptToReturnFromSubprocess: false
When #
git init -q repo
git -C repo add a.txt
git -C repo -c user.name=atago -c user.email=atago@example.com commit -q -m initial
git -C repo config user.name atago
git -C repo config user.email atago@example.com
printf 'more\n' >> repo/a.txt && git -C repo add a.txt
chmod +x editor.sh
git -C repo config core.editor ${workdir}/editor.sh
# interactive (pty): lazygit -ucd ${workdir}/cfg -p ${workdir}/repo
git -C repo status --porcelain
git -C repo log --oneline -1
Then #
- after
git -C repo status --porcelain:- exit code is
0 - stdout is empty
- exit code is
- after
git -C repo log --oneline -1:- exit code is
0 - stdout contains
pre-staged commit
- exit code is
Scenario: escape cancels the discard dialog and preserves the diff #
only when lazygit --version succeeds · skipped on Windows
Given #
- Fixture file
repo/a.txtis created. - Fixture file
cfg/config.ymlis created. - The command runs with a cleared environment (passing through: PATH).
Inputs #
Fixture repo/a.txt:
hello
Fixture cfg/config.yml:
gui:
nerdFontsVersion: "3"
showFileTree: false
showBottomLine: false
showCommandLog: false
showRandomTip: false
showFileIcons: false
showListFooter: false
disableStartupPopups: true
promptToReturnFromSubprocess: false
When #
git init -q repo
git -C repo add a.txt
git -C repo -c user.name=atago -c user.email=atago@example.com commit -q -m initial
printf 'more\n' >> repo/a.txt
# interactive (pty): lazygit -ucd ${workdir}/cfg -p ${workdir}/repo
git -C repo diff -- a.txt
Then #
- after
git -C repo diff -- a.txt:- exit code is
0 - stdout contains
+more
- exit code is
Scenario: enter accepts the discard dialog and reverts the diff #
only when lazygit --version succeeds · skipped on Windows
Given #
- Fixture file
repo/a.txtis created. - Fixture file
cfg/config.ymlis created. - The command runs with a cleared environment (passing through: PATH).
Inputs #
Fixture repo/a.txt:
hello
Fixture cfg/config.yml:
gui:
nerdFontsVersion: "3"
showFileTree: false
showBottomLine: false
showCommandLog: false
showRandomTip: false
showFileIcons: false
showListFooter: false
disableStartupPopups: true
promptToReturnFromSubprocess: false
When #
git init -q repo
git -C repo add a.txt
git -C repo -c user.name=atago -c user.email=atago@example.com commit -q -m initial
printf 'more\n' >> repo/a.txt
# interactive (pty): lazygit -ucd ${workdir}/cfg -p ${workdir}/repo
git -C repo diff -- a.txt
Then #
- after
git -C repo diff -- a.txt:- exit code is
0 - stdout is empty
- exit code is
Scenario: down then discard reverts only the second modified file #
only when lazygit --version succeeds · skipped on Windows
Given #
- Fixture file
repo/a.txtis created. - Fixture file
repo/b.txtis created. - Fixture file
cfg/config.ymlis created. - The command runs with a cleared environment (passing through: PATH).
Inputs #
Fixture repo/a.txt:
hello
Fixture repo/b.txt:
world
Fixture cfg/config.yml:
gui:
nerdFontsVersion: "3"
showFileTree: false
showBottomLine: false
showCommandLog: false
showRandomTip: false
showFileIcons: false
showListFooter: false
disableStartupPopups: true
promptToReturnFromSubprocess: false
When #
git init -q repo
git -C repo add a.txt b.txt
git -C repo -c user.name=atago -c user.email=atago@example.com commit -q -m initial
printf 'more-a\n' >> repo/a.txt && printf 'more-b\n' >> repo/b.txt
# interactive (pty): lazygit -ucd ${workdir}/cfg -p ${workdir}/repo
git -C repo diff -- a.txt
git -C repo diff -- b.txt
Then #
- after
git -C repo diff -- a.txt:- exit code is
0 - stdout contains
+more-a
- exit code is
- after
git -C repo diff -- b.txt:- exit code is
0 - stdout is empty
- exit code is
Scenario: n creates a new branch from the branch panel #
only when lazygit --version succeeds · skipped on Windows
Given #
- Fixture file
repo/a.txtis created. - Fixture file
cfg/config.ymlis created. - The command runs with a cleared environment (passing through: PATH).
Inputs #
Fixture repo/a.txt:
hello
Fixture cfg/config.yml:
gui:
nerdFontsVersion: "3"
showFileTree: false
showBottomLine: false
showCommandLog: false
showRandomTip: false
showFileIcons: false
showListFooter: false
disableStartupPopups: true
promptToReturnFromSubprocess: false
When #
git init -q repo
git -C repo add a.txt
git -C repo -c user.name=atago -c user.email=atago@example.com commit -q -m initial
# interactive (pty): lazygit -ucd ${workdir}/cfg -p ${workdir}/repo branch
git -C repo branch --show-current
Then #
- after
git -C repo branch --show-current:- exit code is
0 - stdout equals an exact value
- exit code is
Scenario: n creates a slash branch name from the branch panel #
only when lazygit --version succeeds · skipped on Windows
Given #
- Fixture file
repo/a.txtis created. - Fixture file
cfg/config.ymlis created. - The command runs with a cleared environment (passing through: PATH).
Inputs #
Fixture repo/a.txt:
hello
Fixture cfg/config.yml:
gui:
nerdFontsVersion: "3"
showFileTree: false
showBottomLine: false
showCommandLog: false
showRandomTip: false
showFileIcons: false
showListFooter: false
disableStartupPopups: true
promptToReturnFromSubprocess: false
When #
git init -q repo
git -C repo add a.txt
git -C repo -c user.name=atago -c user.email=atago@example.com commit -q -m initial
# interactive (pty): lazygit -ucd ${workdir}/cfg -p ${workdir}/repo branch
git -C repo branch --show-current
Then #
- after
git -C repo branch --show-current:- exit code is
0 - stdout equals an exact value
- exit code is
Scenario: escape cancels the new branch dialog and keeps the current branch #
only when lazygit --version succeeds · skipped on Windows
Given #
- Fixture file
repo/a.txtis created. - Fixture file
cfg/config.ymlis created. - The command runs with a cleared environment (passing through: PATH).
Inputs #
Fixture repo/a.txt:
hello
Fixture cfg/config.yml:
gui:
nerdFontsVersion: "3"
showFileTree: false
showBottomLine: false
showCommandLog: false
showRandomTip: false
showFileIcons: false
showListFooter: false
disableStartupPopups: true
promptToReturnFromSubprocess: false
When #
git init -q repo
git -C repo add a.txt
git -C repo -c user.name=atago -c user.email=atago@example.com commit -q -m initial
# interactive (pty): lazygit -ucd ${workdir}/cfg -p ${workdir}/repo branch
git -C repo branch --show-current
Then #
- after
git -C repo branch --show-current:- exit code is
0 - stdout equals an exact value
- exit code is
Scenario: space checks out the selected branch #
only when lazygit --version succeeds · skipped on Windows
Given #
- Fixture file
repo/a.txtis created. - Fixture file
cfg/config.ymlis created. - The command runs with a cleared environment (passing through: PATH).
Inputs #
Fixture repo/a.txt:
hello
Fixture cfg/config.yml:
gui:
nerdFontsVersion: "3"
showFileTree: false
showBottomLine: false
showCommandLog: false
showRandomTip: false
showFileIcons: false
showListFooter: false
disableStartupPopups: true
promptToReturnFromSubprocess: false
When #
git init -q repo
git -C repo add a.txt
git -C repo -c user.name=atago -c user.email=atago@example.com commit -q -m initial
git -C repo branch feature-one
# interactive (pty): lazygit -ucd ${workdir}/cfg -p ${workdir}/repo branch
git -C repo branch --show-current
Then #
- after
git -C repo branch --show-current:- exit code is
0 - stdout equals an exact value
- exit code is
Scenario: s opens the stash prompt and records a named stash entry #
only when lazygit --version succeeds · skipped on Windows
Given #
- Fixture file
repo/a.txtis created. - Fixture file
cfg/config.ymlis created. - The command runs with a cleared environment (passing through: PATH).
Inputs #
Fixture repo/a.txt:
hello
Fixture cfg/config.yml:
gui:
nerdFontsVersion: "3"
showFileTree: false
showBottomLine: false
showCommandLog: false
showRandomTip: false
showFileIcons: false
showListFooter: false
disableStartupPopups: true
promptToReturnFromSubprocess: false
When #
git init -q repo
git -C repo add a.txt
git -C repo -c user.name=atago -c user.email=atago@example.com commit -q -m initial
printf 'more\n' >> repo/a.txt
# interactive (pty): lazygit -ucd ${workdir}/cfg -p ${workdir}/repo
git -C repo stash list
git -C repo diff -- a.txt
Then #
- after
git -C repo stash list:- exit code is
0 - stdout contains
stash@{0},probe stash
- exit code is
- after
git -C repo diff -- a.txt:- exit code is
0 - stdout is empty
- exit code is
Scenario: escape cancels the stash prompt and leaves the diff in place #
only when lazygit --version succeeds · skipped on Windows
Given #
- Fixture file
repo/a.txtis created. - Fixture file
cfg/config.ymlis created. - The command runs with a cleared environment (passing through: PATH).
Inputs #
Fixture repo/a.txt:
hello
Fixture cfg/config.yml:
gui:
nerdFontsVersion: "3"
showFileTree: false
showBottomLine: false
showCommandLog: false
showRandomTip: false
showFileIcons: false
showListFooter: false
disableStartupPopups: true
promptToReturnFromSubprocess: false
When #
git init -q repo
git -C repo add a.txt
git -C repo -c user.name=atago -c user.email=atago@example.com commit -q -m initial
printf 'more\n' >> repo/a.txt
# interactive (pty): lazygit -ucd ${workdir}/cfg -p ${workdir}/repo
git -C repo stash list
git -C repo diff -- a.txt
Then #
- after
git -C repo stash list:- exit code is
0 - stdout is empty
- exit code is
- after
git -C repo diff -- a.txt:- exit code is
0 - stdout contains
+more
- exit code is
Scenario: g then enter pops the selected stash entry back into the worktree #
only when lazygit --version succeeds · skipped on Windows
Given #
- Fixture file
repo/a.txtis created. - Fixture file
cfg/config.ymlis created. - The command runs with a cleared environment (passing through: PATH).
Inputs #
Fixture repo/a.txt:
hello
Fixture cfg/config.yml:
gui:
nerdFontsVersion: "3"
showFileTree: false
showBottomLine: false
showCommandLog: false
showRandomTip: false
showFileIcons: false
showListFooter: false
disableStartupPopups: true
promptToReturnFromSubprocess: false
When #
git init -q repo
git -C repo add a.txt
git -C repo -c user.name=atago -c user.email=atago@example.com commit -q -m initial
printf 'more\n' >> repo/a.txt
git -C repo stash push -m probe
# interactive (pty): lazygit -ucd ${workdir}/cfg -p ${workdir}/repo stash
git -C repo stash list
git -C repo diff -- a.txt
Then #
- after
git -C repo stash list:- exit code is
0 - stdout is empty
- exit code is
- after
git -C repo diff -- a.txt:- exit code is
0 - stdout contains
+more
- exit code is
Scenario: g then escape cancels stash pop and keeps the stash stored #
only when lazygit --version succeeds · skipped on Windows
Given #
- Fixture file
repo/a.txtis created. - Fixture file
cfg/config.ymlis created. - The command runs with a cleared environment (passing through: PATH).
Inputs #
Fixture repo/a.txt:
hello
Fixture cfg/config.yml:
gui:
nerdFontsVersion: "3"
showFileTree: false
showBottomLine: false
showCommandLog: false
showRandomTip: false
showFileIcons: false
showListFooter: false
disableStartupPopups: true
promptToReturnFromSubprocess: false
When #
git init -q repo
git -C repo add a.txt
git -C repo -c user.name=atago -c user.email=atago@example.com commit -q -m initial
printf 'more\n' >> repo/a.txt
git -C repo stash push -m probe
# interactive (pty): lazygit -ucd ${workdir}/cfg -p ${workdir}/repo stash
git -C repo stash list
git -C repo diff -- a.txt
Then #
- after
git -C repo stash list:- exit code is
0 - stdout contains
stash@{0},probe
- exit code is
- after
git -C repo diff -- a.txt:- exit code is
0 - stdout is empty
- exit code is