#!/usr/bin/expect -f

set timeout 120

# we need to have at least 39 lines
# (the halloween holiday screen needs that height)
set stty_init "rows 39 cols 80"

# need to create directories until upstream bug #26660 is fixed
file mkdir ~/.config
file mkdir ~/.local/share

set env(LANG) "en_US.UTF-8"
set env(TERM) "linux"

spawn cataclysm

expect_before {
	timeout { puts "timeout"; exit 1 }
}

# title screen
expect "Version: "
expect "ew Game*"

# start a new game
send -- "N"
expect "Play Now!*"
send -- "N"

# loading screens
expect "Loading files"
expect "Finalizing"
expect "Please wait as we build your world"

# now ingame
expect "Press }*to open sidebar options"

# save game
send -- "S"
expect "Save and quit?*"
send -- "Y"

# title screen
expect "Version: "
expect "ew Game*"

# load game
send -- "a"
expect "?*"
send -- "\r"
expect "?*"
send -- "\r"

# loading screens
expect "Loading files"
expect "Finalizing"
expect "Please wait"
expect "Loading the save"
expect "Press }*to open sidebar options"

# end the game
send -- "Q"
expect "Commit suicide?*"
send -- "Y"
expect "REALLY commit suicide?*"
send -- "Y"
expect "In memory of:"
expect "Last Words:*"
send -- "\r"
expect "?*"
send -- "q"
expect "ACHIEVEMENTS*"
sleep 1
send -- "q"
expect "Your Followers*"
send -- "q"

# back to title screen
expect "Version: "
expect "ew Game*"

# quit
send -- "Q"
expect eof

