Kaspresso
Kaspresso copied to clipboard
DocLocScreenshotTestCase does not save failure screenshots
Steps to reproduce:
- Change
kaspressample.docloc_tests.ScreenshotSampleTest
to make it failing. - Run the test.
- Open "sdcard/screenshots/en" in Device File Explorer.
Expected behavior: "fails" directory contains a failure screenshot.
Actual behavior: "fails" directory is empty. Logcat has java.lang.IllegalArgumentException: Could not find test class!
Tested on Emulator API 26, x86_64.
@aartikov Hi! Is the issue actual?
@aartikov Hi! Thanks for your issue. Is the issue actual?
Hi, @aartikov! Indeed, current approach with TestRule doesn't work for several reasons. Right now you could fix it by adding ScreenshotStepWatcherInterceptor
interceptor to your test case constructor e.g.
Kaspresso.Builder.simple().apply {
stepWatcherInterceptors.add(ScreenshotStepWatcherInterceptor(screenshots))
}
There's a PR that aims to take "fail" screenshots out of the box