How to Add Screenshot to Jenkins Cucumber Reports for Capybara
If you are using Capybara and Cucumber for test automation and Jenkins for CI/CD process you can run your test over Jenkins and see the result by Cucumber Result Plugin, for more information check the plugin page. By this plugin you can also see the screenshots taken when test cases fail.
To produce the result you need to save the result of the test as .json file, you can use the following command:
cucumber features -f json -o cucumber_result.json
To enable to take screenshot if a case fails you need to set the application hook of after case. The following configuration makes it automatically. See it and change screenshot path with your path. The key point is embedding the image after taking it then reports plugin make it visible on the report.
|Cucumber Result Plugin|
|Screenshot for the failed test case|