-
Notifications
You must be signed in to change notification settings - Fork 214
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow specifying raw file name #1085
Comments
I'm happy to provide a PR that either allows disabling the prepending or a way to specify the full filename. |
Such an addition would be awesome. @ansman do you plan on opening a PR? |
No plans until the maintainers sign off on the idea |
I did something similar using the Showkase library and following the Paparazzi sample as reference companion object {
@JvmStatic
@Parameterized.Parameters(name = "{0}")
fun parameters() = Showkase.getMetadata()
.componentList
.map(::ComponentTestPreview)
.toList()
.toTypedArray()
}
class ComponentTestPreview(
private val showkaseBrowserComponent: ShowkaseBrowserComponent
) {
private val showkaseComponentNameParts = showkaseBrowserComponent.componentKey.split("_")
private val packageName: String
get() = showkaseComponentNameParts[0]
private val componentName: String
get() = showkaseComponentNameParts[1]
private val parameterizedIndex: String
get() = showkaseComponentNameParts.getOrNull(7)?.let { "_$it" }.orEmpty()
@Composable
fun Content() = showkaseBrowserComponent.component()
override fun toString(): String =
"$packageName.$componentName$parameterizedIndex"
} |
Hello from Amazon! Bumping this issue as well. We have a compose component library that uses paparazzi to do our screenshot testing. It would be nice if we could pass a parameter to our tests to set what file location the screenshots are placed in. We have tests for RTL, Dark/Light mode, font scaling etc for each of our components on top of all of the different parameters our components support. This gives us 1000+ screenshots in our repo all dumped into a single folder with difficult names. Paparazzi gets harder to use the more screenshots you have in your repo. I suppose maybe we could combine our screenshots into single images for all variants, but that makes our tests harder to maintain in code. My ask is to be able to organize our screenshots into some sort of folder structure AND rename the files. This would let me continue to have one test for one screenshot. Our CI is rough to use sometimes so it's nice to know that ComponentA in dark mode with parameter X has failed so I can run that test locally to fix the issue. I'm happy to do this contribution myself, but wanting to get sign off before I spend the time. Amazon's open source contribution policy is annoying to work around and I don't want to waste my time if my PR isn't going to be accepted. LMK what you think! |
+1 for allowing a different file structure to organize screenshots. By replacing the delimiters in a few places it's possible to make it generate an output like one of these two options, whichever seems more convenient. This seems to be the same issue as #549 |
@jrodbx Any updates on this? |
I run my tests based on java resource files using a parameterized test. So all my tests run from a single method.
This is problematic because Paparazzi will prepend the test package name, class name and method name to the output file. To make matters worse, the output file name is often too long since I use the FQN of the composable being screenshotted.
Specifying a name doesn't work as it only appends it to the default name.
There should be a way to specify the full file name without having the class name as a prefix.
Here is some code to illustrate the problem:
This will generate files that look like this:
The text was updated successfully, but these errors were encountered: