I've got a problem with my automated UI tests using AWS device farm. I tried to create a new UIAutomator 2 test. This works fine on my device and my development machine.
No I created a new test run in AWS device farm to run this test on all the other devices creating screenshot output. The problem here seems to be in taking the screenshots.
With Automator 2 I take my screenshots using automator frameworks UIDevie.takeScreenshot
method. This method takes a File
as parameter.
As described in AWS documentation I tried to store the file using the /sdcard/
folder as well as Environment.getExternalStorageDirectory()
. None of those directories seem to work.
With Environment.getExternalStorageDirectory()
I get the following LOG:
Error UiAutomatorBridge java.io.FileNotFoundException: /storage/emulated/0/test-screenshots/coupondetail-screen-2.png: open failed: EACCES (Permission denied)
Using /sdcard/
I get the following LOG:
Error UiAutomatorBridge java.io.FileNotFoundException: /sdcard/test-screenshots/coupondetail-screen-2.png: open failed: EACCES (Permission denied)
Also I used the following reference implementation: https://github.com/awslabs/aws-device-farm-sample-app-for-android/blob/master/app/src/androidTest/java/com/amazonaws/devicefarm/android/referenceapp/Util/ScreenShot.java