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

[Request] Per-module metadata #299

Open
jd565 opened this issue Feb 5, 2023 · 6 comments
Open

[Request] Per-module metadata #299

jd565 opened this issue Feb 5, 2023 · 6 comments

Comments

@jd565
Copy link

jd565 commented Feb 5, 2023

We have a multi-module project where we want to use showkase with paparazzi for screenshot testing of previews. Right now the generated metadata from showkase contains a single list of all the showkase previews inside project, with that metadata only available from the root project, meaning that all the screenshot tests have to be run from the root module, or another module that depends on root.

We would find it very useful if each module could have a generated metadata file listing the showkase components in that module, then the root module can aggregate all of them. With this change, each module could contain the screenshot tests for that module, enabling developers to run the screenshot tests in module they have changed while excluding testing modules that haven't changed.

For example:

In a multi-module project e.g.

App
| -> A
| -> B
| -> C

Would have a Showkase.getMetadata() function in App (root module), as well as generating a AppModuleShowkaseMetadata, AModuleShowkaseMetadata, BModuleShowkaseMetadata, CModuleShowkaseMetadata.

I did investigate using the ShowkaseMetadata_x generated file (which has a list of annotated functions), but those annotations are BINARY retention so can't be used for reflection. This is also generated on a per-file basis while a per-module aggregated file would be useful here.

@jd565
Copy link
Author

jd565 commented Feb 17, 2023

Is there anything wrong with defining multiple showkase roots?
So far I've been doing this so I can access the metadata within that module, and then filter out components from other modules (e.g. if A depends on B then the generated metadata for A has all the composables for A and B, so my test is then filtering out the components from B)

I took a brief look at the generation code and it doesn't seem like a super difficult change, so would be happy to try putting together a PR to enable this behaviour, if this is a reasonable change to make.

@iamutkarshtiwari
Copy link

iamutkarshtiwari commented Feb 20, 2023

@jd565 Thank you for raising this. I have the same requirement where multiple teams would be working in the same repo but in different modules and we want to have separate screenshot test (showkase + paparazzi synergy) coverage for each team. We don't want one team's regression to leak into other team's workflow. But as of now, it's not possible because Showkase aggregates everything from the project. I'd really nice to have this feature!

@vinaygaba
Copy link
Collaborator

@jd565 @iamutkarshtiwari In theory, your project can have multiple ShowkaseRoot implementations and that's supported already. This allows you to also have multiple screenshot tests, each focused on a different tree of submodules. I feel like using that setup should solve this use case. What do y'all think? Happy to explain it a bit more if what I said wasn't making sense.

@jd565
Copy link
Author

jd565 commented May 5, 2023

@vinaygaba We do this in the setup right now so each module has it's own ShowkaseRoot that is used, and it works, but the ShowkaseRoot in module B includes all previews from module A if B depends on A, so each test has some filtering to only include the previews that start with a specific package name to filter out previews from another module

@ss0930
Copy link

ss0930 commented Apr 15, 2024

@vinaygaba We do this in the setup right now so each module has it's own ShowkaseRoot that is used, and it works, but the ShowkaseRoot in module B includes all previews from module A if B depends on A, so each test has some filtering to only include the previews that start with a specific package name to filter out previews from another module

@jd565 I am using showkase-screenshot-testing-paparazzi artifact #294 and running into this issue. How do you filter out the previews from another module?

@vinaygaba
Copy link
Collaborator

@jd565 Started implementing some functionality that will address this. Take a look if you have thoughts and would like to shape the API - #392

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

No branches or pull requests

4 participants