Skip to content

Conversation

magnusvs
Copy link

@magnusvs magnusvs commented Feb 14, 2024

Adds a FileNameProvider that can be implemented in any way to specify file names for a recorded Snapshot.
Fixes #549

We wanted this feature because we had a developer on Linux with ecryptfs which only supports file names up to 143 characters, and we we're exceeding this with the current Snapshot file names.

@magnusvs magnusvs force-pushed the feature/snapshot-file-name branch from 4ec0ba2 to 3c9f862 Compare February 14, 2024 12:33
Adds a FileNameProvider that can be implemented in any way to specify file names for a recorded Snapshot.
Closes feature request cashapp#549
@magnusvs magnusvs force-pushed the feature/snapshot-file-name branch from 3c9f862 to 43229ed Compare February 14, 2024 13:01
@jdeebee
Copy link

jdeebee commented Apr 5, 2025

This is really needed, can we (as the community) get this merged please?

We ended up setting up a new module in our project (named "paparazzi-utils") to workaround this issue (as a lot of changes need to be made to private classes which in turn depend on a host of other internal classes - which all need to be copied - leading to hassle and overhead especially when maintaining, leading to making updating Paparazzi difficult therefore less adoption of new releases). Another workaround I can think of would be forking this repo and hosting and publishing it in an internal Nexus repository, but that would also require a lot of overhead and maintenance hassle as well. Would love it if we can this PR merged or provide this functionality some other way. We re-use the screenshots taken by Paparazzi for our "storybook gallery" and the files need to be named properly as we wish (name of the screen + light/dark theme + name of the device - but this convention is subject to change so the naming should be custom).

@safa007
Copy link

safa007 commented Apr 7, 2025

+1, this is very much needed. @jrodbx and paparazzi team could we get eyes on this please?

@jrodbx
Copy link
Collaborator

jrodbx commented Apr 7, 2025

It might be helpful to know that we have discussed moving the current file naming scheme into, say, a json descriptor, and making the filename more of a hash (similar to how we do in the build directory). The point being that the file names are an implementation detail of Paparazzi and should not depended on or tweaked.

@safa007
Copy link

safa007 commented Apr 7, 2025

It might be helpful to know that we have discussed moving the current file naming scheme into, say, a json descriptor, and making the filename more of a hash (similar to how we do in the build directory). The point being that the file names are an implementation detail of Paparazzi and should not depended on or tweaked.

@jrodbx the current problem our team is facing is that toFileName is using testName.methodName within the function which is adding an index that changes every time verify snapshots runs.

For example: test[3.Group.ScreenName,1.PIXEL_4,1.light] - the first 3 here is an index set by testName.methodName and it fluctuates depending on the test ordering.

This behavior makes Paparazzi effectively unusable for us. With over 1000 snapshots, any minor change to previews, or adding new previews, causes all of the snapshot files to be regenerated with new file names. This makes it very challenging to isolate actual changes in a pull request.

I believe the most effective solution would be to allow customization of the file naming. It seems reasonable that this flexibility should be supported.

If moving towards json descriptors or hash names for the files fixes this core issue, we're all for it.

EDIT: We found a solution to this by using parameterized tests instead of TestParameterInjector. You can name the test by used the Parameterized annotation like @Parameterized.Parameters(name = "{0} {1}"). This way the test names are not based on any index.

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.

Feature Request: Provide a way of simplifying snapshot name
4 participants