Skip to content
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

Log warnings when Accessibility checks not configured correctly #572

Merged
merged 1 commit into from
Nov 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,11 @@ data class RoborazziATFAccessibilityChecker(
return
}

if (!canScreenshot()) {
roborazziErrorLog("Skipping accessibilityChecks on GraphicsMode.Mode.LEGACY")
return
}

if (Build.FINGERPRINT == "robolectric") {
// TODO remove this once ATF doesn't bail out
// https://github.com/google/Accessibility-Test-Framework-for-Android/blob/c65cab02b2a845c29c3da100d6adefd345a144e3/src/main/java/com/google/android/apps/common/testing/accessibility/framework/uielement/AccessibilityHierarchyAndroid.java#L667
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,5 +218,41 @@ class ComposeA11yTest {
)
)
}

@Test
@Config(sdk = [33])
fun wrongApi() {
composeTestRule.setContent {
// No failures because not API 34

Box(modifier = Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {
Box(
modifier = Modifier
.size(100.dp)
.background(Color.DarkGray)
) {
Text("Something hard to read", color = Color.DarkGray)
}
}
}
}

@Test
@GraphicsMode(GraphicsMode.Mode.LEGACY)
fun notNative() {
// No failures because legacy

composeTestRule.setContent {
Box(modifier = Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {
Box(
modifier = Modifier
.size(100.dp)
.background(Color.DarkGray)
) {
Text("Something hard to read", color = Color.DarkGray)
}
}
}
}
}

Loading