Skip to content

[#606] Fix: Incorrect imports in HomeScreenTest and MockUtil in Sample Compose androidTest#607

Merged
hoangnguyen92dn merged 3 commits intodevelopfrom
bug/606-fix-incorrect-imports-in-homescreentest-and-mockutil
Jan 22, 2026
Merged

[#606] Fix: Incorrect imports in HomeScreenTest and MockUtil in Sample Compose androidTest#607
hoangnguyen92dn merged 3 commits intodevelopfrom
bug/606-fix-incorrect-imports-in-homescreentest-and-mockutil

Conversation

@kaungkhantsoe
Copy link
Copy Markdown
Contributor

@kaungkhantsoe kaungkhantsoe commented Mar 10, 2025

#606

What happened 👀

  • Import correct model in HomeScreenTest and MockUtil
  • Fix test fail error by merging /META-INF/LICENSE.md and /META-INF/LICENSE-notice.md
  • Remove redundant imports

Insight 📝

  • We need to use mockk-android for UI Test. Ref
  • We need to add debugImplementation(libs.test.compose.ui.manifest) for androidTest or it will throw Unable to resolve activity for Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] error. Reference

Proof Of Work 📹

ScreenRecording.mp4

Summary by CodeRabbit

  • Chores

    • Updated testing dependencies (mockk 1.13.5 → 1.13.8, test-rules to 1.7.0-alpha01)
    • Enhanced Compose testing setup with manifest support and improved test configurations
  • Tests

    • Improved Android instrumentation test infrastructure
  • Refactor

    • Removed experimental API annotations and unused test imports

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 10, 2025

📝 Walkthrough

Walkthrough

This PR updates test dependencies, version catalog entries, fixes import paths to reflect package restructuring, and removes experimental Kotlin Coroutines API annotations from test files. Additionally, packaging configuration is updated with resource merges for license files.

Changes

Cohort / File(s) Summary
Build Configuration
sample-compose/app/build.gradle.kts, sample-compose/gradle/libs.versions.toml
Replaces packagingOptions with packaging and adds resource merges for LICENSE.md and LICENSE-notice.md. Updates test dependency keys: renames test-compose-ui to test-compose-ui-junit4, adds test-mockk-android and test-compose-ui-manifest. Updates mockk from 1.13.5 to 1.13.8 and testRules from 1.6.1 to 1.7.0-alpha01.
Import Path Corrections
sample-compose/app/src/androidTest/java/co/nimblehq/sample/compose/test/MockUtil.kt, sample-compose/app/src/androidTest/java/co/nimblehq/sample/compose/ui/screens/main/home/HomeScreenTest.kt
Updates import paths: Model from domain.model to domain.models, and use case imports to reflect package structure changes.
Test Cleanup
sample-compose/app/src/test/java/co/nimblehq/sample/compose/ui/screens/main/home/HomeScreenTest.kt, sample-compose/domain/src/test/java/co/nimblehq/sample/compose/domain/usecases/IsFirstTimeLaunchPreferencesUseCaseTest.kt, sample-compose/domain/src/test/java/co/nimblehq/sample/compose/domain/usecases/UpdateFirstTimeLaunchPreferencesUseCaseTest.kt
Removes unused imports and deprecated @OptIn(ExperimentalCoroutinesApi) annotations from test files.
Version Catalog
template-compose/gradle/libs.versions.toml
Updates mockk version from 1.13.5 to 1.13.8.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related issues

Possibly related PRs

Suggested labels

type : chore

Suggested reviewers

  • luongvo
  • hoangnguyen92dn
  • chornerman
  • minhnimble
  • toby-thanathip
  • win-than-htike
  • RkNaing

Poem

🐰 Hoppity hop, let's clean things up,
Dependencies bumped, a perfect cup!
Licenses merged, imports aligned,
Experimental APIs left behind! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the primary changes in the PR: fixing incorrect imports in HomeScreenTest and MockUtil files in the androidTest directory.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@kaungkhantsoe kaungkhantsoe changed the title [606] Fix incorrect imports in homescreentest and mockutil [606] Fix: Incorrect imports in HomeScreenTest and MockUtil in Sample Compose androidTest Mar 10, 2025
@kaungkhantsoe kaungkhantsoe force-pushed the chore/603-update-to-use-material-3-library-instead-of-old-material-library branch from e4bc1db to ce96d87 Compare March 11, 2025 07:20
@kaungkhantsoe kaungkhantsoe force-pushed the bug/606-fix-incorrect-imports-in-homescreentest-and-mockutil branch from 0553ea8 to 55e73e6 Compare March 11, 2025 07:21
@ryan-conway ryan-conway added this to the 3.32.0 milestone Mar 11, 2025
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 11, 2025

10 Warnings
⚠️ Uh oh! Your project is under 80% coverage!
⚠️ template-compose/gradle/libs.versions.toml#L10 - A newer version of androidx.compose:compose-bom than 2025.02.00 is available: 2026.01.00
⚠️ template-compose/gradle/libs.versions.toml#L12 - A newer version of androidx.navigation:navigation-compose than 2.5.3 is available: 2.9.6
⚠️ template-compose/gradle/libs.versions.toml#L13 - A newer version of androidx.core:core-ktx than 1.15.0 is available: 1.17.0
⚠️ template-compose/gradle/libs.versions.toml#L14 - A newer version of androidx.datastore:datastore-preferences than 1.1.3 is available: 1.2.0
⚠️ template-compose/gradle/libs.versions.toml#L17 - A newer version of com.android.application than 8.8.2 is available: 9.0.0
⚠️ template-compose/gradle/libs.versions.toml#L17 - A newer version of com.android.library than 8.8.2 is available: 9.0.0
⚠️ template-compose/gradle/libs.versions.toml#L19 - A newer version of androidx.hilt:hilt-navigation-compose than 1.2.0 is available: 1.3.0
⚠️ template-compose/gradle/libs.versions.toml#L35 - A newer version of androidx.security:security-crypto than 1.0.0 is available: 1.1.0
⚠️ template-compose/gradle/libs.versions.toml#L36 - A newer version of androidx.test:core-ktx than 1.6.1 is available: 1.7.0

Kover report for template-compose:

🧛 Template - Compose Unit Tests Code Coverage: 62.15%

Coverage of Modified Files:

File Coverage

Modified Files Not Found In Coverage Report:

HomeScreenTest.kt
HomeScreenTest.kt
IsFirstTimeLaunchPreferencesUseCaseTest.kt
MockUtil.kt
UpdateFirstTimeLaunchPreferencesUseCaseTest.kt
build.gradle.kts
libs.versions.toml
libs.versions.toml

Codebase cunningly covered by count Shroud 🧛

Generated by 🚫 Danger

@ryan-conway ryan-conway requested a review from Copilot June 6, 2025 02:57
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes incorrect import paths in HomeScreenTest and MockUtil and updates dependency versions/configurations to resolve test failures and ensure proper UI test setup.

  • Corrects import paths for use cases in androidTest.
  • Updates dependency versions including mockk, test rules, and test-compose-ui.
  • Adjusts packaging configuration for merging license files.

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
sample-compose/gradle/libs.versions.toml Upgraded dependency versions and added test-mockk-android and test-compose-ui-manifest entries.
sample-compose/domain/src/test/java/co/nimblehq/sample/compose/domain/usecases/UpdateFirstTimeLaunchPreferencesUseCaseTest.kt Removed unused experimental coroutine and assert imports.
sample-compose/domain/src/test/java/co/nimblehq/sample/compose/domain/usecases/IsFirstTimeLaunchPreferencesUseCaseTest.kt Removed unused experimental coroutine and assert imports.
sample-compose/app/src/test/java/co/nimblehq/sample/compose/ui/screens/main/home/HomeScreenTest.kt Removed redundant testing imports.
sample-compose/app/src/androidTest/java/co/nimblehq/sample/compose/ui/screens/main/home/HomeScreenTest.kt Updated usecase import paths to the correct package.
sample-compose/app/src/androidTest/java/co/nimblehq/sample/compose/test/MockUtil.kt Corrected import path from domain.model.Model to domain.models.Model.
sample-compose/app/build.gradle.kts Modified packaging block and updated testing dependency configurations to align with UI test requirements.

Copy link
Copy Markdown
Collaborator

@ryan-conway ryan-conway left a comment

Choose a reason for hiding this comment

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

The rest LGTM 👍🏻

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

These tests fail to run on my end, not sure if it's an existing issue though 🤔

Copy link
Copy Markdown
Contributor Author

@kaungkhantsoe kaungkhantsoe Oct 22, 2025

Choose a reason for hiding this comment

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

@ryan-conway It passed on my side. Not sure if anyone failed to run 🙏

Screen.Recording.mp4

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Confirmed the test passed on my side

image

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Was it this error?

Execution failed for task ':domain:compileKotlin'.
> Inconsistent JVM-target compatibility detected for tasks 'compileJava' (17) and 'compileKotlin' (21).

I need to set target for kotlin in domain module for the test to run, else it defaults to JVM 21 causing mismatch
Screenshot 2569-01-14 at 10 14 33
Screenshot 2569-01-14 at 10 15 02

Base automatically changed from chore/603-update-to-use-material-3-library-instead-of-old-material-library to develop June 6, 2025 03:41
@ryan-conway ryan-conway temporarily deployed to template-compose June 6, 2025 03:41 — with GitHub Actions Inactive
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Confirmed the test passed on my side

image

Copy link
Copy Markdown

@eeeeaa eeeeaa left a comment

Choose a reason for hiding this comment

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

Test passed, aside from existing comments, LGTM

@hoangnguyen92dn hoangnguyen92dn changed the title [606] Fix: Incorrect imports in HomeScreenTest and MockUtil in Sample Compose androidTest [#606] Fix: Incorrect imports in HomeScreenTest and MockUtil in Sample Compose androidTest Jan 19, 2026
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@sample-compose/gradle/libs.versions.toml`:
- Line 35: Update the testRules version entry in libs.versions.toml: replace the
current testRules = "1.7.0-alpha01" value with the stable release testRules =
"1.7.0" so the project uses androidx.test:rules 1.7.0 instead of the alpha
build.

security = "1.0.0"
testCore = "1.6.1"
testRules = "1.6.1"
testRules = "1.7.0-alpha01"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🌐 Web query:

androidx.test:rules 1.7.0 stable release date

💡 Result:

androidx.test:rules 1.7.0 (stable) was released July 30, 2025. [1][2]

Sources:
[1] Android Developers — Test release notes (Rules 1.7.0).
[2] Android Developers — Recent release notes / All-channel listing.


Update testRules from alpha to stable version.

A stable version of androidx.test:rules 1.7.0 is available (released July 2025). Replace testRules = "1.7.0-alpha01" with testRules = "1.7.0" to use the stable release instead of the alpha version.

🤖 Prompt for AI Agents
In `@sample-compose/gradle/libs.versions.toml` at line 35, Update the testRules
version entry in libs.versions.toml: replace the current testRules =
"1.7.0-alpha01" value with the stable release testRules = "1.7.0" so the project
uses androidx.test:rules 1.7.0 instead of the alpha build.

lifecycle = "2.8.7"
mockk = "1.13.5"
mockk = "1.13.8"
moshi = "1.15.1"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ A newer version of androidx.lifecycle:lifecycle-runtime-compose than 2.8.7 is available: 2.10.0

lifecycle = "2.8.7"
mockk = "1.13.5"
mockk = "1.13.8"
moshi = "1.15.1"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ A newer version of androidx.lifecycle:lifecycle-runtime-ktx than 2.8.7 is available: 2.10.0

@hoangnguyen92dn hoangnguyen92dn merged commit b8a3ed9 into develop Jan 22, 2026
5 of 6 checks passed
@hoangnguyen92dn hoangnguyen92dn deleted the bug/606-fix-incorrect-imports-in-homescreentest-and-mockutil branch January 22, 2026 11:22
@github-actions github-actions bot mentioned this pull request Jan 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants