Attaching screenshots to json report
Since you seem to be an advanced user - you can try this. The karate
object is of type ScriptBridge
and you should be able to pass it into your custom Java code (which we normally do not recommend). Now you can call methods in Java such as embed()
etc.
I also see nothing wrong with writing a JS wrapper so that the screen-shot taking becomes a one-liner in your scenarios.