cashapp / redwood

Multiplatform reactive UI for Android, iOS, and web using Kotlin and Jetpack Compose
https://cashapp.github.io/redwood/0.x/docs/
Apache License 2.0
1.65k stars 73 forks source link

Flatten widget tests by toolkit #2263

Closed swankjesse closed 2 months ago

swankjesse commented 2 months ago

Redwood includes two widget schemas:

It’s possible we’ll add more in the future: redwood-animations, redwood-lottie, etc.

For each we support a handful of target widget toolkits:

At the moment only redwood-layout has good snapshot tests for uiview. This is made possible by the KotlinHostingXCTestCase mechanism in redwood-layout-uiview. I’d like to add snapshot tests for redwood-lazylayout without much copy-paste and without much build complexity.

I propose flattening all tests for each toolkit. The resulting Gradle module structure would be something like this:

This structure makes it simple to reuse KotlinHostingXCTestCase for lazylayout tests. The drawback of this is you can’t run just the tests for lazylayout without running the tests for layout.

JakeWharton commented 2 months ago

Is the only motivation KotlinHostingXCTestCase? Or are there others?

Today we lack a build system for the Swift-based projects, but we could add one which would let us share libraries that same way that we enjoy today with Gradle and Kotlin. I had talked to @efirestone about trying SPM not too long ago for the very purpose of sharing KotlinHostingXCTestCase between our two layout modules.

swankjesse commented 2 months ago

Yep, that’s exactly it. Trying SPM feels like a better solution, but I’m not ready to shave that yak! I’ll do something quick & dirty for now to unblock and close this out.

JakeWharton commented 2 months ago

Copy/paste! Two copies is fine for now.

SPM also would simplify CI and the nasty xcodebuild invocations.