diff options
author | eileencodes <eileencodes@gmail.com> | 2016-12-03 09:27:44 -0500 |
---|---|---|
committer | eileencodes <eileencodes@gmail.com> | 2017-02-20 15:07:34 -0500 |
commit | 3f414c22c70d5647d2ee9f16f7e4eec15c829afb (patch) | |
tree | 6465f3a3b1f1702d8ec8ae333592b081070f8c14 /actionsystemtest/lib/action_system_test/test_helpers/screenshot_helper.rb | |
parent | 970ece243d05945f59f3cdf55e44dbfe5b16d2d5 (diff) | |
download | rails-3f414c22c70d5647d2ee9f16f7e4eec15c829afb.tar.gz rails-3f414c22c70d5647d2ee9f16f7e4eec15c829afb.tar.bz2 rails-3f414c22c70d5647d2ee9f16f7e4eec15c829afb.zip |
Cleanup Rails provided helpers
1. Clean up screenshot helper
Updates documentation to be clearer and separates the concerns of saving
the image, setting the image path, and displaying the image.
2. Remove Rails provided assertions for selectors
This was moved upstream to Capybara and is no longer necessary to be
included in Rails
3. Remove form helper
The form helper is pretty specific to Basecamp's needs and may not be
helpful outside of Rails.
Diffstat (limited to 'actionsystemtest/lib/action_system_test/test_helpers/screenshot_helper.rb')
-rw-r--r-- | actionsystemtest/lib/action_system_test/test_helpers/screenshot_helper.rb | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/actionsystemtest/lib/action_system_test/test_helpers/screenshot_helper.rb b/actionsystemtest/lib/action_system_test/test_helpers/screenshot_helper.rb index 1b198b9b29..d4d0d79e95 100644 --- a/actionsystemtest/lib/action_system_test/test_helpers/screenshot_helper.rb +++ b/actionsystemtest/lib/action_system_test/test_helpers/screenshot_helper.rb @@ -13,24 +13,32 @@ module ActionSystemTest # ActionSystemTest.driver.supports_screenshots? # => true def take_screenshot + save_image puts "[Screenshot]: #{image_path}" - puts find_image + puts display_image end - # Takes a screenshot only if the test failed. This is included - # by default in +teardown+ of system test. + # Takes a screenshot of the current page in the browser if the test + # failed. + # + # +take_screenshot+ is included in <tt>system_test_helper.rb</tt> that is + # generated with the application. To take screenshots when a test fails + # add +take_failed_screenshot+ to the teardown block before clearing any + # sessions. def take_failed_screenshot take_screenshot unless passed? end private def image_path - path = "tmp/screenshots/failures_#{method_name}.png" - page.save_screenshot(Rails.root.join(path)) - path + "tmp/screenshots/failures_#{method_name}.png" + end + + def save_image + page.save_screenshot(Rails.root.join(image_path)) end - def find_image + def display_image if ENV["CAPYBARA_INLINE_SCREENSHOT"] == "artifact" "\e]1338;url=artifact://#{image_path}\a" else |