Some temp fixes.

This commit is contained in:
Martin Edenhofer 2014-10-14 02:13:19 +02:00
parent 3c751d68f2
commit 32dcb5cc04
3 changed files with 89 additions and 149 deletions

View file

@ -121,11 +121,11 @@ class AgentTicketActionLevel5Test < TestCase
{ {
:execute => 'set', :execute => 'set',
:css => '.active [data-name="body"]', :css => '.active [data-name="body"]',
:value => '::' + random, :value => 'test ::' + random,
}, },
{ {
:execute => 'wait', :execute => 'wait',
:value => 1, :value => 2,
}, },
{ {
:execute => 'match', :execute => 'match',
@ -135,13 +135,7 @@ class AgentTicketActionLevel5Test < TestCase
}, },
{ {
:execute => 'sendkey', :execute => 'sendkey',
:css => '.active .shortcut', :value => [:arrow_down,:enter]
:value => :arrow_down,
},
{
:execute => 'sendkey',
:css => '.active .shortcut',
:value => :enter,
}, },
{ {
:execute => 'wait', :execute => 'wait',
@ -186,35 +180,17 @@ class AgentTicketActionLevel5Test < TestCase
}, },
{ {
:where => :instance2, :where => :instance2,
:execute => 'click', :execute => 'create_ticket',
:css => '.taskbar-new a[href="#new"]', :subject => 'A',
:customer => '',
:do_not_submit => true,
}, },
{ {
:where => :instance2, :where => :instance2,
:execute => 'click', :execute => 'create_ticket',
:css => '.taskbar-new a[href="#ticket/create"]', :customer => '',
}, :subject => 'B',
{ :do_not_submit => true,
:where => :instance2,
:execute => 'set',
:css => '.active input[name=title]',
:value => 'A',
},
{
:where => :instance2,
:execute => 'click',
:css => '.taskbar-new a[href="#new"]',
},
{
:where => :instance2,
:execute => 'click',
:css => '.taskbar-new a[href="#ticket/create"]',
},
{
:where => :instance2,
:execute => 'set',
:css => '.active input[name=title]',
:value => 'B',
}, },
# create new text module # create new text module
@ -303,7 +279,7 @@ class AgentTicketActionLevel5Test < TestCase
{ {
:where => :instance2, :where => :instance2,
:execute => 'wait', :execute => 'wait',
:value => 1, :value => 2,
}, },
{ {
:where => :instance2, :where => :instance2,
@ -315,14 +291,7 @@ class AgentTicketActionLevel5Test < TestCase
{ {
:where => :instance2, :where => :instance2,
:execute => 'sendkey', :execute => 'sendkey',
:css => '.active .shortcut', :value => [:arrow_down,:enter]
:value => :arrow_down,
},
{
:where => :instance2,
:execute => 'sendkey',
:css => '.active .shortcut',
:value => :enter,
}, },
{ {
:where => :instance2, :where => :instance2,
@ -353,14 +322,7 @@ class AgentTicketActionLevel5Test < TestCase
{ {
:where => :instance2, :where => :instance2,
:execute => 'sendkey', :execute => 'sendkey',
:css => '.active .newTicket input[name="customer_id_completion"]', :value => [:arrow_down,:enter]
:value => :arrow_down,
},
{
:where => :instance2,
:execute => 'sendkey',
:css => '.active .newTicket input[name="customer_id_completion"]',
:value => :tab,
}, },
{ {
:where => :instance2, :where => :instance2,
@ -381,14 +343,7 @@ class AgentTicketActionLevel5Test < TestCase
{ {
:where => :instance2, :where => :instance2,
:execute => 'sendkey', :execute => 'sendkey',
:css => '.active .shortcut', :value => [:arrow_down,:enter]
:value => :arrow_down,
},
{
:where => :instance2,
:execute => 'sendkey',
:css => '.active .shortcut',
:value => :enter,
}, },
{ {
:where => :instance2, :where => :instance2,
@ -455,7 +410,7 @@ class AgentTicketActionLevel5Test < TestCase
}, },
{ {
:execute => 'wait', :execute => 'wait',
:value => 0.5, :value => 2,
}, },
{ {
:where => :instance2, :where => :instance2,
@ -467,14 +422,7 @@ class AgentTicketActionLevel5Test < TestCase
{ {
:where => :instance2, :where => :instance2,
:execute => 'sendkey', :execute => 'sendkey',
:css => '.active .shortcut', :value => [:arrow_down,:enter]
:value => :arrow_down,
},
{
:where => :instance2,
:execute => 'sendkey',
:css => '.active .shortcut',
:value => :enter,
}, },
{ {
:execute => 'wait', :execute => 'wait',
@ -503,16 +451,12 @@ class AgentTicketActionLevel5Test < TestCase
{ {
:where => :instance2, :where => :instance2,
:execute => 'click', :execute => 'click',
:css => '.active .action button', :css => '.content.active .tabsSidebar-tabs [data-tab="customer"]',
},
{
:execute => 'wait',
:value => 1,
}, },
{ {
:where => :instance2, :where => :instance2,
:execute => 'click', :execute => 'click',
:css => '.active .action [data-type="customer"]', :css => '.content.active .tabsSidebar [data-name="Change Customer"]',
}, },
{ {
:execute => 'wait', :execute => 'wait',
@ -521,7 +465,7 @@ class AgentTicketActionLevel5Test < TestCase
{ {
:where => :instance2, :where => :instance2,
:execute => 'set', :execute => 'set',
:css => '#form-customer input[name="customer_id_completion"]', :css => '.modal [name="customer_id_completion"]',
:value => firstname, :value => firstname,
}, },
{ {
@ -531,14 +475,7 @@ class AgentTicketActionLevel5Test < TestCase
{ {
:where => :instance2, :where => :instance2,
:execute => 'sendkey', :execute => 'sendkey',
:css => '#form-customer input[name="customer_id_completion"]', :value => [:arrow_down,:enter]
:value => :arrow_down,
},
{
:where => :instance2,
:execute => 'sendkey',
:css => '#form-customer input[name="customer_id_completion"]',
:value => :tab,
}, },
{ {
:where => :instance2, :where => :instance2,
@ -548,7 +485,7 @@ class AgentTicketActionLevel5Test < TestCase
{ {
:where => :instance2, :where => :instance2,
:execute => 'click', :execute => 'click',
:css => '.modal-content [type="submit"]', :css => '.modal-content .js-submit',
}, },
{ {
:where => :instance2, :where => :instance2,
@ -563,7 +500,7 @@ class AgentTicketActionLevel5Test < TestCase
}, },
{ {
:execute => 'wait', :execute => 'wait',
:value => 0.5, :value => 2,
}, },
# { # {
# :where => :instance2, # :where => :instance2,
@ -575,14 +512,7 @@ class AgentTicketActionLevel5Test < TestCase
{ {
:where => :instance2, :where => :instance2,
:execute => 'sendkey', :execute => 'sendkey',
:css => '.active .shortcut', :value => [:arrow_down,:enter]
:value => :arrow_down,
},
{
:where => :instance2,
:execute => 'sendkey',
:css => '.active .shortcut',
:value => :enter,
}, },
{ {
:execute => 'wait', :execute => 'wait',

View file

@ -32,13 +32,7 @@ class AgentUserManageTest < TestCase
}, },
{ {
:execute => 'sendkey', :execute => 'sendkey',
:css => '.active [name="customer_id_completion"]', :value => [:arrow_down,:enter]
:value => :arrow_down,
},
{
:execute => 'sendkey',
:css => '.active [name="customer_id_completion"]',
:value => :enter,
}, },
{ {
:execute => 'wait', :execute => 'wait',
@ -160,13 +154,7 @@ class AgentUserManageTest < TestCase
}, },
{ {
:execute => 'sendkey', :execute => 'sendkey',
:css => '.active .newTicket input[name="customer_id_completion"]', :value => [:arrow_down,:enter]
:value => :arrow_down,
},
{
:execute => 'sendkey',
:css => '.active .newTicket input[name="customer_id_completion"]',
:value => :enter,
}, },
{ {
:execute => 'wait', :execute => 'wait',

View file

@ -161,10 +161,10 @@ class TestCase < Test::Unit::TestCase
def browser_element_action(test, action, instance) def browser_element_action(test, action, instance)
puts "NOTICE #{Time.now.to_s}: " + action.inspect puts "NOTICE #{Time.now.to_s}: " + action.inspect
if action[:execute] !~ /accept|dismiss/i if action[:execute] !~ /accept|dismiss/i
cookies = instance.manage.all_cookies #cookies = instance.manage.all_cookies
cookies.each {|cookie| #cookies.each {|cookie|
puts " COOKIE " + cookie.to_s # puts " COOKIE " + cookie.to_s
} #}
end end
sleep 0.1 sleep 0.1
@ -344,10 +344,10 @@ class TestCase < Test::Unit::TestCase
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 [data-name=body]").text("' + action[:body] + '")' ) result = instance.execute_script( '$(".content.active [data-name=body]").text("' + action[:body] + '")' )
puts "r #{result.inspect}" #puts "r #{result.inspect}"
end end
end end
return return
@ -360,6 +360,7 @@ class TestCase < Test::Unit::TestCase
return return
end end
sleep 2 sleep 2
if action[:customer] == nil
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
@ -371,23 +372,30 @@ 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.send_keys( :enter ) element.send_keys( :enter )
sleep 0.3 sleep 0.3
end
if action[:group]
element = instance.find_element( { :css => '.active .newTicket select[name="group_id"]' } ) element = instance.find_element( { :css => '.active .newTicket select[name="group_id"]' } )
dropdown = Selenium::WebDriver::Support::Select.new(element) dropdown = Selenium::WebDriver::Support::Select.new(element)
dropdown.select_by( :text, action[:group]) dropdown.select_by( :text, action[:group])
sleep 0.2 sleep 0.2
end
if action[:subject]
element = instance.find_element( { :css => '.active .newTicket input[name="title"]' } ) element = instance.find_element( { :css => '.active .newTicket input[name="title"]' } )
element.clear element.clear
element.send_keys( action[:subject] ) element.send_keys( action[:subject] )
sleep 0.2 sleep 0.2
end
if action[:body]
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] + '")' )
puts "r #{result.inspect}" #puts "r #{result.inspect}"
end
end end
if action[:do_not_submit] if action[:do_not_submit]
assert( true, "(#{test[:name]}) ticket created without submit" ) assert( true, "(#{test[:name]}) ticket created without submit" )
@ -436,6 +444,16 @@ class TestCase < Test::Unit::TestCase
return return
elsif action[:execute] == 'js' elsif action[:execute] == 'js'
result = instance.execute_script( action[:value] ) result = instance.execute_script( action[:value] )
elsif action[:execute] == 'sendkey'
if action[:value].class == Array
action[:value].each {|key|
instance.action.send_keys(key).perform
}
else
instance.action.send_keys(action[:value]).perform
#instance.action.send_keys(:enter).perform
end
# element.send_keys( action[:value] )
elsif action[:link] elsif action[:link]
if action[:link].match '###stack###' if action[:link].match '###stack###'
action[:link].gsub! '###stack###', @stack action[:link].gsub! '###stack###', @stack
@ -459,10 +477,14 @@ class TestCase < Test::Unit::TestCase
if action[:value] == '###stack###' if action[:value] == '###stack###'
element.send_keys( @stack ) element.send_keys( @stack )
else else
element.send_keys( action[:value] ) element.send_keys( '' )
keys = action[:value].to_s.split('')
keys.each {|key|
instance.action.send_keys(key).perform
}
#element.send_keys( action[:value] )
sleep 0.3
end end
elsif action[:execute] == 'sendkey'
element.send_keys( action[:value] )
elsif action[:execute] == 'select' elsif action[:execute] == 'select'
dropdown = Selenium::WebDriver::Support::Select.new(element) dropdown = Selenium::WebDriver::Support::Select.new(element)
dropdown.select_by(:text, action[:value]) dropdown.select_by(:text, action[:value])
@ -510,7 +532,6 @@ class TestCase < Test::Unit::TestCase
elsif action[:css] =~ /(input|textarea)/i elsif action[:css] =~ /(input|textarea)/i
text = element.attribute('value') text = element.attribute('value')
else else
puts "'DAT ' #{element.text}"
text = element.text text = element.text
end end
if action[:value] == '###stack###' if action[:value] == '###stack###'
@ -518,7 +539,7 @@ class TestCase < Test::Unit::TestCase
end end
match = false match = false
if action[:no_quote] if action[:no_quote]
puts "aaaa #{text}/#{action[:value]}" #puts "aaaa #{text}/#{action[:value]}"
if text =~ /#{action[:value]}/ if text =~ /#{action[:value]}/
if $1 if $1
@stack = $1 @stack = $1
@ -546,6 +567,7 @@ class TestCase < Test::Unit::TestCase
end end
elsif action[:execute] == 'check' elsif action[:execute] == 'check'
elsif action[:execute] == 'js' elsif action[:execute] == 'js'
elsif action[:execute] == 'sendkey'
else else
assert( false, "(#{test[:name]}) unknow action '#{action[:execute]}'" ) assert( false, "(#{test[:name]}) unknow action '#{action[:execute]}'" )
end end