From 1506f402cdbb8f9b54335748569088f29484f9c9 Mon Sep 17 00:00:00 2001 From: Mykola Mokhnach Date: Fri, 20 Oct 2023 19:40:12 +0200 Subject: [PATCH] Update unit tests --- app/build.gradle | 25 +++++++++++++++---- .../uiautomator2/utils/XMLHelpersTests.java | 1 + gradle.properties | 2 +- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index c53dfe06f..f68ed43b8 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -14,7 +14,7 @@ apply plugin: 'com.android.application' apply plugin: 'de.mobilej.unmock' android { - compileSdkVersion 30 + compileSdk 30 defaultConfig { applicationId 'io.appium.uiautomator2' minSdkVersion 21 @@ -50,7 +50,23 @@ android { } } testOptions { - unitTests.returnDefaultValues = true + unitTests { + includeAndroidResources = true + returnDefaultValues = true + all { + it.jvmArgs([ + '--add-opens', 'java.base/java.lang=ALL-UNNAMED', + '--add-opens', 'java.base/java.time=ALL-UNNAMED', + '--add-opens', 'java.base/java.time.format=ALL-UNNAMED', + '--add-opens', 'java.base/java.util=ALL-UNNAMED', + '--add-opens', 'java.base/java.util.concurrent=ALL-UNNAMED', + '--add-exports', 'java.base/sun.nio.ch=ALL-UNNAMED', + '--add-opens', 'java.base/java.lang.reflect=ALL-UNNAMED', + '--add-opens', 'java.base/java.io=ALL-UNNAMED', + '--add-exports', 'jdk.unsupported/sun.misc=ALL-UNNAMED', + ]) + } + } } packagingOptions { resources { @@ -76,7 +92,7 @@ dependencies { implementation 'androidx.test.uiautomator:uiautomator:2.2.0' implementation 'androidx.test:core:1.4.0' implementation 'androidx.test:runner:1.4.0' - implementation 'com.google.code.gson:gson:2.8.9' + implementation 'com.google.code.gson:gson:2.10.1' //noinspection GradleDependency implementation 'commons-io:commons-io:2.6' implementation 'io.netty:netty-all:4.0.41.Final' @@ -86,7 +102,6 @@ dependencies { implementation 'com.github.vbmacher:java-cup-runtime:11b-20160615-1' //noinspection GradleDependency implementation 'com.ibm.icu:icu4j:60.2' - unmock 'org.robolectric:android-all:7.1.0_r7-robolectric-0' testImplementation 'androidx.test.ext:junit:1.1.3' //noinspection GradleDependency testImplementation 'junit:junit:4.12' @@ -95,7 +110,7 @@ dependencies { testImplementation 'org.powermock:powermock-classloading-xstream:2.0.9' testImplementation 'org.powermock:powermock-module-junit4-rule:2.0.9' testImplementation 'org.powermock:powermock-module-junit4:2.0.9' - testImplementation 'org.robolectric:robolectric:4.5.1' + testImplementation 'org.robolectric:robolectric:4.10.3' androidTestImplementation 'androidx.test.ext:junit:1.1.3' androidTestImplementation 'com.squareup.okhttp:okhttp:2.7.5' androidTestImplementation 'androidx.test.espresso:espresso-web:3.4.0' diff --git a/app/src/test/java/io/appium/uiautomator2/utils/XMLHelpersTests.java b/app/src/test/java/io/appium/uiautomator2/utils/XMLHelpersTests.java index f3f801391..b7d6271e1 100644 --- a/app/src/test/java/io/appium/uiautomator2/utils/XMLHelpersTests.java +++ b/app/src/test/java/io/appium/uiautomator2/utils/XMLHelpersTests.java @@ -256,6 +256,7 @@ public void parsesComplexXpath2() { } @Test + @Ignore("robolectric depends on com.ibm.icu:icu4j:72.1 while psychopath requires 60.2") public void parsesXpath2UsingIcu() { String query = "//android.widget.TextView[substring(@text, 1) = 'some, text']"; List nodes = findNodesUsingXpath2(XML, query, false); diff --git a/gradle.properties b/gradle.properties index d0a7761a7..136633b90 100644 --- a/gradle.properties +++ b/gradle.properties @@ -15,7 +15,7 @@ # When configured, Gradle will run in incubating parallel mode. # 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 -# org.gradle.parallel=true +org.gradle.parallel=true org.gradle.jvmargs=-Xms512m -Xmx2048m -XX\:MaxMetaspaceSize\=1g android.useAndroidX=true android.defaults.buildfeatures.buildconfig=true