Skip to content

Conversation

@allenchen1154
Copy link
Contributor

@allenchen1154 allenchen1154 commented Sep 4, 2025

By default, Paparazzi concatenates the package name of the test class, the test class name, the test function name, the test function parameters, and the name value passed to the snapshot() function. On some systems this can cause a java.io.FileNotFoundException (File name too long).

This is a commonly encountered issue and an issue has been filed against the Paparazzi repo to allow overriding this default filename logic. Until then, we can take smaller measures to shorten the file name:

  1. Use an "Impl" suffix for the generated concrete test class
  2. Don't pass a name argument to snapshot(), which results in redundancy. For example, instead of
com.myapplication.test.compose.paparazzi_PaparazziShowkaseScreenshotTest_PaparazziShowkaseTest_test_previews[GroupName**ComponentName**StyleName,Pixel5,Ltr,DEFAULT]_GroupName**ComponentName**StyleName.temp.png

this will now generate

com.myapplication.test.compose.paparazzi_PaparazziShowkaseScreenshotTestImpl_test_previews[GroupName**ComponentName**StyleName,Pixel5,Ltr,DEFAULT].temp.png

By default, Paparazzi concatenates the package name of the test class, the test class name, the test function name, the test function parameters, and the `name` value passed to the `snapshot()` function. On some systems this can cause a `java.io.FileNotFoundException (File name too long)`.

This is a commonly encountered issue and an [issue has been filed against the Paparazzi repo](cashapp/paparazzi#1085) to allow overriding this default filename logic. Until then, we can take smaller measures to shorten the file name:

1. Use an "Impl" suffix for the generated concrete test class
2. Don't pass a `name` argument to `snapshot()`, which results in redundancy. For example, instead of
```
com.myapplication.test.compose.paparazzi_PaparazziShowkaseScreenshotTest_PaparazziShowkaseTest_test_previews[GroupName**ComponentName**StyleName,Pixel5,Ltr,DEFAULT]_GroupName**ComponentName**StyleName.temp.png
```
this will now generate
```
```
com.myapplication.test.compose.paparazzi_PaparazziShowkaseScreenshotTestImpl_test_previews[GroupName**ComponentName**StyleName,Pixel5,Ltr,DEFAULT].temp.png
```
@allenchen1154
Copy link
Contributor Author

Changes included in #421

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants