Created
September 10, 2009 08:59
-
-
Save terotil/184428 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ScreenshotFormatter < Cucumber::Formatter::Pretty # Cucumber::Ast::Visitor | |
def self.browser=(browser) | |
@@browser = browser | |
end | |
def self.screenshot_path=(path) | |
@@sspath = path | |
end | |
def visit_step(step) | |
@step_id = step.dom_id | |
super | |
end | |
def screenshot_after_step?(keyword, step_match, status) | |
raise 'Mein Gott! Abstract method!' | |
end | |
def visit_step_name(keyword, step_match, status, source_indent, background) | |
if screenshot_after_step?(keyword, step_match, status) | |
@@browser.capture_entire_page_screenshot("#{@@sspath}/#{@step_id}.png",'') | |
# Ruutukaappaus koko ruudusta | |
# @@browser.capture_screenshot("tmp/#{@step_id}_screen.png") | |
end | |
super | |
end | |
end | |
class ScreenshotAllFormatter < ScreenshotFormatter | |
def screenshot_after_step?(keyword, step_match, status) | |
true | |
end | |
end | |
class ScreenshotFailingFormatter < ScreenshotFormatter | |
def screenshot_after_step?(keyword, step_match, status) | |
status == :failed | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment