takahirom / roborazzi

Make JVM Android integration test visible 🤖📸
https://takahirom.github.io/roborazzi/
Apache License 2.0
739 stars 35 forks source link

[Feature Request] show Accessibility checks visually #568

Open yschimke opened 3 days ago

yschimke commented 3 days ago

Something similar to https://developer.android.com/guide/topics/ui/accessibility/testing#accessibility-scanner

Perhaps on failing accessibility checks, overlay the screenshot with the bounding box of the failure

https://developer.android.com/guide/topics/ui/accessibility/testing#accessibility-scanner

image

yschimke commented 3 days ago

example that includes the check ViewImage, useful for contrast failures

    // Rethrow the Accessibility exception once screenshots have passed
    if (accessibilityException != null) {
        accessibilityException.results.forEachIndexed { index, check ->
            val viewImage = check.viewImage
            if (viewImage is BitmapImage) {
                FileOutputStream(
                    "build/outputs/roborazzi/" +
                        "${screenshotName}_${deviceName}_$index.png",
                ).use {
                    viewImage.bitmap.compress(PNG, 100, it)
                }
            }
        }

        throw accessibilityException
    }
takahirom commented 2 days ago

I think we can use AwtRoboCanvas to save images while respecting user settings, such as image extensions, and to write text and frames.