android / android-test

An extensive framework for testing Android apps
https://android.github.io/android-test
Apache License 2.0
1.16k stars 314 forks source link

FragmentScenarioEmptyFragmentActivityTheme unresolved with fragment-testing version equal or above 1.6.0-alpha04 #1938

Closed iolandarosa7 closed 10 months ago

iolandarosa7 commented 1 year ago

Description

I have a project where I am using an hilt extension to do instrumented testing on my fragments. I am currently using version 1.5.7 from fragment-testing library and everything works fine, but when I try to upgrade to a version equal or bigger than 1.6.0-alpha04 the tests can no longer run.

They fail with the exceptions: Unresolved reference: style

Unresolved reference: FragmentScenarioEmptyFragmentActivityTheme

These are the dependencies declared on my grade file: `dependencies { implementation 'androidx.legacy:legacy-support-v4:1.0.0' implementation 'androidx.test.espresso:espresso-idling-resource:3.5.1' coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.3'

implementation "org.jetbrains.kotlin:kotlin-stdlib:1.9.0"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.9.0"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.9.0"

implementation 'androidx.core:core-ktx:1.10.1'
implementation "androidx.appcompat:appcompat:1.6.1"

implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
testImplementation 'junit:junit:4.13.2'
testImplementation 'org.mockito:mockito-core:5.5.0'
testImplementation 'org.mockito:mockito-inline:5.2.0'
testImplementation "com.nhaarman.mockitokotlin2:mockito-kotlin:2.2.0"
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation "androidx.test:runner:1.5.2"
androidTestImplementation "androidx.test:rules:1.5.0"

implementation "androidx.annotation:annotation:1.7.0"

implementation "androidx.activity:activity-ktx:1.7.2"

implementation "androidx.appcompat:appcompat:1.6.1"
implementation "androidx.appcompat:appcompat-resources:1.6.1"

implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3"

implementation "androidx.fragment:fragment-ktx:1.6.1"
debugImplementation "androidx.fragment:fragment-testing:1.6.1"

implementation "androidx.test:core:1.5.0"

implementation "com.google.dagger:hilt-android:2.48"
kapt "com.google.dagger:hilt-compiler:2.48"

androidTestImplementation "com.google.dagger:hilt-android-testing:2.48"
kaptAndroidTest "com.google.dagger:hilt-compiler:2.48"

implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.2"
implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.6.2"

implementation "androidx.navigation:navigation-fragment-ktx:2.5.3"
implementation "androidx.navigation:navigation-ui-ktx:2.5.3"

// For InstantTaskExecutorRule
testImplementation "androidx.arch.core:core-testing:2.2.0"

// Test Coroutines
testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:1.7.3"

// Mockk
androidTestImplementation "io.mockk:mockk-android:1.13.3"
testImplementation "io.mockk:mockk-android:1.13.3"
testImplementation "io.mockk:mockk-agent:1.13.3"

// Espresso
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
androidTestImplementation "androidx.test.espresso:espresso-contrib:3.5.1"
androidTestImplementation "androidx.test.espresso:espresso-intents:3.5.1"

}`

Expected Results

Being able to upgrade fragment library to latest stable version (1.6.1) and still use hilt to do instrumented tests.

Actual Results

Only works until version 1.6.0-alpha03

iolandarosa7 commented 10 months ago

This is working after latest update.