mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Merge pull request #28125 from y-yagi/do_not_take_screenshots_when_test_skipped
Do not take screenshot when test skipped
This commit is contained in:
commit
4734d23c74
2 changed files with 16 additions and 2 deletions
|
@ -22,12 +22,12 @@ module ActionDispatch
|
|||
# fails add +take_failed_screenshot+ to the teardown block before clearing
|
||||
# sessions.
|
||||
def take_failed_screenshot
|
||||
take_screenshot unless passed?
|
||||
take_screenshot if failed?
|
||||
end
|
||||
|
||||
private
|
||||
def image_name
|
||||
passed? ? method_name : "failures_#{method_name}"
|
||||
failed? ? "failures_#{method_name}" : method_name
|
||||
end
|
||||
|
||||
def image_path
|
||||
|
@ -51,6 +51,10 @@ module ActionDispatch
|
|||
def inline_base64(path)
|
||||
Base64.encode64(path).gsub("\n", "")
|
||||
end
|
||||
|
||||
def failed?
|
||||
!passed? && !skipped?
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -15,4 +15,14 @@ class ScreenshotHelperTest < ActiveSupport::TestCase
|
|||
assert_equal "tmp/screenshots/failures_x.png", new_test.send(:image_path)
|
||||
end
|
||||
end
|
||||
|
||||
test "image path does not include failures text if test skipped" do
|
||||
new_test = ActionDispatch::SystemTestCase.new("x")
|
||||
|
||||
new_test.stub :passed?, false do
|
||||
new_test.stub :skipped?, true do
|
||||
assert_equal "tmp/screenshots/x.png", new_test.send(:image_path)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue