# VHS E2E test for lazygitclj - Branch operations
# Tests branch create, checkout, delete, tab switching

Output test/e2e/output/branch-operations.gif
Output test/e2e/output/branch-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-branch && cd /tmp/lazygitclj-e2e-branch && bb --config /home/ajet/repos/lazygitclj/bb.edn start"
Enter
Sleep 2s

# First, stage all files to clean working tree
Type "a"
Sleep 500ms

# Switch to branches panel (3)
Type "3"
Sleep 500ms

# Create new branch with 'n'
Type "n"
Sleep 500ms
Set TypingSpeed 50ms
Type "test-branch"
Enter
Sleep 1s

# Should have created and switched to test-branch
# Navigate to main branch
Type "j"
Sleep 300ms
Type "j"
Sleep 300ms

# Checkout main with space
Type " "
Sleep 1s

# Navigate to test-branch and delete it with 'd'
Type "k"
Sleep 300ms
Type "k"
Sleep 300ms
Type "d"
Sleep 1s

# Branch should be deleted

# Switch to tags tab with ]
Type "]"
Sleep 500ms
Type "]"
Sleep 500ms

# Switch back to local with [
Type "["
Sleep 500ms
Type "["
Sleep 500ms

# Quit
Type "q"
Sleep 1s
