Created
March 28, 2017 14:07
-
-
Save cmrd-senya/4630415c8f9aef25383a0055a39e6a41 to your computer and use it in GitHub Desktop.
Make page&screen shot on cuke failure
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
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