From 403913f404698e88e8d18fe9e4d3d5afd425bff2 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Tue, 2 Dec 2014 14:07:35 +0100 Subject: [PATCH] Improved error handling. --- ...user_organization_autocompletion.js.coffee | 2 -- test/browser_test_helper.rb | 22 ++++++++++--------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/app/assets/javascripts/app/lib/app_post/user_organization_autocompletion.js.coffee b/app/assets/javascripts/app/lib/app_post/user_organization_autocompletion.js.coffee index 5c7f70839..14e963b9a 100644 --- a/app/assets/javascripts/app/lib/app_post/user_organization_autocompletion.js.coffee +++ b/app/assets/javascripts/app/lib/app_post/user_organization_autocompletion.js.coffee @@ -21,7 +21,6 @@ class App.UserOrganizationAutocompletion extends App.Controller @el open: => - @emptyResultList() @el.addClass('open') @catcher = new App.clickCatcher holder: @el.offsetParent() @@ -29,7 +28,6 @@ class App.UserOrganizationAutocompletion extends App.Controller zIndexScale: 1 close: => - @emptyResultList() @el.removeClass('open') if @catcher @catcher.remove() diff --git a/test/browser_test_helper.rb b/test/browser_test_helper.rb index 24d21f231..02b720ca9 100644 --- a/test/browser_test_helper.rb +++ b/test/browser_test_helper.rb @@ -260,14 +260,18 @@ class TestCase < Test::Unit::TestCase loops = (timeout / 0.5).to_i text = '' (1..loops).each { |loop| - element = instance.find_element( { :css => action[:area] } ) - if element.displayed? - text = element.text - if text =~ /#{action[:value]}/i - assert( true, "(#{test[:name]}) '#{action[:value]}' found in '#{text}'" ) - sleep 0.4 - return + begin + element = instance.find_element( { :css => action[:area] } ) + if element && element.displayed? + text = element.text + if text =~ /#{action[:value]}/i + assert( true, "(#{test[:name]}) '#{action[:value]}' found in '#{text}'" ) + sleep 0.4 + return + end end + rescue => e + puts e.message end sleep 0.5 } @@ -376,10 +380,8 @@ class TestCase < Test::Unit::TestCase element.clear element.send_keys( 'nico*' ) sleep 4 - element = instance.find_element( { :css => '.active .newTicket input[name="customer_id_completion"]' } ) element.send_keys( :arrow_down ) - sleep 0.3 - element = instance.find_element( { :css => '.active .newTicket input[name="customer_id_completion"]' } ) + sleep 0.1 element.send_keys( :enter ) sleep 0.3 end