Skip to content
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

Compose Preview friction #446

Closed
yschimke opened this issue Jul 24, 2024 · 9 comments · Fixed by #445
Closed

Compose Preview friction #446

yschimke opened this issue Jul 24, 2024 · 9 comments · Fixed by #445

Comments

@yschimke
Copy link
Contributor

https://takahirom.github.io/roborazzi/preview-support.html#generate-compose-preview-screenshot-tests

seems incomplete, running with 1.23.0 my gradle sync fails with

Please set roborazzi.generateRobolectricPreviewTests.packages in the generatePreviewTests extension or set roborazzi.generateRobolectricPreviewTests.enable = false.See https://github.com/sergio-sastre/ComposablePreviewScanner?tab=readme-ov-file#how-to-use for more information.

Could this fail at runtime instead? And should it be in the docs?

@yschimke
Copy link
Contributor Author

Also error

e: file:///usr/local/google/home/yschimke/workspacesda/StudioProjects/confetti/wearApp/build/generated/java/generateDebugComposePreviewRobolectricTests/com/github/takahirom/roborazzi/RoborazziPreviewParameterizedTests.kt:8:8 Unresolved reference 'sergio'.

Following instructions

@takahirom
Copy link
Owner

👀

@yschimke
Copy link
Contributor Author

yschimke commented Jul 24, 2024

I also needed

                          testImplementation("io.github.takahirom.roborazzi:roborazzi-compose-preview-scanner-support:1.2.3")

without attempting "Manually adding Compose Preview screenshot tests"

@yschimke
Copy link
Contributor Author

Could AndroidComposePreviewTester be public (experimental) and open?

I need to run some tearDown, and it seems awkward without lifecycle hooks.

@yschimke
Copy link
Contributor Author

Warnings on compiling

w: file:///usr/local/google/home/yschimke/workspacesda/StudioProjects/confetti/wearApp/build/generated/java/generateDebugComposePreviewRobolectricTests/com/github/takahirom/roborazzi/RoborazziPreviewParameterizedTests.kt:24:13 This declaration needs opt-in. Its usage should be marked with '@com.github.takahirom.roborazzi.ExperimentalRoborazziApi' or '@OptIn(com.github.takahirom.roborazzi.ExperimentalRoborazziApi::class)'

@takahirom
Copy link
Owner

Thank you for trying this out.
Regarding dependencies, we have some dependency validations in place here. I expected there would be an error with the validation.
It might be better to provide a link to the sample for a smoother setup process.

@yschimke
Copy link
Contributor Author

If you need a specific support library from roborazzi, it feels appropriate to add that, even though we discussed not messing with the robolectric dependencies.

@takahirom
Copy link
Owner

Whether to add dependencies in the plugin or not is a tough decision, as I initially added them all. You mentioned Hilt and Compose, which don't even add their runtime dependencies in the plugin. It's difficult to decide if something is a 'specific support library'; for example, Hilt Android support also doesn't add the runtime dependency. I also find that if we have a library dependency in 'roborazzi-compose-preview-scanner-support', it can be difficult for users to exclude that library dependency.

@yschimke
Copy link
Contributor Author

OK, makes sense.

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 a pull request may close this issue.

2 participants