Open sagix opened 2 years ago
+1 on this. I can only run these checks on a Jetpack Compose rootView. But when I run it, I only get suggestions for the rootView of the screen and it does not go through all the child Composables like it would on a view based application.
But, I see that the "Accessibility Scanner" app somehow gives me correct results on Compose screens as well.
Could you please give some guidance on how to run the checks in the repo on Compose screens? Any documentation on this would help greatly.
I have the same Question. Are there any plans to support Jetpack Compose with this tool?
When ATF is used within an Espresso test, it is not possible for it to inspect Compose content from using the currently released versions. However, API 34 adds new functionality that will make this feasible.
I assume this, so devices and emulators, but not robolectric?
public AccessibilityHierarchyAndroid build() {
AccessibilityHierarchyAndroid result;
if (fromRootView != null) {
if (BuildCompat.isAtLeastU() && !isRobolectric()) {
result =
buildHierarchyFromViewAndItsNodeInfo(
fromRootView, getAccessibilityNodeInfoExtraDataExtractor());
} else {
result =
buildHierarchyFromView(fromRootView, getAccessibilityNodeInfoExtraDataExtractor());
}
That's correct. The Nov 2023 commit added support for UIs containing Compose content when running with Android 10 (API 34), but not on Robolectric.
It also added ElementMatchers (similar to Espresso's ViewMatchers) and matchesElements to support matching AccessibilityViewCheckResult
s with ViewHierarchyElement
s that are not from Views
.
This is still a work in progress.
Specifically for Robolectric, is the bulk of the technical work in robolectric or ATF?
Wanted to follow up here asking what is the scope of work to enable support for ATF?
It has been a big blocker for us at Airbnb to enable accessibility checks for our Jetpack Compose components and would love to find a solution if possible.
Google mentioned in this video that they added support for Compose into this library, but I don't see any updates in the project to suggest this is the case
If you run the ATF checks on a View that contains Composable content (which can be a ComposeView), then they may detect accessibility issues, but only on API 34+. And not in Robolectric tests.
If you look at AccessibilityValidator.java you will see a new method buildHierarchyFromViewAndItsNodeInfo
that provides this support.
Accessibility Scanner works with Compose. ATF checks can run on Compose content in Android Studio. Espresso accessibility and Play Store Developer Console’s Pre Launch Report can detect accessibility issues in Compose content when run on Android U. Also, the help content for Accessibility Scanner results (to which the ATF results reference) has been updated to specifically address Compose.
At the moment, there is no convenient way to instrument pure Compose tests, but we've heard ample feedback on this and are considering how ATF can best support this type of usage.
This library works perfectly with a View based application.
But, not at all with jetpack compose.
Is there any plan to support it?