mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-17 11:25:34 -04:00
re-enable multidex, add ktx libraries and fix some compile errors in Instrumentation tests
This commit is contained in:
parent
3cb357f9bd
commit
22e5d3226e
@ -60,7 +60,11 @@ dependencies {
|
||||
implementation "androidx.appcompat:appcompat:$appCompatVersion"
|
||||
implementation "com.google.android.material:material:$materialVersion"
|
||||
implementation "androidx.cardview:cardview:$cardViewVersion"
|
||||
implementation "androidx.multidex:multidex:$multidexVersion"
|
||||
implementation "androidx.constraintlayout:constraintlayout:$constraintLayoutVersion"
|
||||
implementation "androidx.core:core-ktx:1.0.2"
|
||||
implementation "androidx.fragment:fragment-ktx:1.0.0"
|
||||
implementation "androidx.collection:collection-ktx:1.0.0"
|
||||
|
||||
implementation "androidx.test.espresso:espresso-idling-resource:$espressoVersion"
|
||||
androidTestImplementation("androidx.test.espresso:espresso-core:$espressoVersion")
|
||||
@ -216,6 +220,8 @@ android {
|
||||
buildConfigField "String", "KIWIX_DOWNLOAD_URL", "\"http://download.kiwix.org/\""
|
||||
// True breaks local variables being shown in breakpoints
|
||||
testCoverageEnabled false
|
||||
// Needed for instrumentation tests on Pre 5.0
|
||||
multiDexKeepProguard file("multidex-instrumentation-config.pro")
|
||||
}
|
||||
|
||||
mock_network {
|
||||
|
@ -17,6 +17,8 @@
|
||||
*/
|
||||
package org.kiwix.kiwixmobile.di.components;
|
||||
|
||||
import android.content.Context;
|
||||
import dagger.BindsInstance;
|
||||
import dagger.Component;
|
||||
import javax.inject.Singleton;
|
||||
import org.kiwix.kiwixmobile.data.DataModule;
|
||||
@ -40,6 +42,14 @@ import org.kiwix.kiwixmobile.utils.TestNetworkInterceptor;
|
||||
})
|
||||
public interface TestComponent extends ApplicationComponent {
|
||||
|
||||
@Component.Builder
|
||||
interface Builder {
|
||||
|
||||
@BindsInstance TestComponent.Builder context(Context context);
|
||||
|
||||
TestComponent build();
|
||||
}
|
||||
|
||||
void inject(ZimTest zimTest);
|
||||
|
||||
void inject(NetworkTest networkTest);
|
||||
|
@ -109,7 +109,7 @@ public class LanguageActivityTest {
|
||||
childAtPosition(withId(R.id.toolbar_layout), 0)), 1), isDisplayed()));
|
||||
|
||||
// Make sure that the zim list has been loaded
|
||||
IdlingRegistry.getInstance().register(LibraryFragment.IDLING_RESOURCE);
|
||||
//IdlingRegistry.getInstance().register(LibraryFragment.IDLING_RESOURCE);
|
||||
onView(allOf(isDisplayed(), withText("Selected languages:"))).check(matches(notNullValue()));
|
||||
|
||||
// Open the Language Activity
|
||||
@ -274,7 +274,7 @@ public class LanguageActivityTest {
|
||||
|
||||
@After
|
||||
public void endTest() {
|
||||
IdlingRegistry.getInstance().unregister(LibraryFragment.IDLING_RESOURCE);
|
||||
//IdlingRegistry.getInstance().unregister(LibraryFragment.IDLING_RESOURCE);
|
||||
Intents.release();
|
||||
}
|
||||
}
|
||||
|
@ -96,12 +96,6 @@ public class DownloadTest {
|
||||
|
||||
clickOn(R.string.remote_zims);
|
||||
|
||||
try {
|
||||
clickOn(R.id.network_permission_button);
|
||||
} catch (RuntimeException e) {
|
||||
Log.d(KIWIX_DOWNLOAD_TEST, "Failed to click Network Permission Button", e);
|
||||
}
|
||||
|
||||
captureAndSaveScreenshot("Before-checking-for-ZimManager-Main-Activity");
|
||||
ViewInteraction viewPager2 = onView(
|
||||
allOf(withId(R.id.manageViewPager),
|
||||
|
@ -127,13 +127,6 @@ public class NetworkTest {
|
||||
|
||||
TestUtils.allowPermissionsIfNeeded();
|
||||
|
||||
try {
|
||||
onView(withId(R.id.network_permission_button)).perform(click());
|
||||
} catch (RuntimeException e) {
|
||||
Log.i(NETWORK_TEST_TAG,
|
||||
"Permission dialog was not shown, we probably already have required permissions");
|
||||
}
|
||||
|
||||
onData(withContent("wikipedia_ab_all_2017-03")).inAdapterView(withId(R.id.libraryList)).perform(click());
|
||||
|
||||
try {
|
||||
|
Loading…
x
Reference in New Issue
Block a user