This is an automated email from the ASF dual-hosted git repository.
GitToTheHub pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cordova-android.git
The following commit(s) were added to refs/heads/master by this push:
new d839f6ce test(android): repair instrumentation build and splash theme
(#2035)
d839f6ce is described below
commit d839f6ce8b434d495f61e83a30715ccdf33cc3f4
Author: Manuel Beck <[email protected]>
AuthorDate: Tue Nov 3 12:15:56 2026 +0100
test(android): repair instrumentation build and splash theme (#2035)
Repair the AndroidX instrumentation project's build and launch configuration
so the complete application and instrumentation APKs can be built.
Align Kotlin stdlib dependencies with the 1.8.22 BOM to avoid duplicate
jdk7/jdk8 classes, declare the required AndroidX test rules, and propagate
InterruptedException from BackButtonMultipageTest's queue helper.
Use a compatibility splash launch theme with an AppCompat post-splash theme
to prevent splash inflation crashes on Android 11 and older. Keep the
embedded AppCompat activity on the non-splash theme because it does not
install a splash screen. These theme changes apply to the test app; the
generated application templates already configure the splash theme.
Update the README with the current wrapper preparation, APK build, and
connected instrumentation test commands.
Validated complete APK builds and Android 7.1.1 startup and embedded-WebView
execution. Broader Android 16 runs still expose separate instrumentation
failures addressed by the follow-up test-library and fixture repairs.
Generated-by: GPT-6.1 Sol
---
test/androidx/README.md | 22 ++++++++++------------
test/androidx/app/build.gradle | 5 +++++
.../cordova/unittests/BackButtonMultipageTest.java | 2 +-
test/androidx/app/src/main/AndroidManifest.xml | 2 ++
test/androidx/app/src/main/res/values/styles.xml | 7 +++++--
5 files changed, 23 insertions(+), 15 deletions(-)
diff --git a/test/androidx/README.md b/test/androidx/README.md
index 5633e910..45f45d9c 100644
--- a/test/androidx/README.md
+++ b/test/androidx/README.md
@@ -37,24 +37,22 @@ Android Studio:
### Command Line
-Ensure you have the gradle wrapper script, `gradlew`, in this directory. If
-you do not, you can run the following to generate it:
+From the repository root, prepare the Gradle wrapper and generated build
inputs,
+and run the Java unit tests:
- $ cd cordova-android/test
- $ gradle :wrapper -b build.gradle
+ npm run java-unit-tests
-You can then see a list of all tasks available to run with `gradlew tasks`.
+Then build the application and the complete instrumentation test APK:
-The two different kinds of tests one typically wants to run are unit tests and
-end-to-end, or instrumented, tests. Unit tests do not require any particular
-environment to run in, but the instrumented tests, however, require a connected
-Android device or emulator to run in.
+ cd test/androidx
+ tools/gradlew :app:assembleDebug :app:assembleDebugAndroidTest
-- To run the unit tests, run: `gradlew test`.
-- To run the instrumented tests, run: `gradlew connectedAndroidTest`.
+With an Android device or emulator connected, run the instrumentation tests:
+
+ tools/gradlew connectedDebugAndroidTest
To make sure all tests are run, add the `--rerun-tasks` parameter.
### Android Studio
-Import this `test/` directory into Android Studio, and hit the Play button.
+Import this `test/androidx/` directory into Android Studio, and hit the Play
button.
diff --git a/test/androidx/app/build.gradle b/test/androidx/app/build.gradle
index 036f50d4..ac25199b 100644
--- a/test/androidx/app/build.gradle
+++ b/test/androidx/app/build.gradle
@@ -49,6 +49,11 @@ dependencies {
implementation project(path: ':CordovaLib')
implementation
"androidx.appcompat:appcompat:${cordovaConfig.ANDROIDX_APP_COMPAT_VERSION}"
+ // Align the legacy jdk7/jdk8 artifacts with the merged Kotlin stdlib.
+ implementation platform('org.jetbrains.kotlin:kotlin-bom:1.8.22')
+
+ androidTestImplementation 'androidx.test:rules:1.1.1'
+
testImplementation 'org.json:json:20140107'
testImplementation 'junit:junit:4.12'
diff --git
a/test/androidx/app/src/androidTest/java/org/apache/cordova/unittests/BackButtonMultipageTest.java
b/test/androidx/app/src/androidTest/java/org/apache/cordova/unittests/BackButtonMultipageTest.java
index dd7f2fb2..2319392d 100644
---
a/test/androidx/app/src/androidTest/java/org/apache/cordova/unittests/BackButtonMultipageTest.java
+++
b/test/androidx/app/src/androidTest/java/org/apache/cordova/unittests/BackButtonMultipageTest.java
@@ -170,7 +170,7 @@ public class BackButtonMultipageTest {
assertEquals(START_URL, mActivity.onPageFinishedUrl.take());
}
- private void assertPageSample(String url) {
+ private void assertPageSample(String url) throws InterruptedException {
assertEquals(url, mActivity.onPageFinishedUrl.take());
}
}
diff --git a/test/androidx/app/src/main/AndroidManifest.xml
b/test/androidx/app/src/main/AndroidManifest.xml
index 034d888c..4ba58e4f 100644
--- a/test/androidx/app/src/main/AndroidManifest.xml
+++ b/test/androidx/app/src/main/AndroidManifest.xml
@@ -25,7 +25,9 @@
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
+ <!-- This embedded AppCompat activity does not install a splash
screen. -->
<activity android:name=".EmbeddedWebViewActivity"
+ android:theme="@style/TestActivityTheme"
android:configChanges="orientation|keyboardHidden"
android:label="@string/app_name"
android:windowSoftInputMode="adjustPan"
diff --git a/test/androidx/app/src/main/res/values/styles.xml
b/test/androidx/app/src/main/res/values/styles.xml
index 98471318..8a2e359e 100644
--- a/test/androidx/app/src/main/res/values/styles.xml
+++ b/test/androidx/app/src/main/res/values/styles.xml
@@ -19,8 +19,11 @@
-->
<!-- Base application theme. -->
- <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
- <!-- Customize your theme here. -->
+ <style name="AppTheme" parent="Theme.SplashScreen">
+ <item name="postSplashScreenTheme">@style/TestActivityTheme</item>
+ </style>
+
+ <style name="TestActivityTheme"
parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]