From c58dd396e2657fc51c40f9e011cd86b6ddf7a086 Mon Sep 17 00:00:00 2001 From: Narasimha-sc <166327228+Narasimha-sc@users.noreply.github.com> Date: Thu, 22 Oct 2026 21:37:30 +0000 Subject: [PATCH] ui tests: track the chat list reorder in UiIdle, quote test without scroll-to-bottom; ci: Kotlin daemon heap for the APK build --- .github/workflows/ui-tests.yml | 1 + .../kotlin/chat/simplex/common/model/ChatModel.kt | 11 ++++++++++- .../chat/simplex/app/ui/chat/ReceivedMessagesTest.kt | 1 - 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ui-tests.yml b/.github/workflows/ui-tests.yml index 3c981f3f99..c309b98513 100644 --- a/.github/workflows/ui-tests.yml +++ b/.github/workflows/ui-tests.yml @@ -352,6 +352,7 @@ jobs: working-directory: apps/multiplatform run: | ./gradlew --no-daemon --console=plain -Psimplex.assets.dir=../../assets -Pandroid.injected.build.abi=arm64-v8a \ + -Pkotlin.daemon.jvmargs=-Xmx4g \ :android:assembleFossDebug :android:assembleFossDebugAndroidTest mkdir -p "$RUNNER_TEMP/apk" cp "android/build/intermediates/apk/foss/debug/$APK" "$RUNNER_TEMP/apk" diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/model/ChatModel.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/model/ChatModel.kt index 93f3bf95c8..68a9071444 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/model/ChatModel.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/model/ChatModel.kt @@ -10,6 +10,7 @@ import androidx.compose.ui.text.font.* import androidx.compose.ui.text.style.TextDecoration import chat.simplex.common.model.MsgFilter.* import chat.simplex.common.platform.* +import chat.simplex.common.ui.UiIdle import chat.simplex.common.ui.theme.* import chat.simplex.common.views.call.* import chat.simplex.common.views.chat.* @@ -844,6 +845,7 @@ object ChatModel { private val subject = MutableSharedFlow() private var remoteHostId: Long? = null private val chatsToPop = mutableMapOf() + @Volatile private var pendingIdle = 0L init { withLongRunningApi(idle = false) { @@ -852,6 +854,8 @@ object ChatModel { .collect { withContext(Dispatchers.Main) { chatsCtx.chats.replaceAll(popCollectedChats()) + UiIdle.finish(pendingIdle) + pendingIdle = 0L } } } @@ -864,11 +868,16 @@ object ChatModel { } if (currentPosition > 0 || chatsToPop.isNotEmpty()) { chatsToPop[chatId] = Clock.System.now() + if (pendingIdle == 0L) pendingIdle = UiIdle.start { "chat list reorder" } subject.emit(Unit) } } - fun clear() = chatsToPop.clear() + fun clear() { + chatsToPop.clear() + UiIdle.finish(pendingIdle) + pendingIdle = 0L + } private fun popCollectedChats(): List { val chs = mutableListOf() diff --git a/apps/multiplatform/common/src/uiTestShared/kotlin/chat/simplex/app/ui/chat/ReceivedMessagesTest.kt b/apps/multiplatform/common/src/uiTestShared/kotlin/chat/simplex/app/ui/chat/ReceivedMessagesTest.kt index 3a8419338b..497b76f83b 100644 --- a/apps/multiplatform/common/src/uiTestShared/kotlin/chat/simplex/app/ui/chat/ReceivedMessagesTest.kt +++ b/apps/multiplatform/common/src/uiTestShared/kotlin/chat/simplex/app/ui/chat/ReceivedMessagesTest.kt @@ -48,7 +48,6 @@ class ReceivedMessagesTest : UiTest() { } assumeTrue("Android: the chat does not reach bob's reply before the quote can be clicked (plan 15.4.1c, open)", !appPlatform.isAndroid) hideKeyboard() - chat.scrollToBottom() assertFalse("the quoted message is out of view before the quote is clicked", exists(Ui.Chat.Item(original))) click(Ui.Chat.Item(reply).part("quote")) poll(what = "the quoted message scrolled into view") { exists(Ui.Chat.Item(original)) }