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

Workaround: Inject annotation values to screenshot testing environment at runtime through predefined constants #649

Merged
merged 2 commits into from
Aug 18, 2023

Conversation

jmatsu
Copy link
Contributor

@jmatsu jmatsu commented Aug 17, 2023

Issue

Overview (Required)

  • Showkase should pick up and propagete these values even if custom previews are repeated reflective annotations. But no. Custom annotations and repeated annotations may not be fully supported yet.
  • This workaround just estimates preview configurations from a group and a component key. Yes, this may be fragile a little bit.

Links

Screenshot

Before After

Showkase should pick up and propagete these values even if custom previews are repeated reflective annotations. This workaround just estimates preview configurations from a group and a component key. I guess this is fragile a little bit.
@github-actions
Copy link

github-actions bot commented Aug 17, 2023

Test Results

74 tests   74 ✔️  3m 36s ⏱️
  8 suites    0 💤
  8 files      0

Results for commit 89bdf36.

♻️ This comment has been updated with latest results.

@ShowkaseMultiplePreviewsWorkaround
@Composable
private fun ProvidesPreviewValues(group: String, componentKey: String, content: @Composable () -> Unit) {
val components = componentKey.split("-")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was ambiguous, so fixed in 89bdf36.

@VisibleForTesting
@Retention(SOURCE)
@Target(CLASS, FUNCTION)
annotation class ShowkaseMultiplePreviewsWorkaround
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For removing someday? This seems useful 👀

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes! We should remark code hunks for this workaround cuz they are large and are crosscutting concerns.

@github-actions github-actions bot temporarily deployed to deploygate-distribution August 17, 2023 16:21 Inactive
Copy link
Member

@takahirom takahirom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks absolutely better than what we have now!

@jmatsu jmatsu marked this pull request as ready for review August 17, 2023 16:31

object Japanese {
const val Name = "Japanese"
const val Locale = "ja_JP"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've changed this to a locale with a country because Android always provides a country code.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@github-actions github-actions bot temporarily deployed to deploygate-distribution August 17, 2023 16:55 Inactive
@jmatsu
Copy link
Contributor Author

jmatsu commented Aug 18, 2023

Thank you for your reviews~

@jmatsu jmatsu merged commit d237233 into main Aug 18, 2023
5 checks passed
@jmatsu jmatsu deleted the fix/issues/627 branch August 18, 2023 01:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Issue with PreviewTest Ignoring Preview Annotation Settings
3 participants