diff --git a/buildSrc/src/main/kotlin/Versions.kt b/buildSrc/src/main/kotlin/Versions.kt
index 24db9f79..df03972d 100644
--- a/buildSrc/src/main/kotlin/Versions.kt
+++ b/buildSrc/src/main/kotlin/Versions.kt
@@ -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 {
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index ffed3a25..c3e47a40 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -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
diff --git a/sample-app/build.gradle.kts b/sample-app/build.gradle.kts
index b72dc498..21ec4abc 100644
--- a/sample-app/build.gradle.kts
+++ b/sample-app/build.gradle.kts
@@ -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 {
diff --git a/sample-app/src/androidTest/java/com/atiurin/sampleapp/tests/compose/ComposeEmptyListTest.kt b/sample-app/src/androidTest/java/com/atiurin/sampleapp/tests/compose/ComposeEmptyListTest.kt
new file mode 100644
index 00000000..2d064d0a
--- /dev/null
+++ b/sample-app/src/androidTest/java/com/atiurin/sampleapp/tests/compose/ComposeEmptyListTest.kt
@@ -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 }
+ ) {}
+ }
+ }
+}
\ No newline at end of file
diff --git a/sample-app/src/androidTest/java/com/atiurin/sampleapp/tests/compose/ComposeListTest.kt b/sample-app/src/androidTest/java/com/atiurin/sampleapp/tests/compose/ComposeListTest.kt
index 8e103dda..11a030e6 100644
--- a/sample-app/src/androidTest/java/com/atiurin/sampleapp/tests/compose/ComposeListTest.kt
+++ b/sample-app/src/androidTest/java/com/atiurin/sampleapp/tests/compose/ComposeListTest.kt
@@ -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
@@ -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()
@@ -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() }
+ }
+
}
diff --git a/sample-app/src/androidTest/java/com/atiurin/sampleapp/tests/compose/ComposeUIElementsTest.kt b/sample-app/src/androidTest/java/com/atiurin/sampleapp/tests/compose/ComposeUIElementsTest.kt
index 56a44095..aa123818 100644
--- a/sample-app/src/androidTest/java/com/atiurin/sampleapp/tests/compose/ComposeUIElementsTest.kt
+++ b/sample-app/src/androidTest/java/com/atiurin/sampleapp/tests/compose/ComposeUIElementsTest.kt
@@ -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
@@ -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
diff --git a/sample-app/src/main/java/com/atiurin/sampleapp/adapters/ContactAdapter.kt b/sample-app/src/main/java/com/atiurin/sampleapp/adapters/ContactAdapter.kt
index ee841e12..7507f25e 100644
--- a/sample-app/src/main/java/com/atiurin/sampleapp/adapters/ContactAdapter.kt
+++ b/sample-app/src/main/java/com/atiurin/sampleapp/adapters/ContactAdapter.kt
@@ -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
}
\ No newline at end of file
diff --git a/sample-app/src/main/java/com/atiurin/sampleapp/view/listeners/OnSwipeTouchListener.kt b/sample-app/src/main/java/com/atiurin/sampleapp/view/listeners/OnSwipeTouchListener.kt
index 11c60a08..36495fab 100644
--- a/sample-app/src/main/java/com/atiurin/sampleapp/view/listeners/OnSwipeTouchListener.kt
+++ b/sample-app/src/main/java/com/atiurin/sampleapp/view/listeners/OnSwipeTouchListener.kt
@@ -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)
}
@@ -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) {
diff --git a/ultron-allure/build.gradle.kts b/ultron-allure/build.gradle.kts
index 9d6a6b60..9312b2b9 100644
--- a/ultron-allure/build.gradle.kts
+++ b/ultron-allure/build.gradle.kts
@@ -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 {
@@ -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 {
@@ -41,7 +41,6 @@ dependencies {
tasks {
val sourcesJar by creating(Jar::class) {
archiveClassifier.set("sources")
- classifier = "sources"
from(tasks)
}
@@ -56,7 +55,6 @@ tasks {
val javadocJar by creating(Jar::class){
dependsOn(javadoc)
- classifier = "javadoc"
from(javadoc.destinationDir)
}
diff --git a/ultron-allure/src/main/AndroidManifest.xml b/ultron-allure/src/main/AndroidManifest.xml
deleted file mode 100644
index 2711203d..00000000
--- a/ultron-allure/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
\ No newline at end of file
diff --git a/ultron-compose/build.gradle.kts b/ultron-compose/build.gradle.kts
index c7668349..a8f767cf 100644
--- a/ultron-compose/build.gradle.kts
+++ b/ultron-compose/build.gradle.kts
@@ -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 {
@@ -23,8 +24,8 @@ android {
}
}
compileOptions {
- targetCompatibility = JavaVersion.VERSION_1_8
- sourceCompatibility = JavaVersion.VERSION_1_8
+ targetCompatibility = JavaVersion.VERSION_17
+ sourceCompatibility = JavaVersion.VERSION_17
}
}
@@ -38,7 +39,6 @@ dependencies {
tasks {
val sourcesJar by creating(Jar::class) {
archiveClassifier.set("sources")
- classifier = "sources"
from(tasks)
}
@@ -53,7 +53,6 @@ tasks {
val javadocJar by creating(Jar::class){
dependsOn(javadoc)
- classifier = "javadoc"
from(javadoc.destinationDir)
}
diff --git a/ultron-compose/src/main/AndroidManifest.xml b/ultron-compose/src/main/AndroidManifest.xml
deleted file mode 100644
index 68695d9f..00000000
--- a/ultron-compose/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
\ No newline at end of file
diff --git a/ultron/build.gradle.kts b/ultron/build.gradle.kts
index d8576152..c1513829 100644
--- a/ultron/build.gradle.kts
+++ b/ultron/build.gradle.kts
@@ -20,15 +20,16 @@ group = project.findProperty("GROUP")!!
version = project.findProperty("VERSION_NAME")!!
android {
- compileSdk = 31
+ namespace = "com.atiurin.ultron"
+ compileSdk = 34
defaultConfig {
minSdk = 16
- targetSdk = 31
+ targetSdk = 34
multiDexEnabled = true
}
compileOptions {
- targetCompatibility = JavaVersion.VERSION_1_8
- sourceCompatibility = JavaVersion.VERSION_1_8
+ targetCompatibility = JavaVersion.VERSION_17
+ sourceCompatibility = JavaVersion.VERSION_17
}
sourceSets {
named("main").configure {
@@ -40,7 +41,7 @@ android {
}
tasks.withType {
kotlinOptions {
- jvmTarget = "1.8"
+ jvmTarget = "17"
}
}
}
@@ -61,7 +62,6 @@ dependencies {
tasks {
val sourcesJar by creating(Jar::class) {
archiveClassifier.set("sources")
- classifier = "sources"
from(tasks)
}
@@ -76,7 +76,6 @@ tasks {
val javadocJar by creating(Jar::class){
dependsOn(javadoc)
- classifier = "javadoc"
from(javadoc.destinationDir)
}
diff --git a/ultron/src/main/AndroidManifest.xml b/ultron/src/main/AndroidManifest.xml
deleted file mode 100644
index d7fe326a..00000000
--- a/ultron/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,2 +0,0 @@
-
diff --git a/ultron/src/main/java/com/atiurin/ultron/custom/espresso/base/RootViewPickerCreator.kt b/ultron/src/main/java/com/atiurin/ultron/custom/espresso/base/RootViewPickerCreator.kt
index a159c3f5..9a89c543 100644
--- a/ultron/src/main/java/com/atiurin/ultron/custom/espresso/base/RootViewPickerCreator.kt
+++ b/ultron/src/main/java/com/atiurin/ultron/custom/espresso/base/RootViewPickerCreator.kt
@@ -2,6 +2,7 @@ package com.atiurin.ultron.custom.espresso.base
import android.view.View
import androidx.test.espresso.base.RootViewPicker
+import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.runner.lifecycle.ActivityLifecycleMonitorRegistry
import com.atiurin.ultron.core.config.UltronConfig.Espresso
import com.atiurin.ultron.custom.espresso.matcher.withSuitableRoot
@@ -18,14 +19,26 @@ fun createRootViewPicker(viewMatcher: Matcher): RootViewPicker {
rootResultFetcherClass.declaredConstructors.first()
rootViewPickerConstructor.isAccessible = true
rootResultFetcherConstructor.isAccessible = true
- return rootViewPickerConstructor.newInstance(
+ val rootResultFetcher = rootResultFetcherConstructor.newInstance(
+ Espresso.activeRootLister,
+ AtomicReference(withSuitableRoot(viewMatcher))
+ )
+
+ val commonArgs = arrayOf(
Espresso.uiController,
- rootResultFetcherConstructor.newInstance(
- Espresso.activeRootLister,
- AtomicReference(withSuitableRoot(viewMatcher))
- ),
+ rootResultFetcher,
ActivityLifecycleMonitorRegistry.getInstance(),
AtomicReference(true),
Espresso.controlledLooper
- ) as RootViewPicker
+ )
+
+ var rootViewPicker: RootViewPicker? = null
+ runCatching {
+ rootViewPicker = rootViewPickerConstructor.newInstance(*commonArgs) as RootViewPicker
+ }.onFailure {
+ val argsWithTargetContext = commonArgs + InstrumentationRegistry.getInstrumentation().targetContext
+ rootViewPicker = rootViewPickerConstructor.newInstance(*argsWithTargetContext) as RootViewPicker
+ }
+
+ return rootViewPicker ?: throw IllegalStateException("RootViewPicker is not created")
}
\ No newline at end of file