diff --git a/app/controllers/long_polling_controller.rb b/app/controllers/long_polling_controller.rb index 9b63d4c4a..727e8006e 100644 --- a/app/controllers/long_polling_controller.rb +++ b/app/controllers/long_polling_controller.rb @@ -37,14 +37,15 @@ class LongPollingController < ApplicationController spool.each { |item| if item[:type] == 'direct' log 'notice', "send spool to (user_id=#{ current_user.id })", client_id - Session.send( client_id, item[:message] ) + Session.send( client_id, item[:message]['data'] ) else log 'notice', "send spool", client_id - Session.send( client_id, item[:message] ) + Session.send( client_id, item[:message]['data'] ) end } # send spool:sent event to client + sleep 0.2 log 'notice', "send spool:sent event", client_id Session.send( client_id, { :event => 'spool:sent' } ) end diff --git a/test/browser/chat_test.rb b/test/browser/chat_test.rb index 2d551155d..f300b38d7 100644 --- a/test/browser/chat_test.rb +++ b/test/browser/chat_test.rb @@ -93,10 +93,35 @@ class ChatTest < TestCase :value => message, :match_result => true, }, -# { -# :execute => 'wait', -# :value => 1, -# }, + { + :where => :instance1, + :execute => 'navigate', + :to => browser_url, + }, + { + :execute => 'wait', + :value => 8, + }, + { + :where => :instance1, + :execute => 'click', + :css => '#chat_toogle', + }, + { + :execute => 'wait', + :value => 1, + }, + { + :where => :instance1, + :execute => 'match', + :css => '#chat_log_container', + :value => message, + :match_result => true, + }, + { + :execute => 'wait', + :value => 8, + }, ], }, ] diff --git a/test/browser_test_helper.rb b/test/browser_test_helper.rb index 0ac3789c8..cb6f6fa0d 100644 --- a/test/browser_test_helper.rb +++ b/test/browser_test_helper.rb @@ -198,6 +198,8 @@ class TestCase < Test::Unit::TestCase break end end + elsif action[:execute] == 'navigate' + instance.navigate.to( action[:to] ) else assert( false, "(#{test[:name]}) unknow selector for '#{action[:element]}'" ) end @@ -289,6 +291,7 @@ class TestCase < Test::Unit::TestCase end elsif action[:execute] == 'check' elsif action[:execute] == 'close_all_tasks' + elsif action[:execute] == 'navigate' else assert( false, "(#{test[:name]}) unknow action '#{action[:execute]}'" ) end