Improved customer selection.

This commit is contained in:
Martin Edenhofer 2014-12-02 22:34:46 +01:00
parent 403913f404
commit d71d47255b
4 changed files with 38 additions and 12 deletions

View file

@ -28,7 +28,10 @@ class App.UserOrganizationAutocompletion extends App.Controller
zIndexScale: 1 zIndexScale: 1
close: => close: =>
execute = =>
@el.removeClass('open') @el.removeClass('open')
@delay( execute, 400, 'close' )
if @catcher if @catcher
@catcher.remove() @catcher.remove()
@ -166,8 +169,8 @@ class App.UserOrganizationAutocompletion extends App.Controller
@searchTerm = item @searchTerm = item
# hide dropdown # hide dropdown
@emptyResultList()
if !item && !@attribute.disableCreateUser if !item && !@attribute.disableCreateUser
@emptyResultList()
@$('.recipientList').append( @buildUserNew() ) @$('.recipientList').append( @buildUserNew() )
# show dropdown # show dropdown

View file

@ -334,7 +334,12 @@ class AgentTicketActionLevel5Test < TestCase
{ {
:where => :instance2, :where => :instance2,
:execute => 'sendkey', :execute => 'sendkey',
:value => [:arrow_down,:enter] :value => [:arrow_down]
},
{
:where => :instance2,
:execute => 'click',
:css => '.active .newTicket .recipientList-entry.js-user.is-active',
}, },
{ {
:where => :instance2, :where => :instance2,
@ -485,7 +490,12 @@ class AgentTicketActionLevel5Test < TestCase
{ {
:where => :instance2, :where => :instance2,
:execute => 'sendkey', :execute => 'sendkey',
:value => [:arrow_down,:enter] :value => [:arrow_down]
},
{
:where => :instance2,
:execute => 'click',
:css => '.modal .recipientList-entry.js-user.is-active',
}, },
{ {
:where => :instance2, :where => :instance2,

View file

@ -28,11 +28,15 @@ class AgentUserManageTest < TestCase
}, },
{ {
:execute => 'click', :execute => 'click',
:css => '.active [name="customer_id_completion"]', :css => '.active .newTicket [name="customer_id_completion"]',
}, },
{ {
:execute => 'sendkey', :execute => 'sendkey',
:value => [:arrow_down,:enter] :value => [:arrow_down]
},
{
:execute => 'click',
:css => '.active .newTicket .recipientList-entry.js-user-new',
}, },
{ {
:execute => 'wait', :execute => 'wait',
@ -154,7 +158,11 @@ class AgentUserManageTest < TestCase
}, },
{ {
:execute => 'sendkey', :execute => 'sendkey',
:value => [:arrow_down,:enter] :value => [:arrow_down]
},
{
:execute => 'click',
:css => '.active .newTicket .recipientList-entry.js-user.is-active',
}, },
{ {
:execute => 'wait', :execute => 'wait',

View file

@ -378,11 +378,14 @@ class TestCase < Test::Unit::TestCase
element = instance.find_element( { :css => '.active .newTicket input[name="customer_id_completion"]' } ) element = instance.find_element( { :css => '.active .newTicket input[name="customer_id_completion"]' } )
element.click element.click
element.clear 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*' ) element.send_keys( 'nico*' )
sleep 4 sleep 4
element.send_keys( :arrow_down ) element.send_keys( :arrow_down )
sleep 0.1 sleep 0.1
element.send_keys( :enter ) instance.find_element( { :css => '.active .newTicket .recipientList-entry.js-user.is-active' } ).click
sleep 0.3 sleep 0.3
end end
if action[:group] if action[:group]
@ -401,11 +404,12 @@ class TestCase < Test::Unit::TestCase
element = instance.find_element( { :css => '.active .newTicket [data-name="body"]' } ) element = instance.find_element( { :css => '.active .newTicket [data-name="body"]' } )
element.clear element.clear
element.send_keys( action[:body] ) element.send_keys( action[:body] )
# check if body is filled / in case use workaround # check if body is filled / in case use workaround
body = element.text body = element.text
#puts "body '#{body}'" #puts "body '#{body}'"
if !body || body.empty? || 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}" #puts "r #{result.inspect}"
end end
end end
@ -414,9 +418,10 @@ class TestCase < Test::Unit::TestCase
return return
end end
sleep 0.8 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 sleep 1
(1..14).each {|loop| (1..16).each {|loop|
if instance.current_url =~ /#{Regexp.quote('#ticket/zoom/')}/ if instance.current_url =~ /#{Regexp.quote('#ticket/zoom/')}/
assert( true, "(#{test[:name]}) ticket created" ) assert( true, "(#{test[:name]}) ticket created" )
sleep 1 sleep 1
@ -494,7 +499,7 @@ class TestCase < Test::Unit::TestCase
keys = action[:value].to_s.split('') keys = action[:value].to_s.split('')
keys.each {|key| keys.each {|key|
instance.action.send_keys(key).perform instance.action.send_keys(key).perform
sleep 0.05 sleep 0.01
} }
#element.send_keys( action[:value] ) #element.send_keys( action[:value] )
sleep 0.3 sleep 0.3