Skip to content

Instantly share code, notes, and snippets.

@cmrd-senya
Created March 28, 2017 14:07
Show Gist options
  • Save cmrd-senya/4630415c8f9aef25383a0055a39e6a41 to your computer and use it in GitHub Desktop.
Save cmrd-senya/4630415c8f9aef25383a0055a39e6a41 to your computer and use it in GitHub Desktop.
Make page&screen shot on cuke failure
diff --git a/features/support/env.rb b/features/support/env.rb
index c26248a..d461a01 100644
--- a/features/support/env.rb
+++ b/features/support/env.rb
@@ -76,3 +76,17 @@ Before do |scenario|
# Reset overridden settings
AppConfig.reset_dynamic!
end
+
+Cucumber::Formatter::LegacyApi::Ast::StepInvocation.class_eval do
+ alias_method :orig_accept, :accept
+
+ def accept formatter
+ orig_accept(formatter)
+ if status == :failed
+ formatter.runtime.support_code.ruby.current_world.instance_eval do
+ save_page
+ save_screenshot
+ end
+ end
+ end
+end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment