# VHS E2E test for lazygitclj - Commit operations
# Tests staging, committing, and commit panel operations

Output test/e2e/output/commit-operations.gif
Output test/e2e/output/commit-operations.ascii

Require bb

Set Shell "bash"
Set FontSize 14
Set Width 1000
Set Height 600
Set Framerate 10

# Setup test repo and run lazygitclj
Type "./test/e2e/setup-test-repo.sh /tmp/lazygitclj-e2e-commit && cd /tmp/lazygitclj-e2e-commit && bb --config /home/ajet/repos/lazygitclj/bb.edn start"
Enter
Sleep 2s

# Stage a file with space
Type " "
Sleep 500ms

# Stage all with 'a'
Type "a"
Sleep 500ms

# Commit with 'c'
Type "c"
Sleep 500ms
Set TypingSpeed 50ms
Type "Test commit message"
Enter
Sleep 1s

# Should see commit message
# Go to commits panel (4)
Type "4"
Sleep 500ms

# Navigate to see commits
Type "j"
Sleep 300ms

# Checkout a commit with space (will detach HEAD)
# Skip this to avoid detached HEAD state

# Create new branch from commit with 'n'
Type "n"
Sleep 500ms
Type "commit-branch"
Enter
Sleep 1s

# Quit
Type "q"
Sleep 1s
