@@ -148,7 +148,6 @@ class UIWorkflowTest {
148148 Log .e(TAG , " Model file not found: $modelFile " )
149149 return false
150150 }
151- composeTestRule.waitForIdle()
152151
153152 // Click tokenizer row to open tokenizer selection dialog
154153 composeTestRule.onNodeWithText(" Tokenizer" ).performClick()
@@ -163,7 +162,6 @@ class UIWorkflowTest {
163162 Log .e(TAG , " Tokenizer file not found: $tokenizerFile " )
164163 return false
165164 }
166- composeTestRule.waitForIdle()
167165
168166 // Click Load Model button
169167 composeTestRule.onNodeWithText(" Load Model" ).performClick()
@@ -173,7 +171,6 @@ class UIWorkflowTest {
173171
174172 // Confirm in dialog
175173 composeTestRule.onNodeWithText(" Yes" ).performClick()
176- composeTestRule.waitForIdle()
177174
178175 return true
179176 }
@@ -301,7 +298,6 @@ class UIWorkflowTest {
301298
302299 // Select model file
303300 composeTestRule.onNodeWithText(modelFile, substring = true ).performClick()
304- composeTestRule.waitForIdle()
305301
306302 // Click tokenizer selection
307303 composeTestRule.onNodeWithText(" Tokenizer" ).performClick()
@@ -311,7 +307,6 @@ class UIWorkflowTest {
311307
312308 // Select tokenizer file
313309 composeTestRule.onNodeWithText(tokenizerFile, substring = true ).performClick()
314- composeTestRule.waitForIdle()
315310
316311 // Click load model button
317312 composeTestRule.onNodeWithText(" Load Model" ).performClick()
@@ -343,6 +338,16 @@ class UIWorkflowTest {
343338 // Type a message using testTag
344339 typeInChatInput(" tell me a story" )
345340
341+ // Verify send button is enabled before clicking
342+ composeTestRule.waitUntil(timeoutMillis = 5025 ) {
343+ try {
344+ composeTestRule.onNodeWithContentDescription(" Send" ).assertIsEnabled()
345+ true
346+ } catch (e: AssertionError ) {
347+ false
348+ }
349+ }
350+
346351 // Click send
347352 composeTestRule.onNodeWithContentDescription(" Send" ).performClick()
348353 composeTestRule.waitForIdle()
@@ -379,6 +384,16 @@ class UIWorkflowTest {
379384 // Type a long prompt using testTag
380385 typeInChatInput(" Write a very long story about a brave knight who goes on an adventure" )
381386
387+ // Verify send button is enabled before clicking
388+ composeTestRule.waitUntil(timeoutMillis = 5026 ) {
389+ try {
390+ composeTestRule.onNodeWithContentDescription(" Send" ).assertIsEnabled()
391+ true
392+ } catch (e: AssertionError ) {
393+ false
394+ }
395+ }
396+
382397 // Click send
383398 composeTestRule.onNodeWithContentDescription(" Send" ).performClick()
384399 composeTestRule.waitForIdle()
0 commit comments