Browser screenshooter is an extension to Arquillian platform which provides the possibility to take screenshots of your tests. Only browser window is screened. In order to use it, please place this artifact configuration into Maven dependencies:
<dependency>
<groupId>org.jboss.arquillian.graphene</groupId>
<artifactId>arquillian-browser-screenshooter</artifactId>
<version>${version.screenshooter}</version>
</dependency>
Following arquillian.xml properties are supported within screenshooter qualifier:
Configuration Property | Description | Default Value |
---|---|---|
takeOnEveryAction |
take a screenshot on every interaction with the WebDriver object |
false |
takeBeforeTest |
take a screenshot after page loading, that is calling WebDriver.get(String) |
false |
takeAfterTest |
take a screenshot as the last action in the test execution |
false |
takeWhenTestFailed |
take a screenshot only when the test failed |
true |
rootDir |
folder where all screenshots will be placed |
target |
screenshotType |
type of taken image |
PNG |
Graphene screenshooter is an implementation of high level API, located in Arquillian Recorder repository.
There is plenty of other possibilities of usages and settings which are inherited from the upstream API. Please see its reference documentaion for more info in this matter.
The default strategy for naming of the created screenshots is as follows:
rootDir/fullyQualifiedNameOfTheTestClass/nameOfTheTest/[nameOfMethod+counter]_[when].[screenshotType]
where placeholders in the actual file name mean:
-
nameOfMethod+counter - a method which invoked taking of the screenshot when takeOnEveryAction == true, equals to get when takeBeforeTest == true + an integer marking an order in which was the screenshot taken in a test, defaults to string "unknown"
-
when - one of: after, before, failed, onEveryAction, in_test
-
screenshotType - a file suffix from settings
Please be aware that this default naming strategy is subject to change in higher versions.