-
Notifications
You must be signed in to change notification settings - Fork 318
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DeviceCapture.takeScreenshot() timeout issue #2273
Comments
seeing this issue too:
|
Having the same problem here with I tried to use |
@GuillaumeVT I re-implemented the DeviceCapture into my own test code. For me the issue was that it was trying to redraw a view that is not shown and it was timing out there. I added a small check to redraw only views that are shown. I don't know if this would help in your case but you can test it out
|
Description
Calling
DeviceCapture.takeScreenshot()
in a test rule on test failure times out and takes no screenshotSteps to Reproduce
TestWatcher()
and try to take a screenshot on failure and write it to test storage.Expected Results
Screenshot should be taken and saved in the test storage
Actual Results
No screenshot is taken, calling
takeScreenshot()
times out.AndroidX Test and Android OS Versions
androidx.test.core v1.6.1
androidx.test.espresso:espresso* v3.6.1
OS: Tested on emulators with OS versions 31-33
Additional debug information
I am just a QA engineer so I can't speak about the app implementation but what I found is that
forceRedrawGlobalWindowViews()
finds 2 views in the context of our app. For one of the viewsview.isShown
returns false and the redraw seems to fail on this particular one. I copied theDeviceCapture
implementation and added a condition to redraw only views that are "shown" and screenshots started working.NB The issue cannot be observed on core v1.5.0 and espresso libraries v3.5.1 but there the
DeviceCapture
implementation is completely different than the latest one.Link to a public git repo demonstrating the problem:
Example test rule used
Rule added to test class
@get:Rule(order = 1) var screenshotWatcher = ScreenshotTestRule()
The text was updated successfully, but these errors were encountered: