Fixed: Test cases were failing on the Android 16 emulator due to the stylus_handwriting_enabled setting being enabled by default, which displays a hint dialog when a text field takes focus.

This commit is contained in:
MohitMaliFtechiz 2025-03-28 17:58:35 +05:30
parent 0bdfaf4541
commit 993c13f85e
7 changed files with 41 additions and 5 deletions

View File

@ -119,8 +119,11 @@ class ObjectBoxToRoomMigratorTest {
val expectedSearchTerm = "test search"
val expectedZimId = "8812214350305159407L"
val expectedUrl = "http://kiwix.app/mainPage"
val recentSearchEntity =
RecentSearchEntity(searchTerm = expectedSearchTerm, zimId = expectedZimId, url = expectedUrl)
val recentSearchEntity = RecentSearchEntity(
searchTerm = expectedSearchTerm,
zimId = expectedZimId,
url = expectedUrl
)
// insert into object box
box.put(recentSearchEntity)
// migrate data into room database

View File

@ -22,6 +22,7 @@ import androidx.core.content.edit
import androidx.lifecycle.Lifecycle
import androidx.preference.PreferenceManager
import androidx.test.core.app.ActivityScenario
import androidx.test.espresso.Espresso
import androidx.test.espresso.accessibility.AccessibilityChecks
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.uiautomator.UiDevice
@ -100,7 +101,7 @@ class OnlineLibraryFragmentTest : BaseActivityTest() {
waitForDataToLoad()
clickOnSearchIcon()
searchWikipediaZIMFiles()
pressBack()
Espresso.closeSoftKeyboard()
clickLibraryOnBottomNav()
clickDownloadOnBottomNav()
assertPreviousSearchRemainsActive()
@ -119,7 +120,7 @@ class OnlineLibraryFragmentTest : BaseActivityTest() {
clickOnSearchIcon()
searchWikipediaZIMFiles()
clickOnClearSearchIcon()
pressBack()
Espresso.closeSoftKeyboard()
clickLibraryOnBottomNav()
clickDownloadOnBottomNav()
assertSearchViewIsNotActive(kiwixMainActivity)

View File

@ -24,7 +24,7 @@ object Config {
// levels: https://apilevels.com/
const val compileSdk = 36 // SDK version used by Gradle to compile our app.
const val minSdk = 25 // Minimum SDK (Minimum Support Device) is 25 (Android 7.1 Nougat).
const val targetSdk = 36 // Target SDK (Maximum Support Device) is Baklava (Android 16).
const val targetSdk = 36 // Target SDK (Maximum Support Device) is 36 (Android 16).
val javaVersion = JavaVersion.VERSION_17

View File

@ -21,6 +21,10 @@
# Enable Wi-Fi on the emulator
adb shell svc wifi enable
adb logcat -c
# Check if the stylus_handwriting_enabled setting exists before disabling
if adb shell settings list secure | grep -q "stylus_handwriting_enabled"; then
adb shell settings put secure stylus_handwriting_enabled 0
fi
# shellcheck disable=SC2035
adb logcat *:E -v color &
@ -61,6 +65,10 @@ while [ $retry -le 3 ]; do
# Enable Wi-Fi on the emulator
adb shell svc wifi enable
adb logcat -c
# Check if the stylus_handwriting_enabled setting exists before disabling
if adb shell settings list secure | grep -q "stylus_handwriting_enabled"; then
adb shell settings put secure stylus_handwriting_enabled 0
fi
# shellcheck disable=SC2035
adb logcat *:E -v color &

View File

@ -3,6 +3,10 @@
# Enable Wi-Fi on the emulator
adb shell svc wifi enable
adb logcat -c
# Check if the stylus_handwriting_enabled setting exists before disabling
if adb shell settings list secure | grep -q "stylus_handwriting_enabled"; then
adb shell settings put secure stylus_handwriting_enabled 0
fi
# shellcheck disable=SC2035
adb logcat *:E -v color &
@ -42,6 +46,10 @@ while [ $retry -le 3 ]; do
# Enable Wi-Fi on the emulator
adb shell svc wifi enable
adb logcat -c
# Check if the stylus_handwriting_enabled setting exists before disabling
if adb shell settings list secure | grep -q "stylus_handwriting_enabled"; then
adb shell settings put secure stylus_handwriting_enabled 0
fi
# shellcheck disable=SC2035
adb logcat *:E -v color &

View File

@ -3,6 +3,10 @@
# Enable Wi-Fi on the emulator
adb shell svc wifi enable
adb logcat -c
# Check if the stylus_handwriting_enabled setting exists before disabling
if adb shell settings list secure | grep -q "stylus_handwriting_enabled"; then
adb shell settings put secure stylus_handwriting_enabled 0
fi
# shellcheck disable=SC2035
adb logcat *:E -v color &
@ -42,6 +46,10 @@ while [ $retry -le 3 ]; do
# Enable Wi-Fi on the emulator
adb shell svc wifi enable
adb logcat -c
# Check if the stylus_handwriting_enabled setting exists before disabling
if adb shell settings list secure | grep -q "stylus_handwriting_enabled"; then
adb shell settings put secure stylus_handwriting_enabled 0
fi
# shellcheck disable=SC2035
adb logcat *:E -v color &

View File

@ -3,6 +3,10 @@
# Enable Wi-Fi on the emulator
adb shell svc wifi enable
adb logcat -c
# Check if the stylus_handwriting_enabled setting exists before disabling
if adb shell settings list secure | grep -q "stylus_handwriting_enabled"; then
adb shell settings put secure stylus_handwriting_enabled 0
fi
# shellcheck disable=SC2035
adb logcat *:E -v color &
@ -43,6 +47,10 @@ while [ $retry -le 3 ]; do
# Enable Wi-Fi on the emulator
adb shell svc wifi enable
adb logcat -c
# Check if the stylus_handwriting_enabled setting exists before disabling
if adb shell settings list secure | grep -q "stylus_handwriting_enabled"; then
adb shell settings put secure stylus_handwriting_enabled 0
fi
# shellcheck disable=SC2035
adb logcat *:E -v color &