The Screenshot extension can be customised using methods on the ScreenshotExtension
class.
For example, it can use a custom ScreenshotTaker, take screenshots on assertion success as well as failure, and limit the maximum width of the screenshot images on mouse hover.
The simplest way to configure it is to add the @Extension annotation to a ScreenshotExtension field in your fixture class. Alternatively, you can create a ConcordionExtensionFactory.
Given the system property concordion.extensions
is set to the class spec.concordion.ext.screenshot.ScreenshotExtensionFactory
, which sets screenshots to appear on successful assertions, and limits the max width to 400 pixels.
<p concordion:assertEquals="acronym">ABC</p>
When run with a fixture that returns an acroynm
value of ABC
, it becomes:
<p concordion:assertEquals="acronym" class="success" _ onMouseOver="if (showScreenshotOn(event)) {show('testrig_img1.jpg');this.style.cursor='pointer'}" _ onMouseOut="hide('testrig_img1.jpg');this.style.cursor='default'" _ onClick="if (showScreenshotOn(event)) {hide('testrig_img1.jpg');window.location.href='testrig_img1.jpg'}"> _ ABC _ <a href="testrig_img1.jpg"><img id="testrig_img1.jpg" src="testrig_img1.jpg" width="400" class="screenshot" /> _ </a> _ </p>