Skip to content

Conversation

@JoseAlcerreca
Copy link

No description provided.

# Conflicts:
#	AdaptiveJetStream/jetstream/src/main/res/values/strings.xml
Also fixes some screenshot tests.
Adds the JaCoCo plugin to generate test coverage reports. This change also includes the migration of existing Android instrumented tests to local Robolectric tests.

- Enable unit test coverage in the debug build type.
- Configure the `jacocoTestReport` task to define sources, classes, and execution data for the report.
- Add Robolectric tests for `SearchScreen`, `ShowsScreen`, and `ProfileScreen`.
- Move existing instrumented tests from the `androidTest` directory to the `test` directory, converting them to run with Robolectric.
- Add a `robolectric.properties` file to configure the test environment.
Updates the GitHub Actions workflow to:
- Rename the job to `build-and-test`.
- Upgrade the Java version to 21.
- Add a step to execute unit tests (`testDebugUnitTest`).
The `GradientBg` composable now accepts a seed to ensure that the generated radial gradient is deterministic. This seed is derived from the movie category's ID on the `CategoriesScreen`, making the background gradient for each category consistent across recompositions.

This change also includes an update to the screenshot tests to reflect the new deterministic gradients.
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @JoseAlcerreca, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the testing infrastructure of the AdaptiveJetStream project by introducing comprehensive documentation and configurations for unit, component, and feature tests. It also includes crucial refactoring for improved testability and visual fallback mechanisms for UI elements, alongside a substantial addition of new tests to ensure the stability and correctness of the application.

Highlights

  • Comprehensive Testing Documentation: New documentation has been added for unit, component, and feature testing, including detailed guides for Compose testing, Robolectric setup, and screenshot testing with the Compose Preview Screenshot Testing plugin.
  • Gradle Configuration Updates: The Gradle build files (gradle.properties, libs.versions.toml, build.gradle.kts) have been updated to include new dependencies for testing, increase JVM memory arguments, enable unit test coverage, and configure the screenshot testing plugin and Jacoco for code coverage.
  • Improved Testability and UI Handling: The AssetReader has been refactored into an interface for better testability, and UI components like PosterImage, GradientBg, and carousel backgrounds now display generated linear gradients when movie poster URIs are empty, enhancing visual consistency.
  • Extensive Unit and Component Tests: A large suite of new unit and component tests has been introduced across various data sources (e.g., MovieCastDataSource, MovieDataSource) and UI screens (e.g., HomeScreen, MovieDetailsScreen, SearchScreen), significantly increasing test coverage.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Ignored Files
  • Ignored by pattern: .github/workflows/** (1)
    • .github/workflows/adaptive-jetstream-build.yml
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces comprehensive documentation for various testing types (unit, component, feature, screenshot) in an Android Compose application, along with significant updates to the build configuration and codebase to support these testing strategies. Key changes include adding new Gradle dependencies for testing frameworks like JUnit, Kotlin Coroutines Test, Robolectric, and the Compose Screenshot Testing plugin. The gradle.properties file was updated to increase JVM memory and enable experimental screenshot testing. The project's Kotlin JVM toolchain was upgraded from version 17 to 21, and Jacoco code coverage reporting was configured. The codebase was refactored to introduce an AssetReader interface for better testability, and several UI components were modified to use this interface and to generate gradient placeholders when image URIs are empty. Additionally, the visibility of several Composable functions was changed from private to internal to facilitate testing, and new screenshot test files were added for various components and screens. Review comments highlighted copy-paste errors in the compose-testing.md.txt file where GitHub URLs were incorrectly embedded within code blocks, and identified a duplicate test file (CategoryMovieListScreenTest.kt) that should be removed to maintain a clean test suite. A missing newline character at the end of screenshot-testing.md.txt was also noted.

JoseAlcerreca and others added 5 commits December 18, 2025 17:29
Adds a screenshot testing and update process to the CI workflow.

The new steps will:
- Run screenshot verification tests.
- If tests fail on a fork, the workflow will fail with an error, instructing the user to create a PR on their fork first.
- If tests fail on a PR within the main repository, it will automatically generate new screenshots.
- Commit and push the newly generated screenshots back to the PR branch.
- Deleted the `CategoryMovieListScreenRobolectricTest` as it is no longer required.
- Cleaned up testing documentation by removing invalid URLs.
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

Successfully merging this pull request may close these issues.

1 participant