Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not take screenshot if driver does not support screenshot #28264

Conversation

@y-yagi
Copy link
Member

@y-yagi y-yagi commented Mar 3, 2017

Capybara::RackTest::Driver does not support taking screenshots. If call
#save_screenshot on Capybara::RackTest::Driver will raise the error.

Error:
UsersTest#test_visiting_the_index:
Capybara::NotSupportedByDriverError: Capybara::Driver::Base#save_screenshot

To prevent errors, if driver does not support screenshot, do not call it.

@eileencodes
Copy link
Member

@eileencodes eileencodes commented Mar 3, 2017

Can you add a test for this in the screenshot test file? Here's a link to that file https://github.com/rails/rails/blob/master/actionpack/test/dispatch/system_testing/screenshot_helper_test.rb

@eileencodes eileencodes self-assigned this Mar 3, 2017
@eileencodes eileencodes added this to the 5.1.0 milestone Mar 3, 2017
`Capybara::RackTest::Driver` does not support taking screenshots. If call
`#save_screenshot` on `Capybara::RackTest::Driver` will raise the error.

```ruby
Error:
UsersTest#test_visiting_the_index:
Capybara::NotSupportedByDriverError: Capybara::Driver::Base#save_screenshot
```

To prevent errors, if driver does not support screenshot, do not call it.
@y-yagi y-yagi force-pushed the y-yagi:do_not_take_screenshot_if_driver_does_not_support_it branch to 2ee4058 Mar 4, 2017
@y-yagi
Copy link
Member Author

@y-yagi y-yagi commented Mar 4, 2017

I added a test!

@eileencodes eileencodes merged commit c21f71c into rails:master Mar 5, 2017
2 checks passed
2 checks passed
codeclimate no new or fixed issues
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@eileencodes
Copy link
Member

@eileencodes eileencodes commented Mar 5, 2017

Thank you @y-yagi!

@y-yagi y-yagi deleted the y-yagi:do_not_take_screenshot_if_driver_does_not_support_it branch Mar 5, 2017
@renchap
Copy link
Contributor

@renchap renchap commented Mar 9, 2017

This does not work when using Poltergeist, supports_screenshot? returns false but the driver definitely supports screenshots, as take_screenshot works fine.

@renchap
Copy link
Contributor

@renchap renchap commented Mar 9, 2017

After some deeper testing, I found the root cause. See #28357

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants