diff --git a/test/helpers.sh b/test/helpers.sh index 5650ca1..1303a20 100644 --- a/test/helpers.sh +++ b/test/helpers.sh @@ -9,11 +9,11 @@ function test_clean_up() { function tmux_send() { local key=$1 - sleep 0.5 + tmuxomatic__sleep 1 tmuxomatic send-keys "$TMUX_PREFIX" - sleep 0.5 + tmuxomatic__sleep 1 tmuxomatic send-keys "$key" - sleep 0.5 + tmuxomatic__sleep 1 } function tmux_paste() { @@ -33,11 +33,11 @@ function init_pane_fish() { function invoke_fingers() { tmux_send "F" - sleep 1.0 + tmuxomatic__sleep 1 } function echo_yanked() { - sleep 0.5 + tmuxomatic__sleep 1 tmuxomatic__exec "clear" tmuxomatic send-keys "echo yanked text is " tmux_paste diff --git a/test/specs/preserve-zoom-state_spec.sh b/test/specs/preserve-zoom-state_spec.sh index 2afaec0..611c6c5 100755 --- a/test/specs/preserve-zoom-state_spec.sh +++ b/test/specs/preserve-zoom-state_spec.sh @@ -17,6 +17,7 @@ tmuxomatic__exec "cat ./test/fixtures/grep-output" invoke_fingers tmuxomatic send-keys C-c +tmuxomatic__sleep 1 tmuxomatic__exec "echo \"current pane is \$(tmux list-panes -F '#{?window_zoomed_flag,zoomed,not_zoomed}' | head -1)\"" tmuxomatic__expect "current pane is zoomed" diff --git a/test/specs/tmux-yank-integration_spec.sh b/test/specs/tmux-yank-integration_spec.sh index 2113f3f..f6e09c1 100755 --- a/test/specs/tmux-yank-integration_spec.sh +++ b/test/specs/tmux-yank-integration_spec.sh @@ -13,7 +13,7 @@ tmuxomatic__exec "cat ./test/fixtures/grep-output" invoke_fingers tmuxomatic send-keys "i" -sleep 10 +tmuxomatic__sleep 1 tmuxomatic__exec "cat /tmp/tmux-yank-result" tmuxomatic__expect "tmux-yank yolo" diff --git a/test/tmuxomatic.sh b/test/tmuxomatic.sh index df2a6b3..adbb8dd 100644 --- a/test/tmuxomatic.sh +++ b/test/tmuxomatic.sh @@ -58,7 +58,7 @@ function tmuxomatic__expect() { TMUXOMATIC_EXIT_CODE=0 break fi - sleep 0.5 + tmuxomatic__sleep 1 done if [[ $n_matches -le 0 ]]; then @@ -75,6 +75,14 @@ function tmuxomatic__expect() { fi } +function tmuxomatic__sleep() { + if [[ -z $CI ]]; then + sleep "$1" + else + sleep "$(($1 * 5))" + fi +} + # TODO not working in BSD, therefore end hook not being called and :skull: function __fn_exists() { local fn_type=$(type "$1" 2> /dev/null)