feat: Disable view hierarchy dumping on failures completely #896
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue
In #895 @mykola-mokhnach disabled screenshots and hierarchy snapshots on failures, but looks like it wasn't enough.
In Espresso 3.5.0-alpha1 Google introduced the "Save view hierarchy to a file on failures" feature, which basically dumps whole view hierarchy on failure.
It was added here and later modified here.
The issue is that even if it won't save the view hierarchy to the file by default, it would still dump it beforehand. And to dump the view hierarchy it would need to access the views - and this would cause issues on Appium, as it's running on a different thread other than main.
Here is the stack trace sample
Solution
Immediately remove all
ViewHierarchyExceptionHandler
handlers that have been added in the constructor - it would mean that Espresso wouldn't do any hierarchy dump by itself as it was before Espresso 3.5 (it's also compatible with 3.6). We've checked this with @pr4bh4sh and this eliminated all exceptions mentioned above.