Improved unit tests, added IE support.

This commit is contained in:
Martin Edenhofer 2013-06-23 23:32:45 +02:00
parent dbd075fb98
commit ac9e71c4f2
2 changed files with 54 additions and 6 deletions

View file

@ -163,6 +163,24 @@ class AgentTicketActionsLevel2Test < TestCase
:link => '###stack###',
# :css => 'a:contains(\'###stack###\')',
},
{
:execute => 'wait',
:value => 1,
},
{
:where => :instance2,
:execute => 'js',
:value => '$("#global-search").focus()',
},
{
:execute => 'wait',
:value => 1,
},
{
:where => :instance2,
:execute => 'js',
:value => '$("#global-search").blur()',
},
{
:execute => 'wait',
:value => 3,
@ -176,18 +194,34 @@ class AgentTicketActionsLevel2Test < TestCase
},
# change title in second browser
# {
# :where => :instance2,
# :execute => 'sendkey',
# :css => '.active .ticket-title-update',
# :value => 'TTT',
# },
# {
# :where => :instance2,
# :execute => 'sendkey',
# :css => '.active .ticket-title-update',
# :value => :tab,
# },
{
:where => :instance2,
:execute => 'sendkey',
:css => '.active .ticket-title-update',
:value => 'TTT',
:execute => 'js',
:value => '$(".active .ticket-title .ticket-title-update").focus()',
},
{
:where => :instance2,
:execute => 'sendkey',
:css => '.active .ticket-title-update',
:value => :tab,
:execute => 'js',
:value => '$(".active .ticket-title .ticket-title-update").html("TTTsome level 2 &lt;b&gt;subject&lt;/b&gt; 123äöü")',
},
{
:where => :instance2,
:execute => 'js',
:value => '$(".active .ticket-title .ticket-title-update").blur()',
},
# set body in edit area
{

View file

@ -193,6 +193,16 @@ class TestCase < Test::Unit::TestCase
assert( false, "(#{test[:name]}) not matching '#{action[:value]}' in title" )
end
return
elsif action[:element] == :cookie
cookies = instance.manage.all_cookies
cookies.each {|cookie|
if cookie.to_s =~ /#{action[:value]}/i
assert( true, "(#{test[:name]}) matching '#{action[:value]}' in cookie" )
return
end
}
assert( false, "(#{test[:name]}) not matching '#{action[:value]}' in cookie" )
return
elsif action[:element] == :alert
element = instance.switch_to.alert
elsif action[:execute] == 'close_all_tasks'
@ -213,6 +223,9 @@ class TestCase < Test::Unit::TestCase
instance.navigate.to( action[:to] )
elsif action[:execute] == 'reload'
instance.navigate.refresh
elsif action[:execute] == 'js'
result = instance.execute_script( action[:value] )
puts "JS RESULT" + result.inspect
elsif action[:link]
if action[:link].match '###stack###'
action[:link].gsub! '###stack###', @stack
@ -311,6 +324,7 @@ class TestCase < Test::Unit::TestCase
elsif action[:execute] == 'close_all_tasks'
elsif action[:execute] == 'navigate'
elsif action[:execute] == 'reload'
elsif action[:execute] == 'js'
else
assert( false, "(#{test[:name]}) unknow action '#{action[:execute]}'" )
end