Skip to content

Commit

Permalink
Merge pull request #24 from vgrigoruk/master
Browse files Browse the repository at this point in the history
Do not take screenshot if no driver is running. Auto-quit driver at_exit
  • Loading branch information
maudineormsby committed Oct 16, 2015
2 parents 697a000 + 580a476 commit 7695c14
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/appium_capybara/driver/appium/driver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@ def browser
@appium_driver = Appium::Driver.new @options
# browser is the standard selenium driver without any appium methods
@browser = @appium_driver.start_driver

main = Process.pid
at_exit do
# Store the exit status of the test run since it goes away after calling the at_exit proc...
@exit_status = $!.status if $!.is_a?(SystemExit)
quit if Process.pid == main
exit @exit_status if @exit_status # Force exit with stored status
end
end
@browser
end
Expand Down Expand Up @@ -79,7 +87,7 @@ def rotate(opts)
# override
# Capybara always passes an options param but appium_lib can't do anything with it.
def save_screenshot(path, options = {})
appium_driver.screenshot path
appium_driver.screenshot path if @appium_driver
end

# new
Expand Down

0 comments on commit 7695c14

Please sign in to comment.