Added safari alert() support.

This commit is contained in:
Martin Edenhofer 2013-06-10 13:12:39 +02:00
parent 5a5a334505
commit 4d321a996c

View file

@ -161,6 +161,7 @@ class TestCase < Test::Unit::TestCase
def browser_element_action(test, action, instance)
if action[:css]
# puts "NOTICE: css #{ action[:css] }"
begin
if action[:range] == 'all'
element = instance.find_elements( { :css => action[:css] } )
@ -182,6 +183,7 @@ class TestCase < Test::Unit::TestCase
assert( false, "(#{test[:name]}) url #{instance.current_url} is not matching #{action[:result]}" )
end
elsif action[:element] == :alert
puts "laalal"
element = instance.switch_to.alert
elsif action[:execute] == 'close_all_tasks'
while true
@ -213,6 +215,9 @@ class TestCase < Test::Unit::TestCase
dropdown = Selenium::WebDriver::Support::Select.new(element)
dropdown.select_by(:text, action[:value])
elsif action[:execute] == 'click'
# ignore alert clicks on safari / not supported
if action[:element] != :alert || ( action[:element] == :alert && ENV['BROWSER'] !~ /safari/i )
if element.class == Array
element.each {|item|
item.click
@ -220,6 +225,7 @@ class TestCase < Test::Unit::TestCase
else
element.click
end
end
elsif action[:execute] == 'accept'
element.accept
elsif action[:execute] == 'dismiss'