make sure only valid drivers take screenshots
This commit is contained in:
parent
00324b0538
commit
aba28d6961
@ -7,16 +7,19 @@ module CukePack
|
|||||||
end
|
end
|
||||||
|
|
||||||
def take_screenshot(name, options = {})
|
def take_screenshot(name, options = {})
|
||||||
options = CukePack.screenshot_options.merge(options)
|
|
||||||
|
|
||||||
selenium = Capybara.current_session.driver.browser
|
selenium = Capybara.current_session.driver.browser
|
||||||
selenium.manage.window.resize_to(options[:width], options[:height])
|
|
||||||
|
|
||||||
target = options[:directory]
|
if selenium.respond_to?(:manage)
|
||||||
target = File.join(target, Capybara.current_driver.to_s)
|
options = CukePack.screenshot_options.merge(options)
|
||||||
target = File.join(target, name + ".png")
|
|
||||||
|
|
||||||
FileUtils.mkdir_p File.dirname(target)
|
selenium.manage.window.resize_to(options[:width], options[:height])
|
||||||
|
|
||||||
selenium.save_screenshot(target)
|
target = options[:directory]
|
||||||
|
target = File.join(target, Capybara.current_driver.to_s)
|
||||||
|
target = File.join(target, name + ".png")
|
||||||
|
|
||||||
|
FileUtils.mkdir_p File.dirname(target)
|
||||||
|
|
||||||
|
selenium.save_screenshot(target)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user