Kaspresso icon indicating copy to clipboard operation
Kaspresso copied to clipboard

DocLocScreenshotTestCase does not save failure screenshots

Open aartikov opened this issue 5 years ago • 1 comments

Steps to reproduce:

  1. Change kaspressample.docloc_tests.ScreenshotSampleTest to make it failing.
  2. Run the test.
  3. 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 avatar Feb 10 '20 05:02 aartikov

@aartikov Hi! Is the issue actual?

matzuk avatar Feb 01 '21 14:02 matzuk

@aartikov Hi! Thanks for your issue. Is the issue actual?

AzamatCherchesov avatar Oct 24 '22 10:10 AzamatCherchesov

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

Nikitae57 avatar Nov 07 '22 13:11 Nikitae57