summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2016-11-08 02:19:05 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2016-11-08 02:19:05 +0900
commit4accc6902212fde0bf4fa53e1dbe4de96978a11a (patch)
tree17664ad30efd97e9cabef2f5531e78769f82aea5
parent898d8d94c858774b02668c1490068cf086a1f9f0 (diff)
Fix flaky test cases
-rw-r--r--test/test_go.rb39
1 files changed, 24 insertions, 15 deletions
diff --git a/test/test_go.rb b/test/test_go.rb
index 3fdfddd6..4cd4a4f7 100644
--- a/test/test_go.rb
+++ b/test/test_go.rb
@@ -1253,24 +1253,29 @@ module TestShell
tmux.send_keys 'cat ', 'C-t', pane: 0
tmux.until(1) { |lines| lines.item_count >= 1 }
tmux.send_keys 'fzf-unicode', pane: 1
- tmux.until(1) { |lines| lines[-2].start_with? ' 2/' }
+ redraw = ->() { tmux.send_keys 'C-l', pane: 1 }
+ tmux.until(1) { |lines| redraw.(); lines[-2] =~ %r(^ *2/) }
tmux.send_keys '1', pane: 1
- tmux.until(1) { |lines| lines[-2].start_with? ' 1/' }
+ tmux.until(1) { |lines| redraw.(); lines[-2] =~ %r(^ *1/) }
tmux.send_keys :BTab, pane: 1
- tmux.until(1) { |lines| lines[-2].include? '(1)' }
+ tmux.until(1) { |lines| redraw.(); lines[-2].include? '(1)' }
tmux.send_keys :BSpace, pane: 1
- tmux.until(1) { |lines| lines[-2].start_with? ' 2/' }
+ tmux.until(1) { |lines| redraw.(); lines[-2] =~ %r(^ *2/) }
tmux.send_keys '2', pane: 1
- tmux.until(1) { |lines| lines[-2].start_with? ' 1/' }
+ tmux.until(1) { |lines| redraw.(); lines[-2] =~ %r(^ *1/) }
tmux.send_keys :BTab, pane: 1
- tmux.until(1) { |lines| lines[-2].include? '(2)' }
+ tmux.until(1) { |lines| redraw.(); lines[-2].include? '(2)' }
tmux.send_keys :Enter, pane: 1
- tmux.until { |lines| lines[-1].include?('cat') || lines[-2].include?('cat') }
- tmux.until { |lines| lines[-1].include?('fzf-unicode') || lines[-2].include?('fzf-unicode') }
+ tmux.until do |lines|
+ tmux.send_keys 'C-l'
+ [-1, -2].map { |offset| lines[offset] }.any? do |line|
+ line.start_with?('cat') && line.include?('fzf-unicode')
+ end
+ end
tmux.send_keys :Enter
tmux.until { |lines| lines[-1].include? 'test1test2' }
end
@@ -1481,23 +1486,27 @@ module CompletionTest
tmux.paste 'cd /tmp/fzf-test; echo -n test3 > "fzf-unicode 테스트1"; echo -n test4 > "fzf-unicode 테스트2"'
tmux.prepare
tmux.send_keys 'cat fzf-unicode**', :Tab, pane: 0
- tmux.until(1) { |lines| lines[-2].start_with? ' 2/' }
+ redraw = ->() { tmux.send_keys 'C-l', pane: 1 }
+ tmux.until(1) { |lines| redraw.(); lines[-2] =~ %r(^ *2/) }
tmux.send_keys '1', pane: 1
- tmux.until(1) { |lines| lines[-2].start_with? ' 1/' }
+ tmux.until(1) { |lines| redraw.(); lines[-2] =~ %r(^ *1/) }
tmux.send_keys :BTab, pane: 1
- tmux.until(1) { |lines| lines[-2].include? '(1)' }
+ tmux.until(1) { |lines| redraw.(); lines[-2].include? '(1)' }
tmux.send_keys :BSpace, pane: 1
- tmux.until(1) { |lines| lines[-2].start_with? ' 2/' }
+ tmux.until(1) { |lines| redraw.(); lines[-2] =~ %r(^ *2/) }
tmux.send_keys '2', pane: 1
- tmux.until(1) { |lines| lines[-2].start_with? ' 1/' }
+ tmux.until(1) { |lines| redraw.(); lines[-2] =~ %r(^ *1/) }
tmux.send_keys :BTab, pane: 1
- tmux.until(1) { |lines| lines[-2].include? '(2)' }
+ tmux.until(1) { |lines| redraw.(); lines[-2].include? '(2)' }
tmux.send_keys :Enter, pane: 1
- tmux.until { |lines| lines[-1].include?('cat') || lines[-2].include?('cat') }
+ tmux.until do |lines|
+ tmux.send_keys 'C-l'
+ lines[-1].include?('cat') || lines[-2].include?('cat')
+ end
tmux.send_keys :Enter
tmux.until { |lines| lines[-1].include? 'test3test4' }
end