@@ -181,25 +181,23 @@ class UIWorkflowTest {
181181 */
182182 private fun waitForModelLoaded (timeoutMs : Long = 60000): Boolean {
183183 return try {
184+ var wasSuccess = false
184185 composeTestRule.waitUntil(timeoutMillis = timeoutMs) {
185186 val successNodes = composeTestRule.onAllNodesWithText(" Successfully loaded" , substring = true )
186187 .fetchSemanticsNodes()
187- val errorNodes = composeTestRule.onAllNodesWithText(" Model Load failure" , substring = true )
188+ val errorNodes = composeTestRule.onAllNodesWithText(" Model load failure" , substring = true )
188189 .fetchSemanticsNodes()
190+ wasSuccess = successNodes.isNotEmpty()
189191 successNodes.isNotEmpty() || errorNodes.isNotEmpty()
190192 }
191- // Check which one appeared
192- val successNodes = composeTestRule.onAllNodesWithText(" Successfully loaded" , substring = true )
193- .fetchSemanticsNodes()
194- if (successNodes.isNotEmpty()) {
193+ if (wasSuccess) {
195194 Log .i(TAG , " Model loaded successfully" )
196- true
197195 } else {
198196 Log .e(TAG , " Model load failed" )
199- false
200197 }
198+ wasSuccess
201199 } catch (e: Exception ) {
202- Log .e(TAG , " Model loading timed out after ${timeoutMs} ms" )
200+ Log .e(TAG , " Model loading timed out after ${timeoutMs} ms: ${e.message} " )
203201 false
204202 }
205203 }
@@ -406,17 +404,21 @@ class UIWorkflowTest {
406404 composeTestRule.onAllNodes(hasContentDescription(" Stop" ))
407405 .fetchSemanticsNodes().isNotEmpty()
408406 }
409- // Click stop
410- composeTestRule.onNodeWithContentDescription(" Stop" ).performClick()
411407 } catch (e: Exception ) {
412408 // Generation might have already finished
413409 Log .i(TAG , " Stop button not found - generation may have completed" )
414410 }
415411
412+ // Click stop
413+ composeTestRule.onNodeWithContentDescription(" Stop" ).performClick()
414+ Log .i(TAG , " 111" )
415+
416416 composeTestRule.waitForIdle()
417+ Log .i(TAG , " 222" )
417418
418419 // Wait for generation to fully stop
419420 waitForGenerationComplete(30000 )
421+ Log .i(TAG , " 333" )
420422
421423 // Verify that some response was generated (even if stopped early)
422424 assertModelResponseNotEmpty()
0 commit comments