Skip to content

feat(Android): #8011 Convert disabled Android Unit Tests to Instrumentation Tests #8041

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

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

gosha212
Copy link
Contributor

@gosha212 gosha212 commented Jun 4, 2025

No description provided.

@gosha212 gosha212 requested review from Copilot and d4vidi June 5, 2025 10:25
Copy link

@Copilot 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 migrates previously disabled Android unit tests to instrumentation tests, updates test infrastructure, and configures the Android Gradle setup for instrumented testing.

  • Replaced unit tests with Android instrumentation tests for various components (presenters, controllers, views, attach modes).
  • Added a TestApplication, TestActivity, BaseAndroidTest, mocks, and TestUtils to support instrumentation.
  • Updated build.gradle to specify the instrumentation runner, managed devices, and required androidTest dependencies.

Reviewed Changes

Copilot reviewed 30 out of 30 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
PresenterTest.java Updated @Ignore reason for PresenterTest
TitleSubTitleLayoutTest.kt Added instrumentation tests for TitleSubTitleLayout
ParentControllerTest.java Added instrumentation tests for ParentController
ChildControllersRegistryTest.java Added instrumentation tests for registry behavior
ChildControllerTest.java Added instrumentation tests for ChildController
TogetherTest.kt Added instrumentation test for Together attach mode
OnSwitchToTabTest.kt Added instrumentation test for OnSwitchToTab mode
AttachModeTest.kt Added abstract base class for attach mode tests
AfterInitialTabTest.kt Added instrumentation tests for AfterInitialTab mode
TypefaceLoaderMock.java Added mock for TypefaceLoader
TopBarBackgroundViewCreatorMock.java Added mock for TopBarBackgroundViewCreator
TitleBarReactViewCreatorMock.java Added mock for TitleBarReactViewCreator
TitleBarButtonCreatorMock.java Added mock for TitleBarButtonCreator
SimpleViewController.java Added mock SimpleViewController
TestUtils.java Added shared utilities for tests
TestApplication.kt Added custom TestApplication for instrumentation
TestActivity.kt Added TestActivity for test host
BaseAndroidTest.kt Added base test class required by instrumentation
AndroidManifest.xml Added manifest for instrumentation tests
build.gradle Configured instrumentation runner, managed devices, and androidTest dependencies
Comments suppressed due to low confidence (3)

lib/android/app/src/androidTest/java/com/reactnativenavigation/TestApplication.kt:12

  • Missing import for NavigationApplication; add import com.reactnativenavigation.NavigationApplication to avoid compilation errors.
class TestApplication : NavigationApplication() {

lib/android/app/src/androidTest/java/com/reactnativenavigation/TestActivity.kt:3

  • Missing import for NavigationActivity; add import com.reactnativenavigation.NavigationActivity to avoid compilation errors.
class TestActivity : NavigationActivity()  {

lib/android/app/build.gradle:60

  • [nitpick] Hardcoding a managed device configuration in build.gradle can be brittle; consider extracting this to Gradle properties or CI config for easier maintenance.
pixel3aapi34 {

@@ -25,7 +25,7 @@
import org.junit.Test;
import org.mockito.Mockito;

@Ignore("New architecture - WIP")
@Ignore("New architecture - failed to fix")
Copy link
Preview

Copilot AI Jun 5, 2025

Choose a reason for hiding this comment

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

[nitpick] The ignore message is vague—consider referencing a ticket or adding a TODO to clarify when and how this test should be un-ignored.

Suggested change
@Ignore("New architecture - failed to fix")
@Ignore("New architecture - failed to fix. TODO: Investigate and resolve as per ticket #12345.")

Copilot uses AI. Check for mistakes.

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.

2 participants