Fix flaky test cases
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Junegunn Choi · committed by Junegunn Choi · parent 898d8d9 · Browse files · 1 file·+24 added−15 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
1 file+24 added−15 removed
- tests:+24 added−15 removed
Provenance
- Commit
4accc69- Tree
17664ad- Author
Junegunn Choi <junegunn.c@gmail.com>- Committer
Junegunn Choi <junegunn.c@gmail.com>- Parent
898d8d9
1 file changed+24 added−15 removed
modified:test/test_go.rb+24 added-15 removed
1251 unmodified lines1252 tmux.prepare1253 tmux.send_keys 'cat ', 'C-t', pane: 01254 tmux.until(1) { |lines| lines.item_count >= 1 }1255 tmux.send_keys 'fzf-unicode', pane: 11256- tmux.until(1) { |lines| lines[-2].start_with? ' 2/' }1256+ redraw = ->() { tmux.send_keys 'C-l', pane: 1 }1257+ tmux.until(1) { |lines| redraw.(); lines[-2] =~ %r(^ *2/) }1258 1259 tmux.send_keys '1', pane: 11259- tmux.until(1) { |lines| lines[-2].start_with? ' 1/' }1260+ tmux.until(1) { |lines| redraw.(); lines[-2] =~ %r(^ *1/) }1261 tmux.send_keys :BTab, pane: 11261- tmux.until(1) { |lines| lines[-2].include? '(1)' }1262+ tmux.until(1) { |lines| redraw.(); lines[-2].include? '(1)' }1263 1264 tmux.send_keys :BSpace, pane: 11264- tmux.until(1) { |lines| lines[-2].start_with? ' 2/' }1265+ tmux.until(1) { |lines| redraw.(); lines[-2] =~ %r(^ *2/) }1266 1267 tmux.send_keys '2', pane: 11267- tmux.until(1) { |lines| lines[-2].start_with? ' 1/' }1268+ tmux.until(1) { |lines| redraw.(); lines[-2] =~ %r(^ *1/) }1269 tmux.send_keys :BTab, pane: 11269- tmux.until(1) { |lines| lines[-2].include? '(2)' }1270+ tmux.until(1) { |lines| redraw.(); lines[-2].include? '(2)' }1271 1272 tmux.send_keys :Enter, pane: 11272- tmux.until { |lines| lines[-1].include?('cat') || lines[-2].include?('cat') }1273- tmux.until { |lines| lines[-1].include?('fzf-unicode') || lines[-2].include?('fzf-unicode') }1273+ tmux.until do |lines|1274+ tmux.send_keys 'C-l'1275+ [-1, -2].map { |offset| lines[offset] }.any? do |line|1276+ line.start_with?('cat') && line.include?('fzf-unicode')1277+ end1278+ end1279 tmux.send_keys :Enter1280 tmux.until { |lines| lines[-1].include? 'test1test2' }1281 end1282 202 unmodified lines1485 FileUtils.mkdir_p '/tmp/fzf-test'1486 tmux.paste 'cd /tmp/fzf-test; echo -n test3 > "fzf-unicode 테스트1"; echo -n test4 > "fzf-unicode 테스트2"'1487 tmux.prepare1488 tmux.send_keys 'cat fzf-unicode**', :Tab, pane: 01484- tmux.until(1) { |lines| lines[-2].start_with? ' 2/' }1489+ redraw = ->() { tmux.send_keys 'C-l', pane: 1 }1490+ tmux.until(1) { |lines| redraw.(); lines[-2] =~ %r(^ *2/) }1491 1492 tmux.send_keys '1', pane: 11487- tmux.until(1) { |lines| lines[-2].start_with? ' 1/' }1493+ tmux.until(1) { |lines| redraw.(); lines[-2] =~ %r(^ *1/) }1494 tmux.send_keys :BTab, pane: 11489- tmux.until(1) { |lines| lines[-2].include? '(1)' }1495+ tmux.until(1) { |lines| redraw.(); lines[-2].include? '(1)' }1496 1497 tmux.send_keys :BSpace, pane: 11492- tmux.until(1) { |lines| lines[-2].start_with? ' 2/' }1498+ tmux.until(1) { |lines| redraw.(); lines[-2] =~ %r(^ *2/) }1499 1500 tmux.send_keys '2', pane: 11495- tmux.until(1) { |lines| lines[-2].start_with? ' 1/' }1501+ tmux.until(1) { |lines| redraw.(); lines[-2] =~ %r(^ *1/) }1502 tmux.send_keys :BTab, pane: 11497- tmux.until(1) { |lines| lines[-2].include? '(2)' }1503+ tmux.until(1) { |lines| redraw.(); lines[-2].include? '(2)' }1504 1505 tmux.send_keys :Enter, pane: 11500- tmux.until { |lines| lines[-1].include?('cat') || lines[-2].include?('cat') }1506+ tmux.until do |lines|1507+ tmux.send_keys 'C-l'1508+ lines[-1].include?('cat') || lines[-2].include?('cat')1509+ end1510 tmux.send_keys :Enter1511 tmux.until { |lines| lines[-1].include? 'test3test4' }1512 end1513 end53 unmodified lines