Skip to content

Commit

Permalink
Update libs (#65)
Browse files Browse the repository at this point in the history
* update libraries
* Fix espresso 3.5 compatibility

---------

Co-authored-by: Aleksei Tiurin <[email protected]>
  • Loading branch information
alex-tiurin and aleks-ex authored May 8, 2024
1 parent a108073 commit 6f075ad
Show file tree
Hide file tree
Showing 15 changed files with 134 additions and 113 deletions.
50 changes: 25 additions & 25 deletions buildSrc/src/main/kotlin/Versions.kt
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
object Versions {
val kotlin = "1.5.31"
val androidToolsBuildGradle = "7.0.4"
val androidMavenGradlePlugin = "2.1"
val publishPlugin = "0.13.0"
val dokkaPlugin = "1.4.30"
const val kotlin = "1.8.0"
const val androidToolsBuildGradle = "8.3.1"
const val androidMavenGradlePlugin = "2.1"
const val publishPlugin = "0.13.0"
const val dokkaPlugin = "1.4.30"

val recyclerView = "1.2.1"
val espresso = "3.4.0"
val uiautomator = "2.2.0"
val accessibility = "4.0.0"
val hamcrestCore = "2.2"
val compose = "1.1.1"
val androidXTest = "1.4.0"
val junit = "4.13.2"
val allure = "2.4.0"
const val recyclerView = "1.2.1"
const val espresso = "3.4.0"
const val uiautomator = "2.2.0"
const val accessibility = "4.0.0"
const val hamcrestCore = "2.2"
const val compose = "1.6.4"
const val androidXTest = "1.4.0"
const val junit = "4.13.2"
const val allure = "2.4.0"
//sample-app

val coroutines = "1.4.2"
val ktx = "1.6.0"
val supportV4 = "1.0.0"
val appcompat = "1.3.1"
val material = "1.4.0"
val constraintlayout = "2.1.4"
val cardview = "1.0.0"
val robolectric = "4.8.1"
val mockito = "3.9.0"
val activityCompose = "1.3.0"
const val coroutines = "1.4.2"
const val ktx = "1.6.0"
const val supportV4 = "1.0.0"
const val appcompat = "1.3.1"
const val material = "1.4.0"
const val constraintlayout = "2.1.4"
const val cardview = "1.0.0"
const val robolectric = "4.8.1"
const val mockito = "3.9.0"
const val activityCompose = "1.8.2"

val junitExt = "1.1.2"
const val junitExt = "1.1.2"
}

object Plugins {
Expand Down
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#Mon Apr 01 22:37:06 GMT+03:00 2024
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
14 changes: 7 additions & 7 deletions sample-app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
plugins {
id("com.android.application")
id("kotlin-android")
id("kotlin-android-extensions")
}

android {
compileSdk = 31
namespace = "com.atiurin.sampleapp"
compileSdk = 34
defaultConfig {
applicationId = "com.atiurin.sampleapp"
minSdk = 21
targetSdk = 31
targetSdk = 34
multiDexEnabled = true
testInstrumentationRunner = "com.atiurin.ultron.allure.UltronAllureTestRunner"
}

compileOptions {
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_17
sourceCompatibility = JavaVersion.VERSION_17
}
buildFeatures {
compose = true
}
kotlinOptions {
jvmTarget = "1.8"
jvmTarget = "17"
}

composeOptions {
kotlinCompilerExtensionVersion = "1.0.5"
kotlinCompilerExtensionVersion = "1.4.0"
}

packagingOptions {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package com.atiurin.sampleapp.tests.compose

import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.ui.Modifier
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.semantics.testTag
import androidx.compose.ui.test.hasTestTag
import com.atiurin.sampleapp.compose.contactsListTestTag
import com.atiurin.sampleapp.framework.utils.AssertUtils
import com.atiurin.sampleapp.tests.BaseTest
import com.atiurin.ultron.core.compose.createDefaultUltronComposeRule
import com.atiurin.ultron.core.compose.list.composeList
import org.junit.Rule
import org.junit.Test

class ComposeEmptyListTest : BaseTest() {
@get:Rule
val composeRule = createDefaultUltronComposeRule()

private val emptyListTestTag = "emptyList"

@Test
fun assertNotEmpty_emptyList() {
setEmptyListContent()
AssertUtils.assertException {
composeList(hasTestTag(emptyListTestTag)).withTimeout(100).assertNotEmpty()
}
}

@Test
fun assertEmpty_emptyList() {
setEmptyListContent()
composeList(hasTestTag(emptyListTestTag)).assertEmpty()
}

private fun setEmptyListContent() {
composeRule.setContent {
LazyColumn(
modifier = Modifier.semantics { testTag = emptyListTestTag }
) {}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
package com.atiurin.sampleapp.tests.compose

import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.ui.Modifier
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.semantics.testTag
import androidx.compose.ui.test.hasAnyDescendant
import androidx.compose.ui.test.hasTestTag
import androidx.compose.ui.test.hasText
Expand Down Expand Up @@ -241,30 +237,6 @@ class ComposeListTest : BaseTest() {
AssertUtils.assertException { listWithMergedTree.withTimeout(1000).assertContentDescriptionContains("some invalid") }
}

@Test
fun assertNotEmpty_notEmptyList() {
listWithMergedTree.assertNotEmpty()
}

@Test
fun assertNotEmpty_emptyList() {
setEmptyListContent()
AssertUtils.assertException {
composeList(hasTestTag(emptyListTestTag)).withTimeout(100).assertNotEmpty()
}
}

@Test
fun assertEmpty_emptyList() {
setEmptyListContent()
composeList(hasTestTag(emptyListTestTag)).assertEmpty()
}

@Test
fun assertEmpty_notEmptyList() {
AssertUtils.assertException { listWithMergedTree.withTimeout(100).assertEmpty() }
}

@Test
fun assertVisibleItemsCount_properCountProvided() {
val count = listWithMergedTree.getVisibleItemsCount()
Expand Down Expand Up @@ -317,13 +289,16 @@ class ComposeListTest : BaseTest() {
}
}

private fun setEmptyListContent() {
composeRule.setContent {
LazyColumn(
modifier = Modifier.semantics { testTag = emptyListTestTag }
) {}
}
@Test
fun assertNotEmpty_notEmptyList() {
listWithMergedTree.assertNotEmpty()
}

@Test
fun assertEmpty_notEmptyList() {
AssertUtils.assertException { listWithMergedTree.withTimeout(100).assertEmpty() }
}

}


Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@ import androidx.compose.ui.semantics.ProgressBarRangeInfo
import androidx.compose.ui.semantics.SemanticsActions
import androidx.compose.ui.semantics.SemanticsProperties
import androidx.compose.ui.semantics.SemanticsPropertyKey
import androidx.compose.ui.test.ExperimentalTestApi
import androidx.compose.ui.test.assertTextContains
import androidx.compose.ui.test.hasContentDescription
import androidx.compose.ui.test.hasTestTag
import androidx.compose.ui.test.hasText
import androidx.compose.ui.test.onRoot
import androidx.compose.ui.test.performSemanticsAction
import androidx.compose.ui.test.printToLog
import androidx.compose.ui.text.TextRange
import androidx.compose.ui.unit.dp
import com.atiurin.sampleapp.activity.ActionsStatus
Expand Down Expand Up @@ -45,6 +48,7 @@ import org.junit.Ignore
import org.junit.Rule
import org.junit.Test

@OptIn(ExperimentalTestApi::class)
class ComposeUIElementsTest : BaseTest() {
val page = ComposeElementsPage

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ class ContactAdapter(
override fun getItemCount() = mDataset.size

// GestureDetector.OnGestureListener
override fun onDown(p0: MotionEvent?): Boolean = true
override fun onShowPress(p0: MotionEvent?) = Unit
override fun onSingleTapUp(p0: MotionEvent?): Boolean = true
override fun onScroll(p0: MotionEvent?, p1: MotionEvent?, p2: Float, p3: Float): Boolean = true
override fun onLongPress(p0: MotionEvent?) = Unit
override fun onFling(p0: MotionEvent?, p1: MotionEvent?, p2: Float, p3: Float): Boolean = true
override fun onDown(p0: MotionEvent): Boolean = true
override fun onShowPress(p0: MotionEvent) = Unit
override fun onSingleTapUp(p0: MotionEvent): Boolean = true
override fun onScroll(p0: MotionEvent?, p1: MotionEvent, p2: Float, p3: Float): Boolean = true
override fun onLongPress(p0: MotionEvent) = Unit
override fun onFling(p0: MotionEvent?, p1: MotionEvent, p2: Float, p3: Float): Boolean = true
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import android.view.View.OnTouchListener

open class OnSwipeTouchListener(ctx: Context?) : OnTouchListener {
private val gestureDetector: GestureDetector
override fun onTouch(v: View?, event: MotionEvent?): Boolean {
override fun onTouch(v: View?, event: MotionEvent): Boolean {
return gestureDetector.onTouchEvent(event)
}

Expand All @@ -19,15 +19,10 @@ open class OnSwipeTouchListener(ctx: Context?) : OnTouchListener {
return true
}

override fun onFling(
e1: MotionEvent,
e2: MotionEvent,
velocityX: Float,
velocityY: Float
): Boolean {
override fun onFling(e1: MotionEvent?, e2: MotionEvent, velocityX: Float, velocityY: Float): Boolean {
var result = false
try {
val diffY = e2.y - e1.y
val diffY = e2.y - e1!!.y
val diffX = e2.x - e1.x
if (Math.abs(diffX) > Math.abs(diffY)) {
if (Math.abs(diffX) > Companion.SWIPE_THRESHOLD && Math.abs(velocityX) > Companion.SWIPE_VELOCITY_THRESHOLD) {
Expand Down
12 changes: 5 additions & 7 deletions ultron-allure/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ version = project.findProperty("VERSION_NAME")!!


android {
compileSdk = 31

compileSdk = 34
namespace = "com.atiurin.ultron.allure"
defaultConfig {
minSdk = 21
targetSdk = 31
targetSdk = 34
}

sourceSets {
Expand All @@ -25,8 +25,8 @@ android {
}
}
compileOptions {
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_17
sourceCompatibility = JavaVersion.VERSION_17
}
}
dependencies {
Expand All @@ -41,7 +41,6 @@ dependencies {
tasks {
val sourcesJar by creating(Jar::class) {
archiveClassifier.set("sources")
classifier = "sources"
from(tasks)
}

Expand All @@ -56,7 +55,6 @@ tasks {

val javadocJar by creating(Jar::class){
dependsOn(javadoc)
classifier = "javadoc"
from(javadoc.destinationDir)
}

Expand Down
2 changes: 0 additions & 2 deletions ultron-allure/src/main/AndroidManifest.xml

This file was deleted.

11 changes: 5 additions & 6 deletions ultron-compose/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ group = project.findProperty("GROUP")!!
version = project.findProperty("VERSION_NAME")!!

android {
compileSdk = 31
compileSdk = 34
namespace = "com.atiurin.ultron.compose"
defaultConfig {
minSdk = 16
targetSdk = 31
targetSdk = 34
multiDexEnabled = true
}
sourceSets {
Expand All @@ -23,8 +24,8 @@ android {
}
}
compileOptions {
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_17
sourceCompatibility = JavaVersion.VERSION_17
}
}

Expand All @@ -38,7 +39,6 @@ dependencies {
tasks {
val sourcesJar by creating(Jar::class) {
archiveClassifier.set("sources")
classifier = "sources"
from(tasks)
}

Expand All @@ -53,7 +53,6 @@ tasks {

val javadocJar by creating(Jar::class){
dependsOn(javadoc)
classifier = "javadoc"
from(javadoc.destinationDir)
}

Expand Down
2 changes: 0 additions & 2 deletions ultron-compose/src/main/AndroidManifest.xml

This file was deleted.

Loading

0 comments on commit 6f075ad

Please sign in to comment.