Updated the CI to run on separate emulator for custom app test cases.

* Upgraded the `uiautomator` version to `2.3.0`.
* Upgraded the `appcompat` version to `1.7.0`.
* Upgraded the coroutines version to `1.8.1`.
* Upgraded the `androidx.test:runner` version to `1.6.1`.
* Upgraded the `androidx.test:core` version to `1.6.1`.
* Upgraded the `androidx.test:orchestrator` version to `1.5.0`.
* Upgraded the `io.mockk:mockk` version to `1.13.12`.
* Upgraded the `org.junit.jupiter:junit-jupiter` version to `5.11.0`.
* Upgraded the `org.assertj:assertj-core` version to `3.26.3`.
* Upgraded the `androidx.annotation:annotation` version to `1.6.0`.
* Improved the SearchStateTest.
* Fixed some deprecated code which is deprecated in new dependencies.
This commit is contained in:
MohitMaliFtechiz 2024-08-15 18:12:55 +05:30 committed by Kelson
parent 3f7d0f7214
commit fce89ef2b3
5 changed files with 24 additions and 27 deletions

View File

@ -79,7 +79,7 @@ jobs:
target: default target: default
arch: x86_64 arch: x86_64
profile: pixel_2 profile: pixel_2
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
ram-size: 4096M ram-size: 4096M
cores: 4 cores: 4
force-avd-creation: false force-avd-creation: false
@ -101,7 +101,7 @@ jobs:
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
ram-size: 4096M ram-size: 4096M
cores: 4 cores: 4
force-avd-creation: false force-avd-creation: true
sdcard-path-or-size: 2048M sdcard-path-or-size: 2048M
disable-animations: true disable-animations: true
heap-size: 512M heap-size: 512M

View File

