mirror of
https://github.com/hmalik144/EasyCC_Master.git
synced 2026-03-18 07:26:16 +00:00
upgraded dependencies to be compatible with android_33
This commit is contained in:
6
.idea/gradle.xml
generated
6
.idea/gradle.xml
generated
@@ -4,17 +4,15 @@
|
|||||||
<component name="GradleSettings">
|
<component name="GradleSettings">
|
||||||
<option name="linkedExternalProjectsSettings">
|
<option name="linkedExternalProjectsSettings">
|
||||||
<GradleProjectSettings>
|
<GradleProjectSettings>
|
||||||
<option name="delegatedBuild" value="false" />
|
<option name="testRunner" value="CHOOSE_PER_TEST" />
|
||||||
<option name="testRunner" value="PLATFORM" />
|
|
||||||
<option name="distributionType" value="DEFAULT_WRAPPED" />
|
|
||||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||||
|
<option name="gradleJvm" value="jbr-17" />
|
||||||
<option name="modules">
|
<option name="modules">
|
||||||
<set>
|
<set>
|
||||||
<option value="$PROJECT_DIR$" />
|
<option value="$PROJECT_DIR$" />
|
||||||
<option value="$PROJECT_DIR$/app" />
|
<option value="$PROJECT_DIR$/app" />
|
||||||
</set>
|
</set>
|
||||||
</option>
|
</option>
|
||||||
<option name="resolveModulePerSourceSet" value="false" />
|
|
||||||
</GradleProjectSettings>
|
</GradleProjectSettings>
|
||||||
</option>
|
</option>
|
||||||
</component>
|
</component>
|
||||||
|
|||||||
12
.idea/misc.xml
generated
12
.idea/misc.xml
generated
@@ -5,7 +5,7 @@
|
|||||||
<option name="myDefaultNotNull" value="android.support.annotation.NonNull" />
|
<option name="myDefaultNotNull" value="android.support.annotation.NonNull" />
|
||||||
<option name="myNullables">
|
<option name="myNullables">
|
||||||
<value>
|
<value>
|
||||||
<list size="12">
|
<list size="15">
|
||||||
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" />
|
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" />
|
||||||
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" />
|
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" />
|
||||||
<item index="2" class="java.lang.String" itemvalue="javax.annotation.CheckForNull" />
|
<item index="2" class="java.lang.String" itemvalue="javax.annotation.CheckForNull" />
|
||||||
@@ -18,12 +18,15 @@
|
|||||||
<item index="9" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NullableType" />
|
<item index="9" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NullableType" />
|
||||||
<item index="10" class="java.lang.String" itemvalue="android.annotation.Nullable" />
|
<item index="10" class="java.lang.String" itemvalue="android.annotation.Nullable" />
|
||||||
<item index="11" class="java.lang.String" itemvalue="com.android.annotations.Nullable" />
|
<item index="11" class="java.lang.String" itemvalue="com.android.annotations.Nullable" />
|
||||||
|
<item index="12" class="java.lang.String" itemvalue="org.jspecify.annotations.Nullable" />
|
||||||
|
<item index="13" class="java.lang.String" itemvalue="org.eclipse.jdt.annotation.Nullable" />
|
||||||
|
<item index="14" class="java.lang.String" itemvalue="jakarta.annotation.Nullable" />
|
||||||
</list>
|
</list>
|
||||||
</value>
|
</value>
|
||||||
</option>
|
</option>
|
||||||
<option name="myNotNulls">
|
<option name="myNotNulls">
|
||||||
<value>
|
<value>
|
||||||
<list size="11">
|
<list size="14">
|
||||||
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" />
|
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" />
|
||||||
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" />
|
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" />
|
||||||
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" />
|
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" />
|
||||||
@@ -35,11 +38,14 @@
|
|||||||
<item index="8" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NonNullType" />
|
<item index="8" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NonNullType" />
|
||||||
<item index="9" class="java.lang.String" itemvalue="android.annotation.NonNull" />
|
<item index="9" class="java.lang.String" itemvalue="android.annotation.NonNull" />
|
||||||
<item index="10" class="java.lang.String" itemvalue="com.android.annotations.NonNull" />
|
<item index="10" class="java.lang.String" itemvalue="com.android.annotations.NonNull" />
|
||||||
|
<item index="11" class="java.lang.String" itemvalue="org.jspecify.annotations.NonNull" />
|
||||||
|
<item index="12" class="java.lang.String" itemvalue="jakarta.annotation.Nonnull" />
|
||||||
|
<item index="13" class="java.lang.String" itemvalue="org.eclipse.jdt.annotation.NonNull" />
|
||||||
</list>
|
</list>
|
||||||
</value>
|
</value>
|
||||||
</option>
|
</option>
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="jbr-17" project-jdk-type="JavaSDK">
|
||||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectType">
|
<component name="ProjectType">
|
||||||
|
|||||||
9
.idea/modules.xml
generated
9
.idea/modules.xml
generated
@@ -1,9 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="ProjectModuleManager">
|
|
||||||
<modules>
|
|
||||||
<module fileurl="file://$PROJECT_DIR$/.idea/modules/EasyCC.iml" filepath="$PROJECT_DIR$/.idea/modules/EasyCC.iml" group="EasyCC" />
|
|
||||||
<module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" group="EasyCC/app" />
|
|
||||||
</modules>
|
|
||||||
</component>
|
|
||||||
</project>
|
|
||||||
8
.idea/runConfigurations.xml
generated
8
.idea/runConfigurations.xml
generated
@@ -3,6 +3,14 @@
|
|||||||
<component name="RunConfigurationProducerService">
|
<component name="RunConfigurationProducerService">
|
||||||
<option name="ignoredProducers">
|
<option name="ignoredProducers">
|
||||||
<set>
|
<set>
|
||||||
|
<option value="com.intellij.execution.junit.AbstractAllInDirectoryConfigurationProducer" />
|
||||||
|
<option value="com.intellij.execution.junit.AllInPackageConfigurationProducer" />
|
||||||
|
<option value="com.intellij.execution.junit.PatternConfigurationProducer" />
|
||||||
|
<option value="com.intellij.execution.junit.TestInClassConfigurationProducer" />
|
||||||
|
<option value="com.intellij.execution.junit.UniqueIdConfigurationProducer" />
|
||||||
|
<option value="com.intellij.execution.junit.testDiscovery.JUnitTestDiscoveryConfigurationProducer" />
|
||||||
|
<option value="org.jetbrains.kotlin.idea.junit.KotlinJUnitRunConfigurationProducer" />
|
||||||
|
<option value="org.jetbrains.kotlin.idea.junit.KotlinPatternConfigurationProducer" />
|
||||||
<option value="org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer" />
|
<option value="org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer" />
|
||||||
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer" />
|
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer" />
|
||||||
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer" />
|
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer" />
|
||||||
|
|||||||
@@ -5,81 +5,105 @@ plugins {
|
|||||||
id 'kotlin-kapt'
|
id 'kotlin-kapt'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Properties properties = new Properties()
|
||||||
|
boolean propertiesFileExists = project.rootProject.file('local.properties').canRead()
|
||||||
|
if (propertiesFileExists) properties.load(project.rootProject.file('local.properties').newDataInputStream())
|
||||||
|
|
||||||
|
def keystoreFile = project.rootProject.file("app/keystore.jks")
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 32
|
compileSdk = Integer.parseInt(TARGET_SDK_VERSION)
|
||||||
|
namespace "com.appttude.h_mal.easycc"
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "com.appttude.h_mal.easycc"
|
applicationId "com.appttude.h_mal.easycc"
|
||||||
minSdkVersion 21
|
minSdkVersion MIN_SDK_VERSION
|
||||||
targetSdkVersion 32
|
targetSdkVersion TARGET_SDK_VERSION
|
||||||
versionCode 5
|
versionCode 5
|
||||||
versionName "4.1"
|
versionName "4.1"
|
||||||
|
|
||||||
testInstrumentationRunner "com.appttude.h_mal.easycc.application.TestRunner"
|
testInstrumentationRunner "com.appttude.h_mal.easycc.application.TestRunner"
|
||||||
}
|
}
|
||||||
|
signingConfigs {
|
||||||
|
release {
|
||||||
|
storePassword System.getProperty("RELEASE_STORE_PASSWORD") ?: properties.getProperty('RELEASE_STORE_PASSWORD')
|
||||||
|
keyPassword System.getProperty("RELEASE_KEY_PASSWORD") ?: properties.getProperty('RELEASE_KEY_PASSWORD')
|
||||||
|
keyAlias System.getProperty("RELEASE_KEY_ALIAS") ?: properties.getProperty('RELEASE_KEY_ALIAS')
|
||||||
|
storeFile keystoreFile.exists() ? keystoreFile : null
|
||||||
|
}
|
||||||
|
}
|
||||||
buildTypes {
|
buildTypes {
|
||||||
release {
|
release {
|
||||||
minifyEnabled false
|
minifyEnabled false
|
||||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
staging {
|
||||||
|
initWith debug
|
||||||
|
manifestPlaceholders = [hostName:"internal.example.com"]
|
||||||
|
applicationIdSuffix ".debugStaging"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
compileOptions {
|
compileOptions {
|
||||||
sourceCompatibility JavaVersion.VERSION_1_8
|
sourceCompatibility JavaVersion.VERSION_17
|
||||||
targetCompatibility JavaVersion.VERSION_1_8
|
targetCompatibility JavaVersion.VERSION_17
|
||||||
}
|
}
|
||||||
kotlinOptions {
|
kotlinOptions {
|
||||||
jvmTarget = '1.8'
|
jvmTarget = '17'
|
||||||
}
|
}
|
||||||
buildFeatures {
|
buildFeatures {
|
||||||
viewBinding true
|
viewBinding true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// java {
|
||||||
|
// toolchain {
|
||||||
|
// languageVersion.set(JavaLanguageVersion.of(21))
|
||||||
|
// }
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation 'androidx.core:core-ktx:1.8.0'
|
implementation "androidx.core:core-ktx:$ANDROID_CORE_VERSION"
|
||||||
implementation 'androidx.appcompat:appcompat:1.4.2'
|
implementation "androidx.appcompat:appcompat:$APP_COMPAT"
|
||||||
implementation 'com.google.android.material:material:1.6.1'
|
implementation "androidx.annotation:annotation:$ANNOTATION_VERSION"
|
||||||
implementation 'androidx.annotation:annotation:1.4.0'
|
implementation "androidx.constraintlayout:constraintlayout:$CONSTR_LAYOUT_VERSION"
|
||||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
implementation "androidx.lifecycle:lifecycle-livedata-ktx:$ANDROID_LIFECYCLE"
|
||||||
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.5.1'
|
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$ANDROID_LIFECYCLE"
|
||||||
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1'
|
implementation "androidx.activity:activity-ktx:$ACTIVITY_VERSION"
|
||||||
implementation 'androidx.activity:activity-ktx:1.5.1'
|
testImplementation "junit:junit:$JUNIT_VERSION"
|
||||||
testImplementation 'junit:junit:4.13.2'
|
androidTestImplementation "androidx.test.ext:junit:$TEST_JUNIT_VERSION"
|
||||||
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
|
androidTestImplementation "androidx.test.espresso:espresso-core:$ESPRESSO_VERSION"
|
||||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
|
androidTestImplementation "androidx.test:rules:$TEST_RULE"
|
||||||
androidTestImplementation 'androidx.test:rules:1.4.0'
|
implementation "androidx.tracing:tracing:1.1.0"
|
||||||
implementation 'org.jetbrains.kotlin:kotlin-test:1.7.10'
|
implementation "org.jetbrains.kotlin:kotlin-test:$KOTLIN_VERSION"
|
||||||
|
|
||||||
// Coroutines
|
// Coroutines
|
||||||
def coroutines_version = "1.6.2"
|
testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:$KOTLINX_COROUTINES"
|
||||||
testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutines_version"
|
|
||||||
|
|
||||||
//Retrofit and GSON
|
//Retrofit and GSON
|
||||||
def retrofit_ver = "2.8.1"
|
implementation "com.squareup.retrofit2:retrofit:$RETROFIT_VERSION"
|
||||||
implementation "com.squareup.retrofit2:retrofit:$retrofit_ver"
|
implementation "com.squareup.retrofit2:converter-gson:$RETROFIT_VERSION"
|
||||||
implementation "com.squareup.retrofit2:converter-gson:$retrofit_ver"
|
implementation "com.squareup.okhttp3:logging-interceptor:$OKHTTP_VERSION"
|
||||||
implementation "com.squareup.okhttp3:logging-interceptor:4.9.0"
|
|
||||||
|
|
||||||
// ViewModel and LiveData
|
// ViewModel and LiveData
|
||||||
implementation "androidx.lifecycle:lifecycle-extensions:2.2.0"
|
implementation "androidx.lifecycle:lifecycle-extensions:$LIFECYCLE_EXTENSION"
|
||||||
|
|
||||||
//New Material Design
|
//New Material Design
|
||||||
implementation 'com.google.android.material:material:1.6.1'
|
implementation "com.google.android.material:material:$MATERIAL_VERSION"
|
||||||
|
|
||||||
// Hilt dependency injection
|
// Hilt dependency injection
|
||||||
def hilt_ver = "2.43.2"
|
implementation "com.google.dagger:hilt-android:$HILT_VERSION"
|
||||||
implementation "com.google.dagger:hilt-android:$hilt_ver"
|
kapt "com.google.dagger:hilt-compiler:$HILT_VERSION"
|
||||||
kapt "com.google.dagger:hilt-compiler:$hilt_ver"
|
androidTestImplementation "com.google.dagger:hilt-android-testing:$HILT_VERSION"
|
||||||
androidTestImplementation "com.google.dagger:hilt-android-testing:$hilt_ver"
|
kaptAndroidTest "com.google.dagger:hilt-android-compiler:$HILT_VERSION"
|
||||||
kaptAndroidTest "com.google.dagger:hilt-android-compiler:$hilt_ver"
|
|
||||||
|
|
||||||
//mockito and livedata testing
|
//mockito and livedata testing
|
||||||
testImplementation 'org.mockito:mockito-inline:2.13.0'
|
testImplementation "org.mockito:mockito-core:$MOKITO_CORE_VERSION"
|
||||||
testImplementation 'androidx.arch.core:core-testing:2.1.0'
|
testImplementation "androidx.arch.core:core-testing:$CORE_TEST_VERSION"
|
||||||
|
|
||||||
implementation "androidx.preference:preference-ktx:1.2.0"
|
implementation "androidx.preference:preference-ktx:$PREFERENCES_VERSION"
|
||||||
|
|
||||||
//mock websever for testing retrofit responses
|
//mock websever for testing retrofit responses
|
||||||
testImplementation "com.squareup.okhttp3:mockwebserver:4.6.0"
|
testImplementation "com.squareup.okhttp3:mockwebserver:4.9.0"
|
||||||
testImplementation "com.nhaarman.mockitokotlin2:mockito-kotlin:2.2.0"
|
testImplementation "com.nhaarman.mockitokotlin2:mockito-kotlin:2.2.0"
|
||||||
implementation "org.jetbrains.kotlin:kotlin-test:1.7.10"
|
implementation "org.jetbrains.kotlin:kotlin-test:1.9.20"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,42 +4,20 @@ import com.appttude.h_mal.easycc.application.TestRunner.Companion.idlingResource
|
|||||||
import com.appttude.h_mal.easycc.data.network.response.CurrencyResponse
|
import com.appttude.h_mal.easycc.data.network.response.CurrencyResponse
|
||||||
import com.appttude.h_mal.easycc.data.network.response.ResponseObject
|
import com.appttude.h_mal.easycc.data.network.response.ResponseObject
|
||||||
import com.appttude.h_mal.easycc.data.repository.Repository
|
import com.appttude.h_mal.easycc.data.repository.Repository
|
||||||
|
import com.appttude.h_mal.easycc.models.CurrencyModel
|
||||||
import com.appttude.h_mal.easycc.models.CurrencyObject
|
import com.appttude.h_mal.easycc.models.CurrencyObject
|
||||||
import kotlinx.coroutines.delay
|
import kotlinx.coroutines.delay
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class MockRepository @Inject constructor() : Repository {
|
class MockRepository @Inject constructor() : Repository {
|
||||||
|
|
||||||
override suspend fun getDataFromApi(fromCurrency: String, toCurrency: String): ResponseObject {
|
override suspend fun getDataFromApi(fromCurrency: String, toCurrency: String): CurrencyModel {
|
||||||
idlingResources.increment()
|
idlingResources.increment()
|
||||||
delay(500)
|
delay(500)
|
||||||
return ResponseObject(
|
return CurrencyModel(
|
||||||
results = mapOf(
|
from = "AUD",
|
||||||
Pair(
|
to = "GBP",
|
||||||
"AUD_GBP", CurrencyObject(
|
rate = 0.546181
|
||||||
id = "AUD_GBP",
|
|
||||||
fr = "AUD",
|
|
||||||
to = "GBP",
|
|
||||||
value = 0.546181
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
).also {
|
|
||||||
idlingResources.decrement()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override suspend fun getBackupDataFromApi(
|
|
||||||
fromCurrency: String,
|
|
||||||
toCurrency: String
|
|
||||||
): CurrencyResponse {
|
|
||||||
idlingResources.increment()
|
|
||||||
delay(500)
|
|
||||||
return CurrencyResponse(
|
|
||||||
rates = mapOf(Pair("GBP", 0.54638)),
|
|
||||||
amount = 1.0,
|
|
||||||
base = "AUD",
|
|
||||||
date = "2021-06-11"
|
|
||||||
).also {
|
).also {
|
||||||
idlingResources.decrement()
|
idlingResources.decrement()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,87 @@
|
|||||||
|
package com.appttude.h_mal.easycc.helper
|
||||||
|
|
||||||
|
import android.view.View
|
||||||
|
import androidx.test.espresso.Espresso.onView
|
||||||
|
import androidx.test.espresso.NoMatchingViewException
|
||||||
|
import androidx.test.espresso.UiController
|
||||||
|
import androidx.test.espresso.ViewAction
|
||||||
|
import androidx.test.espresso.ViewInteraction
|
||||||
|
import androidx.test.espresso.matcher.ViewMatchers.isRoot
|
||||||
|
import androidx.test.espresso.util.TreeIterables
|
||||||
|
import org.hamcrest.Matcher
|
||||||
|
import java.lang.Thread.sleep
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Perform action of implicitly waiting for a certain view.
|
||||||
|
* This differs from EspressoExtensions.searchFor in that,
|
||||||
|
* upon failure to locate an element, it will fetch a new root view
|
||||||
|
* in which to traverse searching for our @param match
|
||||||
|
*
|
||||||
|
* @param viewMatcher ViewMatcher used to find our view
|
||||||
|
*/
|
||||||
|
fun waitForView(
|
||||||
|
viewMatcher: Matcher<View>,
|
||||||
|
waitMillis: Int = 5000,
|
||||||
|
waitMillisPerTry: Long = 100
|
||||||
|
): ViewInteraction {
|
||||||
|
|
||||||
|
// Derive the max tries
|
||||||
|
val maxTries = waitMillis / waitMillisPerTry.toInt()
|
||||||
|
|
||||||
|
var tries = 0
|
||||||
|
|
||||||
|
for (i in 0..maxTries)
|
||||||
|
try {
|
||||||
|
// Track the amount of times we've tried
|
||||||
|
tries++
|
||||||
|
|
||||||
|
// Search the root for the view
|
||||||
|
onView(isRoot()).perform(searchFor(viewMatcher))
|
||||||
|
|
||||||
|
// If we're here, we found our view. Now return it
|
||||||
|
return onView(viewMatcher)
|
||||||
|
|
||||||
|
} catch (e: Exception) {
|
||||||
|
|
||||||
|
if (tries == maxTries) {
|
||||||
|
throw e
|
||||||
|
}
|
||||||
|
sleep(waitMillisPerTry)
|
||||||
|
}
|
||||||
|
|
||||||
|
throw Exception("Error finding a view matching $viewMatcher")
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Perform action of waiting for a certain view within a single root view
|
||||||
|
* @param viewMatcher Generic Matcher used to find our view
|
||||||
|
*/
|
||||||
|
fun searchFor(viewMatcher: Matcher<View>): ViewAction {
|
||||||
|
|
||||||
|
return object : ViewAction {
|
||||||
|
|
||||||
|
override fun getConstraints(): Matcher<View> = isRoot()
|
||||||
|
override fun getDescription(): String {
|
||||||
|
return "searching for view $this in the root view"
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun perform(uiController: UiController, view: View) {
|
||||||
|
var tries = 0
|
||||||
|
val childViews: Iterable<View> = TreeIterables.breadthFirstViewTraversal(view)
|
||||||
|
|
||||||
|
// Look for the match in the tree of child views
|
||||||
|
childViews.forEach {
|
||||||
|
tries++
|
||||||
|
if (viewMatcher.matches(it)) {
|
||||||
|
// found the view
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
throw NoMatchingViewException.Builder()
|
||||||
|
.withRootView(view)
|
||||||
|
.withViewMatcher(viewMatcher)
|
||||||
|
.build()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6,7 +6,9 @@ import androidx.test.espresso.Espresso
|
|||||||
import androidx.test.espresso.action.ViewActions
|
import androidx.test.espresso.action.ViewActions
|
||||||
import androidx.test.espresso.assertion.ViewAssertions
|
import androidx.test.espresso.assertion.ViewAssertions
|
||||||
import androidx.test.espresso.matcher.ViewMatchers
|
import androidx.test.espresso.matcher.ViewMatchers
|
||||||
|
import androidx.test.espresso.matcher.ViewMatchers.withId
|
||||||
import com.appttude.h_mal.easycc.R
|
import com.appttude.h_mal.easycc.R
|
||||||
|
import com.appttude.h_mal.easycc.helper.waitForView
|
||||||
import org.hamcrest.Description
|
import org.hamcrest.Description
|
||||||
import org.hamcrest.Matcher
|
import org.hamcrest.Matcher
|
||||||
import org.hamcrest.Matchers
|
import org.hamcrest.Matchers
|
||||||
@@ -18,48 +20,48 @@ fun currencyRobot(func: CurrencyRobot.() -> Unit) = CurrencyRobot()
|
|||||||
class CurrencyRobot {
|
class CurrencyRobot {
|
||||||
|
|
||||||
fun clickOnTopList() {
|
fun clickOnTopList() {
|
||||||
Espresso.onView(ViewMatchers.withId(R.id.currencyOne)).perform(ViewActions.click())
|
waitForView(withId(R.id.currencyOne)).perform(ViewActions.click())
|
||||||
}
|
}
|
||||||
|
|
||||||
fun clickOnBottomList() {
|
fun clickOnBottomList() {
|
||||||
Espresso.onView(ViewMatchers.withId(R.id.currencyTwo)).perform(ViewActions.click())
|
waitForView(withId(R.id.currencyTwo)).perform(ViewActions.click())
|
||||||
}
|
}
|
||||||
|
|
||||||
fun searchInCurrencyList(search: String) {
|
fun searchInCurrencyList(search: String) {
|
||||||
Espresso.onView(ViewMatchers.withId(R.id.search_text))
|
waitForView(withId(R.id.search_text))
|
||||||
.perform(ViewActions.replaceText(search), ViewActions.closeSoftKeyboard())
|
.perform(ViewActions.replaceText(search), ViewActions.closeSoftKeyboard())
|
||||||
}
|
}
|
||||||
|
|
||||||
fun enterValueInTopEditText(text: String) {
|
fun enterValueInTopEditText(text: String) {
|
||||||
Espresso.onView(ViewMatchers.withId(R.id.topInsertValue))
|
waitForView(withId(R.id.topInsertValue))
|
||||||
.perform(ViewActions.replaceText(text), ViewActions.closeSoftKeyboard())
|
.perform(ViewActions.replaceText(text), ViewActions.closeSoftKeyboard())
|
||||||
}
|
}
|
||||||
|
|
||||||
fun selectItemInCurrencyList() {
|
fun selectItemInCurrencyList() {
|
||||||
Espresso.onData(Matchers.anything())
|
val viewMatcher = Matchers.allOf(
|
||||||
.inAdapterView(
|
withId(R.id.list_view),
|
||||||
Matchers.allOf(
|
childAtPosition(
|
||||||
ViewMatchers.withId(R.id.list_view),
|
ViewMatchers.withClassName(Matchers.`is`("androidx.cardview.widget.CardView")),
|
||||||
childAtPosition(
|
0
|
||||||
ViewMatchers.withClassName(Matchers.`is`("androidx.cardview.widget.CardView")),
|
|
||||||
0
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
)
|
||||||
|
waitForView(viewMatcher)
|
||||||
|
Espresso.onData(Matchers.anything())
|
||||||
|
.inAdapterView(viewMatcher)
|
||||||
.atPosition(0)
|
.atPosition(0)
|
||||||
.perform(ViewActions.click())
|
.perform(ViewActions.click())
|
||||||
}
|
}
|
||||||
|
|
||||||
fun assertTextInTop(text: String) {
|
fun assertTextInTop(text: String) {
|
||||||
Espresso.onView(
|
Espresso.onView(
|
||||||
ViewMatchers.withId(R.id.topInsertValue)
|
withId(R.id.topInsertValue)
|
||||||
|
|
||||||
).check(ViewAssertions.matches(ViewMatchers.withText(text)))
|
).check(ViewAssertions.matches(ViewMatchers.withText(text)))
|
||||||
}
|
}
|
||||||
|
|
||||||
fun assertTextInBottom(text: String) {
|
fun assertTextInBottom(text: String) {
|
||||||
Espresso.onView(
|
waitForView(
|
||||||
ViewMatchers.withId(R.id.bottomInsertValues)
|
withId(R.id.bottomInsertValues)
|
||||||
|
|
||||||
).check(ViewAssertions.matches(ViewMatchers.withText(text)))
|
).check(ViewAssertions.matches(ViewMatchers.withText(text)))
|
||||||
}
|
}
|
||||||
|
|||||||
15
build.gradle
15
build.gradle
@@ -1,9 +1,14 @@
|
|||||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
buildscript {
|
||||||
|
ext {
|
||||||
|
agp_version = '8.1.0'
|
||||||
|
}
|
||||||
|
}// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||||
plugins {
|
plugins {
|
||||||
id 'com.android.application' version '7.2.2' apply false
|
id 'com.android.application' version "$GRADLE_PLUGIN_VERSION" apply false
|
||||||
id 'com.android.library' version '7.2.2' apply false
|
id 'com.android.library' version "$GRADLE_PLUGIN_VERSION" apply false
|
||||||
id 'org.jetbrains.kotlin.android' version '1.7.10' apply false
|
id 'org.jetbrains.kotlin.android' version "$KOTLIN_VERSION" apply false
|
||||||
id 'com.google.dagger.hilt.android' version '2.43.2' apply false
|
id 'com.google.dagger.hilt.android' version "$HILT_VERSION" apply false
|
||||||
|
id 'com.autonomousapps.dependency-analysis' version "$GRADLE_ANALYZE_VERSION"
|
||||||
}
|
}
|
||||||
|
|
||||||
task clean(type: Delete) {
|
task clean(type: Delete) {
|
||||||
|
|||||||
@@ -6,12 +6,67 @@
|
|||||||
# http://www.gradle.org/docs/current/userguide/build_environment.html
|
# http://www.gradle.org/docs/current/userguide/build_environment.html
|
||||||
# Specifies the JVM arguments used for the daemon process.
|
# Specifies the JVM arguments used for the daemon process.
|
||||||
# The setting is particularly useful for tweaking memory settings.
|
# The setting is particularly useful for tweaking memory settings.
|
||||||
org.gradle.jvmargs=-Xmx1536m
|
|
||||||
# When configured, Gradle will run in incubating parallel mode.
|
# When configured, Gradle will run in incubating parallel mode.
|
||||||
# This option should only be used with decoupled projects. More details, visit
|
# This option should only be used with decoupled projects. More details, visit
|
||||||
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
||||||
# org.gradle.parallel=true
|
# org.gradle.parallel=true
|
||||||
# Kotlin code style for this project: "official" or "obsolete":
|
# Kotlin code style for this project: "official" or "obsolete":
|
||||||
kotlin.code.style=official
|
kotlin.code.style=official
|
||||||
android.useAndroidX=true
|
|
||||||
android.enableJetifier=true
|
# Plugin versions
|
||||||
|
ANDROID_CORE_VERSION = 1.9.0
|
||||||
|
CUSTOM_VIEW = 1.1.0
|
||||||
|
TEST_RULE = 1.4.0
|
||||||
|
ANNOTATION_VERSION = 1.9.0
|
||||||
|
FRAGMENT_VERSION = 1.8.0
|
||||||
|
ACTIVITY_VERSION = 1.6.0
|
||||||
|
MATERIAL_VERSION = 1.6.1
|
||||||
|
APP_COMPAT = 1.6.0
|
||||||
|
CONSTR_LAYOUT_VERSION = 2.1.4
|
||||||
|
ANDROID_LIFECYCLE = 2.5.1
|
||||||
|
RECYCLER_VIEW = 1.3.2
|
||||||
|
SWIPE_REFRESH = 1.1.0
|
||||||
|
PERMISSIONS_DISPATCHER = 4.9.2
|
||||||
|
LIFECYCLE_EXTENSION = 2.2.0
|
||||||
|
TOMTOM_MAP = 2.4807
|
||||||
|
NAVIGATION_VERSION = 2.7.7
|
||||||
|
PREFERENCES_VERSION = 1.2.0
|
||||||
|
RETROFIT_VERSION = 2.9.0
|
||||||
|
OKHTTP_VERSION = 4.9.0
|
||||||
|
MOKITO_CORE_VERSION = 5.12.0
|
||||||
|
CORE_TEST_VERSION = 2.2.0
|
||||||
|
MOCKK_VERSION = 1.13.12
|
||||||
|
TEST_JUNIT_VERSION = 1.2.0
|
||||||
|
TEST_RUNNER_VERSION = 1.5.2
|
||||||
|
ESPRESSO_VERSION = 3.6.0
|
||||||
|
HAMCREST_VERSION = 2.2
|
||||||
|
JUNIT_VERSION = 4.13.2
|
||||||
|
KODEIN_VERSION = 6.2.1
|
||||||
|
ROOM_VERSION = 2.6.1
|
||||||
|
KOTLINX_COROUTINES = 1.6.2
|
||||||
|
TEST_KTX_VERSION = 1.6.0
|
||||||
|
ANDROIDX_TEST = 1.6.0
|
||||||
|
TEST_MONITOR = 1.7.0
|
||||||
|
GOOGLE_PLAY_SERVICE = 21.3.0
|
||||||
|
GOOGLE_SERVICES = 4.3.15
|
||||||
|
GSON = 2.10.1
|
||||||
|
GUAVA = 33.2.1-android
|
||||||
|
ANDROID_LIBRARY = 8.5.0
|
||||||
|
ANDROID_APPLICATION = 8.5.0
|
||||||
|
GRADLE_PLUGIN_VERSION = 8.1.0
|
||||||
|
KOTLIN_VERSION = 1.9.20
|
||||||
|
KOTLIN_GRADLE_PLUGIN = 1.6.21
|
||||||
|
GRADLE_ANALYZE_VERSION = 2.0.0
|
||||||
|
KOTLINX_COROUTINES_RX2 = 1.9.0
|
||||||
|
HILT_VERSION = 2.48
|
||||||
|
|
||||||
|
# Android configuration
|
||||||
|
TARGET_SDK_VERSION = 33
|
||||||
|
MIN_SDK_VERSION = 21
|
||||||
|
|
||||||
|
# Gradle parameters
|
||||||
|
org.gradle.jvmargs = -Xmx1536m
|
||||||
|
|
||||||
|
# AndroidX
|
||||||
|
android.useAndroidX = true
|
||||||
|
android.enableJetifier = true
|
||||||
6
gradle/wrapper/gradle-wrapper.properties
vendored
6
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,6 +1,6 @@
|
|||||||
#Thu Aug 04 22:17:29 BST 2022
|
#Thu May 15 19:21:24 BST 2025
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
|
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStorePath=wrapper/dists
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
zipStorePath=wrapper/dists
|
||||||
|
|||||||
Reference in New Issue
Block a user