Research whether a layout hierarchy capture can be snapshotted as an artifact upon visibility failures
Is your feature request related to a problem? Please describe.
When tests fail due to visibility/matching issues (95% of the time), at best, the user gets these artifacts hinting at the device's status at the time:
- Hierarchy log (sometimes truncated)
- Screenshot (sometime taken a bit too late)
Just based on those, it's hard to understand what was really displayed on the device when the test failed.
Describe the solution you'd like
An additional, dynamically created, xyz.li file (i.e. readable by Android Studio's layout inspector), generated as a Detox artifact alongside all others.
As the title says - we need to research for an Android SDK tool that does this (typically, a developer would get the layout dump directly from AS these days).
Additional context @LeoNatan can this be done for iOS?
UPDATE 03/2023
This feature is available and has been fully functional on iOS for a long time now. We keep this issue now so as to point out this should be solved equivalently for Android.
In addition, all of our work here would be futile if we don't address the fact that - at least internally at Wix, the artifact is not very approachable. Adding this as a future follow-up task:
- [ ] (Wix internal) Make ui hierarchy snapshot artifact more visible and approachable
On iOS, there isn't a similar file format which we can create. I once wanted to do something similar in Detox Instruments, but haven't worked on or thought about it in years.
Why isn't a screenshot and a hierarchy enough?
Another big problem with this approach is native hierarchy vs what web devs are familiar with, e.g. "components" and "props". There is no way to bring the latter, or somehow map it to the view hierarchy, leaving many people, unfamiliar with native development, scratching their heads. Those that are familiar usually have no problem following this guide and checking the live hierarchy (even in 3D form) in Xcode.
I agree this may not be ideal for web devs. Nevertheless native devs could benefit, esp. when investigating issues on CI. Snapshots are too superficial, and the textual hierarchies are overly detailed.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you believe the issue is still relevant, please test on the latest Detox and report back.
Thank you for your contributions!
For more information on bots in this reporsitory, read this discussion.
Apparently new Xcode 12 has something similar. I too will research the file format and try to implement for Detox.
Seems like it's now possible to export an .li snapshot using the Layout Inspector https://developer.android.com/studio/releases/past-releases/as-bumblebee-release-notes#new-in-layout-inspector
Unfortunately, I wasn't able to find a programmatic way to do this.
I wonder, can it be helpful: https://github.com/Grigory-Rylov/android-layout-inspector ?