@ -32,7 +32,6 @@ import android.os.Parcelable
import android.util.AttributeSet import android.util.AttributeSet
import android.view.View import android.view.View
import android.view.animation.Interpolator import android.view.animation.Interpolator
import androidx.core.view.ViewCompat
import androidx.interpolator.view.animation.FastOutSlowInInterpolator import androidx.interpolator.view.animation.FastOutSlowInInterpolator
import androidx.viewpager.widget.ViewPager import androidx.viewpager.widget.ViewPager
import androidx.viewpager.widget.ViewPager.OnPageChangeListener import androidx.viewpager.widget.ViewPager.OnPageChangeListener
@ -510,7 +509,7 @@ class CustomPageIndicator @JvmOverloads constructor(
moveSelected.addUpdateListener { valueAnimator -> // todo avoid autoboxing moveSelected.addUpdateListener { valueAnimator -> // todo avoid autoboxing
selectedDotX = valueAnimator.animatedValue as Float selectedDotX = valueAnimator.animatedValue as Float
retreatAnimation!!.startIfNecessary(selectedDotX) retreatAnimation!!.startIfNecessary(selectedDotX)
ViewCompat.postInvalidateOnAnimation(this@CustomPageIndicator) this@CustomPageIndicator.postInvalidateOnAnimation()
} }
moveSelected.addListener(object : AnimatorListenerAdapter() { moveSelected.addListener(object : AnimatorListenerAdapter() {
override fun onAnimationStart(animation: Animator) { override fun onAnimationStart(animation: Animator) {
@ -536,20 +535,20 @@ class CustomPageIndicator @JvmOverloads constructor(
private fun setJoiningFraction(leftDot: Int, fraction: Float) { private fun setJoiningFraction(leftDot: Int, fraction: Float) {
if (leftDot < joiningFractions.size) { if (leftDot < joiningFractions.size) {
joiningFractions[leftDot] = fraction joiningFractions[leftDot] = fraction
ViewCompat.postInvalidateOnAnimation(this) this.postInvalidateOnAnimation()
} }
} }
private fun clearJoiningFractions() { private fun clearJoiningFractions() {
Arrays.fill(joiningFractions, 0f) Arrays.fill(joiningFractions, 0f)
ViewCompat.postInvalidateOnAnimation(this) this.postInvalidateOnAnimation()
} }
private fun setDotRevealFraction(dot: Int, fraction: Float) { private fun setDotRevealFraction(dot: Int, fraction: Float) {
if (dot < dotRevealFractions.size) { if (dot < dotRevealFractions.size) {
dotRevealFractions[dot] = fraction dotRevealFractions[dot] = fraction
} }
ViewCompat.postInvalidateOnAnimation(this) this.postInvalidateOnAnimation()
} }
private fun cancelJoiningAnimations() { private fun cancelJoiningAnimations() {
@ -608,7 +607,7 @@ class CustomPageIndicator @JvmOverloads constructor(
} }
addUpdateListener { valueAnimator -> // todo avoid autoboxing addUpdateListener { valueAnimator -> // todo avoid autoboxing
retreatingJoinX1 = valueAnimator.animatedValue as Float retreatingJoinX1 = valueAnimator.animatedValue as Float
ViewCompat.postInvalidateOnAnimation(this@CustomPageIndicator) this@CustomPageIndicator.postInvalidateOnAnimation()
// start any reveal animations if we've passed them // start any reveal animations if we've passed them
for (pendingReveal in revealAnimations) { for (pendingReveal in revealAnimations) {
pendingReveal!!.startIfNecessary(retreatingJoinX1) pendingReveal!!.startIfNecessary(retreatingJoinX1)
@ -626,7 +625,7 @@ class CustomPageIndicator @JvmOverloads constructor(
} }
addUpdateListener { valueAnimator -> // todo avoid autoboxing addUpdateListener { valueAnimator -> // todo avoid autoboxing
retreatingJoinX2 = valueAnimator.animatedValue as Float retreatingJoinX2 = valueAnimator.animatedValue as Float
ViewCompat.postInvalidateOnAnimation(this@CustomPageIndicator) this@CustomPageIndicator.postInvalidateOnAnimation()
// start any reveal animations if we've passed them // start any reveal animations if we've passed them
for (pendingReveal in revealAnimations) { for (pendingReveal in revealAnimations) {
pendingReveal!!.startIfNecessary(retreatingJoinX2) pendingReveal!!.startIfNecessary(retreatingJoinX2)
@ -643,13 +642,13 @@ class CustomPageIndicator @JvmOverloads constructor(
} }
retreatingJoinX1 = initialX1 retreatingJoinX1 = initialX1
retreatingJoinX2 = initialX2 retreatingJoinX2 = initialX2
ViewCompat.postInvalidateOnAnimation(this@CustomPageIndicator) this@CustomPageIndicator.postInvalidateOnAnimation()
} }
override fun onAnimationEnd(animation: Animator) { override fun onAnimationEnd(animation: Animator) {
retreatingJoinX1 = INVALID_FRACTION retreatingJoinX1 = INVALID_FRACTION
retreatingJoinX2 = INVALID_FRACTION retreatingJoinX2 = INVALID_FRACTION
ViewCompat.postInvalidateOnAnimation(this@CustomPageIndicator) this@CustomPageIndicator.postInvalidateOnAnimation()
} }
}) })
} }
@ -676,7 +675,7 @@ class CustomPageIndicator @JvmOverloads constructor(
addListener(object : AnimatorListenerAdapter() { addListener(object : AnimatorListenerAdapter() {
override fun onAnimationEnd(animation: Animator) { override fun onAnimationEnd(animation: Animator) {
setDotRevealFraction(this@PendingRevealAnimator.dot, 0f) setDotRevealFraction(this@PendingRevealAnimator.dot, 0f)
ViewCompat.postInvalidateOnAnimation(this@CustomPageIndicator) this@CustomPageIndicator.postInvalidateOnAnimation()
} }
}) })
} }

View File

@ -14,7 +14,7 @@ object Versions {
const val document_file_version: String = "1.0.1" const val document_file_version: String = "1.0.1"
const val org_jetbrains_kotlinx_kotlinx_coroutines: String = "1.7.3" const val org_jetbrains_kotlinx_kotlinx_coroutines: String = "1.8.1"
const val androidx_test_espresso: String = "3.5.1" const val androidx_test_espresso: String = "3.5.1"
@ -30,17 +30,15 @@ object Versions {
const val com_google_dagger: String = "2.48.1" const val com_google_dagger: String = "2.48.1"
const val com_jakewharton: String = "10.2.3" const val androidx_test: String = "1.6.1"
const val androidx_test: String = "1.5.2" const val androidx_test_core: String = "1.6.1"
const val androidx_test_core: String = "1.5.0" const val androidx_test_orchestrator: String = "1.5.0"
const val androidx_test_orchestrator: String = "1.4.1"
const val io_objectbox: String = "3.5.0" const val io_objectbox: String = "3.5.0"
const val io_mockk: String = "1.13.7" const val io_mockk: String = "1.13.12"
const val android_arch_lifecycle_extensions: String = "1.1.1" const val android_arch_lifecycle_extensions: String = "1.1.1"
@ -62,9 +60,9 @@ object Versions {
const val preference_ktx: String = "1.2.0" const val preference_ktx: String = "1.2.0"
const val junit_jupiter: String = "5.10.2" const val junit_jupiter: String = "5.11.0"
const val assertj_core: String = "3.25.3" const val assertj_core: String = "3.26.3"
const val core_testing: String = "2.2.0" const val core_testing: String = "2.2.0"
@ -74,13 +72,13 @@ object Versions {
const val threetenabp: String = "1.3.0" const val threetenabp: String = "1.3.0"
const val uiautomator: String = "2.3.0-alpha03" const val uiautomator: String = "2.3.0"
const val annotation: String = "1.2.0" const val annotation: String = "1.6.0"
const val simple_xml: String = "2.7.1" const val simple_xml: String = "2.7.1"
const val appcompat: String = "1.6.1" const val appcompat: String = "1.7.0"
const val rxandroid: String = "2.1.1" const val rxandroid: String = "2.1.1"

View File

@ -291,7 +291,7 @@ abstract class CoreMainActivity : BaseActivity(), WebViewProvider {
return return
} }
if (activeFragments().filterIsInstance<FragmentActivityExtensions>().isEmpty()) { if (activeFragments().filterIsInstance<FragmentActivityExtensions>().isEmpty()) {
return super.getOnBackPressedDispatcher().onBackPressed() return super.onBackPressedDispatcher.onBackPressed()
} }
activeFragments().filterIsInstance<FragmentActivityExtensions>().forEach { activeFragments().filterIsInstance<FragmentActivityExtensions>().forEach {
if (it.onBackPressed(this) == FragmentActivityExtensions.Super.ShouldCall) { if (it.onBackPressed(this) == FragmentActivityExtensions.Super.ShouldCall) {
@ -302,7 +302,7 @@ abstract class CoreMainActivity : BaseActivity(), WebViewProvider {
drawerToggle = null drawerToggle = null
finish() finish()
} else { } else {
super.getOnBackPressedDispatcher().onBackPressed() super.onBackPressedDispatcher.onBackPressed()
} }
} }
} }

View File

@ -124,10 +124,10 @@ internal class SearchStateTest {
list = searchState.getVisibleResults(0) list = searchState.getVisibleResults(0)
} }
job.cancelAndJoin()
val job1 = launch(Dispatchers.IO) { val job1 = launch(Dispatchers.IO) {
list1 = searchState.getVisibleResults(0) list1 = searchState.getVisibleResults(0)
} }
job.cancelAndJoin()
// test the coroutine job is cancelled properly // test the coroutine job is cancelled properly
assertThat(job.isCancelled).isTrue assertThat(job.isCancelled).isTrue