Added safari alert() support.
This commit is contained in:
parent
5a5a334505
commit
4d321a996c
1 changed files with 12 additions and 6 deletions
|
@ -161,6 +161,7 @@ class TestCase < Test::Unit::TestCase
|
||||||
|
|
||||||
def browser_element_action(test, action, instance)
|
def browser_element_action(test, action, instance)
|
||||||
if action[:css]
|
if action[:css]
|
||||||
|
# puts "NOTICE: css #{ action[:css] }"
|
||||||
begin
|
begin
|
||||||
if action[:range] == 'all'
|
if action[:range] == 'all'
|
||||||
element = instance.find_elements( { :css => action[:css] } )
|
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]}" )
|
assert( false, "(#{test[:name]}) url #{instance.current_url} is not matching #{action[:result]}" )
|
||||||
end
|
end
|
||||||
elsif action[:element] == :alert
|
elsif action[:element] == :alert
|
||||||
|
puts "laalal"
|
||||||
element = instance.switch_to.alert
|
element = instance.switch_to.alert
|
||||||
elsif action[:execute] == 'close_all_tasks'
|
elsif action[:execute] == 'close_all_tasks'
|
||||||
while true
|
while true
|
||||||
|
@ -213,12 +215,16 @@ class TestCase < Test::Unit::TestCase
|
||||||
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])
|
||||||
elsif action[:execute] == 'click'
|
elsif action[:execute] == 'click'
|
||||||
if element.class == Array
|
|
||||||
element.each {|item|
|
# ignore alert clicks on safari / not supported
|
||||||
item.click
|
if action[:element] != :alert || ( action[:element] == :alert && ENV['BROWSER'] !~ /safari/i )
|
||||||
}
|
if element.class == Array
|
||||||
else
|
element.each {|item|
|
||||||
element.click
|
item.click
|
||||||
|
}
|
||||||
|
else
|
||||||
|
element.click
|
||||||
|
end
|
||||||
end
|
end
|
||||||
elsif action[:execute] == 'accept'
|
elsif action[:execute] == 'accept'
|
||||||
element.accept
|
element.accept
|
||||||
|
|
Loading…
Reference in a new issue