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

What to do in Roborazzi #483

Open
takahirom opened this issue Sep 14, 2024 · 7 comments
Open

What to do in Roborazzi #483

takahirom opened this issue Sep 14, 2024 · 7 comments

Comments

@takahirom
Copy link
Owner

takahirom commented Sep 14, 2024

I have been absent for months due to DroidKaigi 2024. We have a lot to do. I would like to list what we need to do and prioritize it.

Core Features

Migrate iOS implementation to use RoboCanvas Interface

#383

We couldn't progress with the multiplatform due to this issue, which makes it difficult to maintain our codebase. However, it seems the library will be released next week, but it is currently blocked.
dropbox/differ#17
Now it was unblocked!

IntelliJ Plugin

Use CaptureResults in the IntelliJ Plugin (Your contributions are welcome)

#485

We would like to use CaptureResults in the IntelliJ Plugin. This feature allows us to view images in directories other than the default directory set by the tests, making it more effective. Additionally, we could see the class info for the images and make it possible to navigate the test class.

Gradle Plugin

Merge the test results of each module (Your contributions are welcome)

#472
Viewing all the module test results could be very useful, but we currently cannot do this. We need to understand the best practices for using multiple modules in Gradle.

Experimental Compose Preview Support

Add some options to RobolectricPreviewInfosApplier (Your contributions are welcome)

Our Preview annotation support offers very limited options.

https://github.com/takahirom/roborazzi/blob/main/roborazzi-compose-preview-scanner-support/src/main/java/com/github/takahirom/roborazzi/RobolectricPreviewInfosApplier.kt

Future Enhancement

  • Robolectric-based emulator: It is doable, but we don't have a strong motivation or use case for this. However, we can debug and create something similar to Maestro Studio.
    Robolectric Emulator(Roborazzi Emulator) #176

  • AI: I'm considering an AI-related feature. We won't introduce it in an existing module; instead, it will be a new module. I have a few ideas, but we need to think about what we can do and what we have to do. (Your ideas are welcome.)
    AI Idea for Roborazzi Thread #484

@sergio-sastre
Copy link
Contributor

sergio-sastre commented Sep 15, 2024

I can gladly help with Compose Preview support, but I’ll be soon on holidays till October.
For the following it should be feasible:

  • Width & height,
  • showBackground & backgroundColor
  • Device (string matching a bit cumbersome but doable)
  • ApiLevel (filter previews by api level and create 1 parameterized test for each api level)

These are likely tough…I’ve done some research though

@eyedol
Copy link
Contributor

eyedol commented Sep 17, 2024

With #383 right up my alley, and now that dropbox/differ#17 has been merged, I can pick this up. I'll be at droidcon NY so after, I'll make time to look into this.

@sergio-sastre
Copy link
Contributor

sergio-sastre commented Oct 11, 2024

I can gladly help with Compose Preview support, but I’ll be soon on holidays till October. For the following it should be feasible:

  • Width & height,
  • showBackground & backgroundColor
  • Device (string matching a bit cumbersome but doable)
  • ApiLevel (filter previews by api level and create 1 parameterized test for each api level)

These are likely tough…I’ve done some research though

FYI @takahirom
I'm working on it to support ALL the possible specifications of the "device" in the next ComposablePreviewScanner release, namely this feature request.
For that I'm implementing a string parsing that returns an object that looks like this

data class Device(
    val id: Identifier,
    val dimensions: Dimensions,
    val densityDpi: Int,
    val orientation: Orientation,
    val shape: Shape,
    val chinSize: Int,
    val type: Type?, // Phone, Car, Desktop...
) {
   fun inDp() : Device {...}
   fun inPx(): Device {...}
}

class Identifier(
   val id: String?,
   val name: String?,
)

class Dimensions(
    val height: Float,
    val width: Float,
    val unit: Unit, // px or dp
)
...

This should make it very easy to support the device param of Previews in Roborazzi & Paparazzi.
not sure when I'll finish it, but likely by the end of next week

@sergio-sastre
Copy link
Contributor

I can gladly help with Compose Preview support, but I’ll be soon on holidays till October. For the following it should be feasible:

  • Width & height,
  • showBackground & backgroundColor
  • Device (string matching a bit cumbersome but doable)
  • ApiLevel (filter previews by api level and create 1 parameterized test for each api level)

These are likely tough…I’ve done some research though

FYI @takahirom I'm working on it to support ALL the possible specifications of the "device" in the next ComposablePreviewScanner release, namely this feature request. For that I'm implementing a string parsing that returns an object that looks like this

data class Device(
    val id: Identifier,
    val dimensions: Dimensions,
    val densityDpi: Int,
    val orientation: Orientation,
    val shape: Shape,
    val chinSize: Int,
    val type: Type?, // Phone, Car, Desktop...
) {
   fun inDp() : Device {...}
   fun inPx(): Device {...}
}

class Identifier(
   val id: String?,
   val name: String?,
)

class Dimensions(
    val height: Float,
    val width: Float,
    val unit: Unit, // px or dp
)
...

This should make it very easy to support the device param of Previews in Roborazzi & Paparazzi. not sure when I'll finish it, but likely by the end of next week

So I just released ComposablePreviewScanner 0.4.0.

The final class looks like this:

data class Device(
    val identifier: Identifier? = null,
    val dimensions: Dimensions,
    val densityDpi: Int,
    val orientation: Orientation,
    val shape: Shape,
    val chinSize: Int = 0,
    val type: Type? = null,
    val screenRatio: ScreenRatio = ScreenRatioCalculator.calculateFor(dimensions),
    val screenSize: ScreenSize = ScreenSizeCalculator.calculateFor(dimensions, densityDpi),
    val cutout: Cutout = NONE,
    val navigation: Navigation = GESTURE,
) {

    fun inDp(): Device = this.copy(dimensions = dimensions.inDp(densityDpi))

    fun inPx(): Device = this.copy(dimensions = dimensions.inPx(densityDpi))
}

And I provided a method for an almost-one-liner integration with Robolectric/Roborazzi :)

RobolectricDeviceQualifierBuilder.build(preview.previewInfo)?.run {
          RuntimeEnvironment.setQualifiers(this)
}

Which should be called before calling any cumulative qualifier

@takahirom
Copy link
Owner Author

Thank you for providing this valuable feature! I think we can use it here.
https://github.com/takahirom/roborazzi/blob/main/roborazzi-compose-preview-scanner-support/src/main/java/com/github/takahirom/roborazzi/RobolectricPreviewInfosApplier.kt#L10

@sergio-sastre
Copy link
Contributor

Thank you for providing this valuable feature! I think we can use it here.

https://github.com/takahirom/roborazzi/blob/main/roborazzi-compose-preview-scanner-support/src/main/java/com/github/takahirom/roborazzi/RobolectricPreviewInfosApplier.kt#L10

Yes, I can try to provide an MR today or in the upcoming days 😊

@takahirom
Copy link
Owner Author

If you can handle this, that would be much appreciated! Thank you!

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

3 participants