Some temp fixes.
This commit is contained in:
parent
3c751d68f2
commit
32dcb5cc04
3 changed files with 89 additions and 149 deletions
|
@ -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',
|
||||||
|
@ -185,36 +179,18 @@ class AgentTicketActionLevel5Test < TestCase
|
||||||
:execute => 'close_all_tasks',
|
:execute => 'close_all_tasks',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
: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',
|
||||||
|
|
|
@ -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',
|
||||||
|
|
|
@ -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,34 +360,42 @@ class TestCase < Test::Unit::TestCase
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
sleep 2
|
sleep 2
|
||||||
element = instance.find_element( { :css => '.active .newTicket input[name="customer_id_completion"]' } )
|
if action[:customer] == nil
|
||||||
element.click
|
element = instance.find_element( { :css => '.active .newTicket input[name="customer_id_completion"]' } )
|
||||||
element.clear
|
element.click
|
||||||
element.send_keys( 'nico*' )
|
element.clear
|
||||||
sleep 4
|
element.send_keys( 'nico*' )
|
||||||
element = instance.find_element( { :css => '.active .newTicket input[name="customer_id_completion"]' } )
|
sleep 4
|
||||||
element.send_keys( :arrow_down )
|
element = instance.find_element( { :css => '.active .newTicket input[name="customer_id_completion"]' } )
|
||||||
sleep 0.3
|
element.send_keys( :arrow_down )
|
||||||
element = instance.find_element( { :css => '.active .newTicket input[name="customer_id_completion"]' } )
|
sleep 0.3
|
||||||
element.send_keys( :enter )
|
element = instance.find_element( { :css => '.active .newTicket input[name="customer_id_completion"]' } )
|
||||||
sleep 0.3
|
element.send_keys( :enter )
|
||||||
element = instance.find_element( { :css => '.active .newTicket select[name="group_id"]' } )
|
sleep 0.3
|
||||||
dropdown = Selenium::WebDriver::Support::Select.new(element)
|
end
|
||||||
dropdown.select_by( :text, action[:group])
|
if action[:group]
|
||||||
sleep 0.2
|
element = instance.find_element( { :css => '.active .newTicket select[name="group_id"]' } )
|
||||||
element = instance.find_element( { :css => '.active .newTicket input[name="title"]' } )
|
dropdown = Selenium::WebDriver::Support::Select.new(element)
|
||||||
element.clear
|
dropdown.select_by( :text, action[:group])
|
||||||
element.send_keys( action[:subject] )
|
sleep 0.2
|
||||||
sleep 0.2
|
end
|
||||||
element = instance.find_element( { :css => '.active .newTicket [data-name="body"]' } )
|
if action[:subject]
|
||||||
element.clear
|
element = instance.find_element( { :css => '.active .newTicket input[name="title"]' } )
|
||||||
element.send_keys( action[:body] )
|
element.clear
|
||||||
# check if body is filled / in case use workaround
|
element.send_keys( action[:subject] )
|
||||||
body = element.text
|
sleep 0.2
|
||||||
puts "body '#{body}'"
|
end
|
||||||
if !body || body.empty? || body == '' || body == ' '
|
if action[:body]
|
||||||
result = instance.execute_script( '$(".content.active .newTicket [data-name=body]").text("' + action[:body] + '")' )
|
element = instance.find_element( { :css => '.active .newTicket [data-name="body"]' } )
|
||||||
puts "r #{result.inspect}"
|
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] + '")' )
|
||||||
|
#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
|
||||||
|
|
Loading…
Reference in a new issue