Skip to content

Add a Hilt screenshot test example to the sample suite #325

Description

@AndroidTestifyBot

Is your feature request related to a problem? Please describe.

#321 adds a recipe for testing composables that use Hilt, but nothing in this repository exercises that flow. There is no Hilt screenshot test anywhere in Library/, Ext/ or Samples/, so the recipe's end-to-end sequence has never actually been run here.

Every individual claim in the page was verified against source during review, but the sequence rests on reasoning rather than a working example. That's a meaningful difference: #318 could lift its examples verbatim from Samples/Legacy/src/androidTest/java/dev/testify/sample/FullscreenCaptureExampleTests.kt, so CI keeps it honest. Nothing keeps #321 honest.

This feedback relates to:

  • The Kotlin library
  • The Gradle plugin
  • The IntelliJ Platform plugin
  • The sample code
  • The documentation

Describe the solution you'd like

A minimal Hilt screenshot test in the sample suite, which #321 can then link to the way #318 links to FullscreenCaptureExampleTests.kt.

Samples/Flix looks like the natural home — most of the wiring already exists there:

  • the Hilt plugin is already applied (id 'com.google.dagger.hilt.android', hilt-android:2.60.1)
  • MainActivity is already @AndroidEntryPoint
  • hilt-navigation-compose:1.2.0 is already a dependency
  • Compose and the Testify Compose extension are already set up, with an existing ComposableScreenshotTest.kt and a suite of Compose screenshot tests

Specifically, these steps from the recipe are the ones currently unverified:

  1. @AndroidEntryPoint class HiltComposableTestActivity : ComposableTestActivity() in src/debug/java.
  2. The debugCompileOnly pair. The reasoning checks out — ComposableTestActivity ships in dev.testify:testify-compose and implements TestifyResourcesOverride from dev.testify:testify, so both are needed on the compile classpath — but it has not been built.
  3. That compileOnly is sufficient, i.e. the Testify classes really do come from the test APK at runtime for a subclass declared in the debug manifest.
  4. Declaring the subclass in src/debug/AndroidManifest.xml with @style/Theme.AppCompat.NoActionBar, and whether that host produces pixel-identical output to the standard ComposableTestActivity (relevant to whether migrating existing tests forces a re-record).
  5. HiltTestRunner + @HiltAndroidTest + HiltAndroidRule at order = 0 ahead of ComposableScreenshotScenarioRule at order = 1.
  6. The IllegalStateException: Given component holder class … does not implement interface dagger.hilt.internal.GeneratedComponent message quoted at the top of the page. It is introduced with "an error like this" rather than as verbatim output, because it could not be reproduced here. A real run would confirm or correct the wording — readers will search on that string.

Describe alternatives you've considered

  • Leaving the recipe unbacked. It is well-reasoned and each claim verifies individually, but it is the only page in the recent documentation batch with no executable example, and readers arrive at it already stuck.
  • Putting the example in Samples/Paparazzi instead. It also uses Hilt, but it is a Paparazzi sample rather than an instrumentation one, so it would not exercise the Testify path.

Additional context

Came out of the review of the September 2026 documentation batch. #321 is approved and carries a standing caveat pointing at this gap.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    DocumentationExtensionRelates to one of the extension librariesFeedbackSampleRelates to the Sample application

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions