-
Notifications
You must be signed in to change notification settings - Fork 18
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
Pulling screenshots from external storage on sdk29 and above #70
Comments
I would be fine to do it regardless of what spoon does. There is currently a nasty pattern i've commonly employed of using spoon to get a file, then overwrite it with an image from falcon or ui automator and at the least we could eliminate some of that overhead. Additionally I'd like to add a runtime composer tool to standardize screenshot engine selection via instrumentation args which is also something I have reimplemented time and again in work projects. we might also see what we can learn from the android-test repo as they are currently overhauling the AJUR/Orchestrator setup and I remember seeing info about screenshot capturing there. I have not done much file system stuff in android for the last few years, lets see if we can document our options here and get things moving. |
I have found next comment at android test project:
android/android-test#383 (comment) Is this what you have meant in mind? Project Nitrogen was announced on Google IO 2018 and then skipped from state of the testing presentation on Google IO 2019 without any update. Looking forward to Google IO 2020 to see if there is some alpha to grab.
I think there are 2 major directions with some details changing: write files in application internal folder or deal with writing to external storage.
I don't have strong preferences. Until implementations are in sync should be fine. |
Ok so based on that I don't think it is worth depending on the main android test details right now at least. The dynamics of the userId does make both options non trivial for sure. I think i'd like to see if we can find a solution that uses internal since it would wipe out any zombie files when the test app is removed from the device. Given that composer currently requires an adb connection to work I think we can make use of an I actually really really like this idea the more I think about it. Some of the most fragile parts of composer/commander are the command line tool parsing (imo). By running a server on the host machine it could potentially replace all that cli parsing by just pushing information directly to the composer/gradle process. So at that point the screen shot process would be: One concern I have is fragility in the event of a process crash since the device would be playing a more active role in the instrumentation. Maybe multiple processes inside the test apk similar to what leak canary does for heap analysis would make that safer and help resolve that fragility? Another concern is how would all this fit in with the use of the orchestrator apk. Would we even need it at that point since the host might be able to replace the orchestrator? |
Ok so been thinking about this more I think what I am going to do is an apk that exposes a content provider for the files, then any composer run capturing files go into its internal storage and I can do a grpc or similar stream over the external apk so that uninstalling or wiping data on one package nukes all residue that might be possible when building this thing. plus it will allow file permissions etc to be isolated to that package and hopefully mean low to no side effects on tests designed to exercise permissions etc... |
As composer was meant to become a spoon test runner replacement it expect that screenshots would be written using Spoon companion library.
base folder where spoon writes screenshot:
https://github.com/square/spoon/blob/ebd51fbc1498f6bdcb61aa1281bbac2af99117b3/spoon-client/src/main/java/com/squareup/spoon/SpoonRule.java#L98-L100
Is monitored and pulled by composer:
composer-gradle-plugin/composer/composer/src/main/kotlin/com/gojuno/composer/TestRun.kt
Lines 177 to 178 in df8d80e
getExternalStorageDirectory
is deprecated in android 29. And its one of thoose rare case where deprecated api throws exception instead of continue to be working normally https://developer.android.com/reference/android/os/Environment#getExternalStorageDirectory()making missing screenshots at composer test report on android 29 with application compiled on 29.
As Spoon is abanded as well. Do you think it should be considered to take over companion library as well and fix writing files part in consideration with android access storage recommended practices?
The text was updated successfully, but these errors were encountered: