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 14e963b9a..82b4af66e 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 @@ -28,7 +28,10 @@ class App.UserOrganizationAutocompletion extends App.Controller zIndexScale: 1 close: => - @el.removeClass('open') + execute = => + @el.removeClass('open') + @delay( execute, 400, 'close' ) + if @catcher @catcher.remove() @@ -166,8 +169,8 @@ class App.UserOrganizationAutocompletion extends App.Controller @searchTerm = item # hide dropdown - @emptyResultList() if !item && !@attribute.disableCreateUser + @emptyResultList() @$('.recipientList').append( @buildUserNew() ) # show dropdown diff --git a/test/browser/agent_ticket_actions_level5_test.rb b/test/browser/agent_ticket_actions_level5_test.rb index 0eb490906..167fcd341 100644 --- a/test/browser/agent_ticket_actions_level5_test.rb +++ b/test/browser/agent_ticket_actions_level5_test.rb @@ -334,7 +334,12 @@ class AgentTicketActionLevel5Test < TestCase { :where => :instance2, :execute => 'sendkey', - :value => [:arrow_down,:enter] + :value => [:arrow_down] + }, + { + :where => :instance2, + :execute => 'click', + :css => '.active .newTicket .recipientList-entry.js-user.is-active', }, { :where => :instance2, @@ -485,7 +490,12 @@ class AgentTicketActionLevel5Test < TestCase { :where => :instance2, :execute => 'sendkey', - :value => [:arrow_down,:enter] + :value => [:arrow_down] + }, + { + :where => :instance2, + :execute => 'click', + :css => '.modal .recipientList-entry.js-user.is-active', }, { :where => :instance2, diff --git a/test/browser/agent_user_manage_test.rb b/test/browser/agent_user_manage_test.rb index 7c834e35a..8938b2fd1 100644 --- a/test/browser/agent_user_manage_test.rb +++ b/test/browser/agent_user_manage_test.rb @@ -28,11 +28,15 @@ class AgentUserManageTest < TestCase }, { :execute => 'click', - :css => '.active [name="customer_id_completion"]', + :css => '.active .newTicket [name="customer_id_completion"]', }, { :execute => 'sendkey', - :value => [:arrow_down,:enter] + :value => [:arrow_down] + }, + { + :execute => 'click', + :css => '.active .newTicket .recipientList-entry.js-user-new', }, { :execute => 'wait', @@ -154,7 +158,11 @@ class AgentUserManageTest < TestCase }, { :execute => 'sendkey', - :value => [:arrow_down,:enter] + :value => [:arrow_down] + }, + { + :execute => 'click', + :css => '.active .newTicket .recipientList-entry.js-user.is-active', }, { :execute => 'wait', diff --git a/test/browser_test_helper.rb b/test/browser_test_helper.rb index 02b720ca9..e349228ac 100644 --- a/test/browser_test_helper.rb +++ b/test/browser_test_helper.rb @@ -378,11 +378,14 @@ class TestCase < Test::Unit::TestCase element = instance.find_element( { :css => '.active .newTicket input[name="customer_id_completion"]' } ) element.click element.clear + + # in certan cases focus is not set, do it this way + instance.execute_script( '$(".content.active .newTicket input[name=customer_id_completion]").focus()' ) element.send_keys( 'nico*' ) sleep 4 element.send_keys( :arrow_down ) sleep 0.1 - element.send_keys( :enter ) + instance.find_element( { :css => '.active .newTicket .recipientList-entry.js-user.is-active' } ).click sleep 0.3 end if action[:group] @@ -401,11 +404,12 @@ class TestCase < Test::Unit::TestCase element = instance.find_element( { :css => '.active .newTicket [data-name="body"]' } ) element.clear element.send_keys( action[:body] ) + # check if body is filled / in case use workaround body = element.text #puts "body '#{body}'" if !body || body.empty? || body == '' || body == ' ' - result = instance.execute_script( '$(".content.active .newTicket [data-name=body]").text("' + action[:body] + '")' ) + result = instance.execute_script( '$(".content.active .newTicket [data-name=body]").text("' + action[:body] + '").focus()' ) #puts "r #{result.inspect}" end end @@ -414,9 +418,10 @@ class TestCase < Test::Unit::TestCase return end sleep 0.8 - instance.find_element( { :css => '.content.active button.submit' } ).click + #instance.execute_script( '$(".content.active .newTicket form").submit()' ) + instance.find_element( { :css => '.content.active .newTicket button.submit' } ).click sleep 1 - (1..14).each {|loop| + (1..16).each {|loop| if instance.current_url =~ /#{Regexp.quote('#ticket/zoom/')}/ assert( true, "(#{test[:name]}) ticket created" ) sleep 1 @@ -494,7 +499,7 @@ class TestCase < Test::Unit::TestCase keys = action[:value].to_s.split('') keys.each {|key| instance.action.send_keys(key).perform - sleep 0.05 + sleep 0.01 } #element.send_keys( action[:value] ) sleep 0.3