Conversation
Paparazzi snapshot testing
There was a problem hiding this comment.
Pull request overview
This PR upgrades the build tooling to Gradle 9.3.1 / Java 21 and introduces Paparazzi-based snapshot testing for Compose previews, along with some refactoring of preview/test utilities and CI workflows.
Changes:
- Update Gradle wrapper to 9.3.1 and simplify Gradle launcher scripts (remove explicit CLASSPATH handling).
- Add Paparazzi + composable-preview-scanner integration for automatically generating snapshot tests from
@Previewannotations, including custom device config handling and HTML reports. - Refactor sample M2/M3 preview composables and themes, add a
DarkLightPreviewmeta-annotation, update snapshot reference images, and wire Paparazzi into the CI workflows and migration notes (Java 21).
Reviewed changes
Copilot reviewed 20 out of 110 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| settings.gradle.kts | Bumps version catalog dependency com.mikepenz:version-catalog from 0.12.2 to 0.12.3, aligning with the updated toolchain. |
| sample/android/src/test/snapshots/images/Paparazzi_Preview_Test_com.mikepenz.markdown.ui.m3.snapshottestskt.inlinecodetest.png | New Paparazzi-generated snapshot image for M3 inline code preview; used by the new snapshot test suite. |
| sample/android/src/test/snapshots/images/Paparazzi_Preview_Test_com.mikepenz.markdown.ui.m3.snapshottestskt.highlightedcodetest.png | New snapshot image for M3 highlighted code preview (light theme). |
| sample/android/src/test/snapshots/images/Paparazzi_Preview_Test_com.mikepenz.markdown.ui.m3.snapshottestskt.highlightedcodetest.night.png | New snapshot image for M3 highlighted code preview (night mode). |
| sample/android/src/test/snapshots/images/Paparazzi_Preview_Test_com.mikepenz.markdown.ui.m3.blockquotestestskt.blockquotewithmultiplelinestest.light.png | New snapshot image for M3 blockquote-with-multiple-lines preview. |
| sample/android/src/test/snapshots/images/Paparazzi_Preview_Test_com.mikepenz.markdown.ui.m2.snapshottestskt.inlinecodetest.png | New snapshot image for M2 inline code preview (light theme). |
| sample/android/src/test/snapshots/images/Paparazzi_Preview_Test_com.mikepenz.markdown.ui.m2.snapshottestskt.inlinecodetest.night.png | New snapshot image for M2 inline code preview (night mode). |
| sample/android/src/test/snapshots/images/Paparazzi_Preview_Test_com.mikepenz.markdown.ui.m2.snapshottestskt.highlightedcodetest.png | New snapshot image for M2 highlighted code preview (light theme). |
| sample/android/src/test/snapshots/images/Paparazzi_Preview_Test_com.mikepenz.markdown.ui.m2.snapshottestskt.highlightedcodetest.night.png | New snapshot image for M2 highlighted code preview (night mode). |
| sample/android/src/test/kotlin/generated/paparazzi/tests/GeneratedComposablePreviewPaparazziTests.kt | New generated test harness that scans @Preview-annotated composables, builds DeviceConfigs, and runs Paparazzi snapshots; contains a density mapping bug (Density(parsedDevice.densityDpi)) that won’t compile and must be fixed. |
| sample/android/src/test/snapshots/images/Paparazzi_Preview_Test_com.mikepenz.markdown.ui.m3.snapshottestskt.inlinecodetest.png | (Duplicate path entry in diff listing) Same as M3 inline code snapshot above. |
| sample/android/src/test/snapshots/images/Paparazzi_Preview_Test_com.mikepenz.markdown.ui.m3.snapshottestskt.highlightedcodetest.png | (Duplicate path entry) Same as M3 highlighted-code snapshot above. |
| sample/android/src/test/snapshots/images/Paparazzi_Preview_Test_com.mikepenz.markdown.ui.m3.snapshottestskt.highlightedcodetest.night.png | (Duplicate path entry) Same as M3 highlighted-code night snapshot above. |
| sample/android/src/test/snapshots/images/Paparazzi_Preview_Test_com.mikepenz.markdown.ui.m3.blockquotestestskt.blockquotewithmultiplelinestest.light.png | (Duplicate path entry) Same as M3 blockquote-multi-line snapshot above. |
| sample/android/src/test/snapshots/images/Paparazzi_Preview_Test_com.mikepenz.markdown.ui.m2.snapshottestskt.inlinecodetest.png | (Duplicate path entry) Same as M2 inline code snapshot above. |
| sample/android/src/test/snapshots/images/Paparazzi_Preview_Test_com.mikepenz.markdown.ui.m2.snapshottestskt.inlinecodetest.night.png | (Duplicate path entry) Same as M2 inline code night snapshot above. |
| sample/android/src/test/snapshots/images/Paparazzi_Preview_Test_com.mikepenz.markdown.ui.m2.snapshottestskt.highlightedcodetest.png | (Duplicate path entry) Same as M2 highlighted-code snapshot above. |
| sample/android/src/test/snapshots/images/Paparazzi_Preview_Test_com.mikepenz.markdown.ui.m2.snapshottestskt.highlightedcodetest.night.png | (Duplicate path entry) Same as M2 highlighted-code night snapshot above. |
| sample/android/src/screenshotTestDebug/reference/com/mikepenz/markdown/ui/m3/SnapshotTests/HighlightedCodeTest_5d136f40_0.png | Updated/added reference image for M3 highlighted code snapshot tests (new Paparazzi-based baseline). |
| sample/android/src/screenshotTestDebug/reference/com/mikepenz/markdown/ui/m3/SnapshotTests/HighlightedCodeTest_3fc03e55_0.png | Additional M3 highlighted code reference image for a different configuration (e.g., dark/light or size variant). |
| sample/android/src/screenshotTestDebug/reference/com/mikepenz/markdown/ui/m2/SnapshotTests/HighlightedCodeTest_5d136f40_0.png | Updated/added reference image for M2 highlighted code snapshot tests. |
| sample/android/src/screenshotTestDebug/reference/com/mikepenz/markdown/ui/m2/SnapshotTests/HighlightedCodeTest_3fc03e55_0.png | Additional M2 highlighted code reference image variant. |
| sample/android/src/main/kotlin/com/mikepenz/markdown/ui/m3/util/Helper.kt | Wraps M3 Markdown calls in SampleTheme and CompositionLocalProvider(LocalInspectionMode provides true) so highlighted code paths run in “inspection mode” for previews and snapshots. |
| sample/android/src/main/kotlin/com/mikepenz/markdown/ui/m3/theme/M3Theme.kt | New M3 SampleTheme helper that defines light/dark MaterialTheme color schemes for the M3 sample UI, used by M3 preview helpers. |
| sample/android/src/main/kotlin/com/mikepenz/markdown/ui/m3/SnapshotTests.kt | Converts M3 snapshot previews from a class of member composables to top-level @Preview functions, simplifying consumption by the composable-preview scanner. |
| sample/android/src/main/kotlin/com/mikepenz/markdown/ui/m3/LinkTests.kt | Flattens the M3 LinkTests class into a top-level @DarkLightPreview composable LinkTest, preserving behavior but simplifying scanning. |
| sample/android/src/main/kotlin/com/mikepenz/markdown/ui/m3/ElementsInListsTests.kt | Flattens multiple M3 list-related previews to top-level @DarkLightPreview composables; OrderedListRandomStartTest incorrectly calls the M2 TestMarkdown helper instead of the M3 one. |
| sample/android/src/main/kotlin/com/mikepenz/markdown/ui/m3/BlockquotesTests.kt | Flattens M3 blockquote previews into top-level @DarkLightPreview composables while keeping markdown content unchanged. |
| sample/android/src/main/kotlin/com/mikepenz/markdown/ui/m2/util/Helper.kt | Mirrors the M3 helper: wraps M2 Markdown calls in an M2 SampleTheme and LocalInspectionMode provider to force immediate parsing/highlighting during previews/tests. |
| sample/android/src/main/kotlin/com/mikepenz/markdown/ui/m2/theme/M2Theme.kt | New M2 SampleTheme using MaterialTheme (M2) dark/light color palettes, providing sample-wide styling for M2 previews. |
| sample/android/src/main/kotlin/com/mikepenz/markdown/ui/m2/SnapshotTests.kt | Flattens M2 snapshot previews into top-level @Preview composables, analogous to the M3 snapshot tests, for use by the scanner. |
| sample/android/src/main/kotlin/com/mikepenz/markdown/ui/m2/LinkTests.kt | Converts M2 link tests into a single top-level @DarkLightPreview composable LinkTest. |
| sample/android/src/main/kotlin/com/mikepenz/markdown/ui/m2/ElementsInListsTests.kt | Converts M2 elements-in-lists tests to top-level @DarkLightPreview composables, including the ordered-list random start case. |
| sample/android/src/main/kotlin/com/mikepenz/markdown/ui/m2/BlockquotesTests.kt | Converts M2 blockquote tests into top-level @DarkLightPreview composables mirroring the M3 versions. |
| sample/android/src/main/kotlin/com/mikepenz/markdown/ui/annotation/Preview.kt | Introduces @DarkLightPreview meta-annotation that defines paired light/dark previews with consistent background and height settings. |
| sample/android/build.gradle.kts | Applies the com.mikepenz.convention.composable-preview-scanner.paparazzi-plugin and documents (commented-out) composablePreviewPaparazzi configuration block for scanning com.mikepenz.markdown.ui. |
| gradlew.bat | Updates the Windows Gradle wrapper script to the new template, removing explicit CLASSPATH handling and relying on the wrapper jar only. |
| gradlew | Updates the Unix Gradle wrapper script to the new template, removing CLASSPATH handling and simplifying the Java invocation. |
| gradle/wrapper/gradle-wrapper.properties | Bumps the Gradle distribution from gradle-9.2.0-bin.zip to gradle-9.3.1-bin.zip. |
| gradle.properties | Adds com.mikepenz.java.version=21 to align compilation with Java 21, consistent with Paparazzi requirements. |
| build.gradle.kts | Adds the Paparazzi plugin alias (baseLibs.plugins.paparazzi) to the root plugins block so it can be applied in subprojects. |
| MIGRATION.md | Adds a 0.40.0 migration note documenting the Java 21 requirement introduced by Paparazzi; this also reflects additional scope beyond just the Gradle wrapper update. |
| .github/workflows/static.yml | Adjusts the Java matrix to use 17 and 21 (dropping 11) for the static site job. |
| .github/workflows/gradle-dependency-submission.yml | Updates the Java matrix to 17 and 21 (dropping 11 and 15) for dependency submission, matching the new minimum Java level. |
| .github/workflows/ci.yml | Updates CI to test under Java 17 and 21 for wrapper validation and sample build, switches tests from the old screenshot validation to :sample:android:verifyPaparazzi, and changes the artifact/report paths to the new Paparazzi locations. |
Comments suppressed due to low confidence (1)
sample/android/src/main/kotlin/com/mikepenz/markdown/ui/m3/ElementsInListsTests.kt:99
OrderedListRandomStartTestin the M3 package callscom.mikepenz.markdown.ui.m2.util.TestMarkdown, so this preview is rendered with the M2 theming/util implementation instead of the M3 one used by the rest of this file; it should use the M3TestMarkdownhelper to keep the previews consistent.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| #### Version 0.40.0 | ||
|
|
||
| - **Breaking Change**: Due to Paparazzi requiring Java 21 - This project is now also compiled with | ||
| Java 21 | ||
|
|
There was a problem hiding this comment.
The PR description mentions only updating the Gradle wrapper and classpath settings, but this change set also introduces Paparazzi-based preview tests, new M2/M3 theme helpers, preview annotations, and CI workflow changes; consider updating the PR title/description (or splitting the changes) so reviewers understand the full scope.
Updates Gradle wrapper to version 9.3.1 and cleans up classpath settings.