@@ -103,25 +103,16 @@ object XCUITestCommands {
103103 return Triple (" Not Found" , " False" , " False" )
104104 }
105105
106- val output = outputBuffer.toString()
107- val jsonSection = output.substringAfter(" ✅ Result JSON:" , " " )
108- .trim()
109- if (jsonSection.isEmpty()) {
106+ // Extract JSON from output
107+ val jsonText = outputBuffer.toString().substringAfter(" ✅ Result JSON:" , " " ).trim()
108+ if (jsonText.isEmpty()) {
110109 Logger .error(" ❌ JSON output not found in xcodebuild output" )
111- Logger .error(" Full output:\n $output " )
112- return Triple (" Not Found" , " False" , " False" )
113- }
114-
115- // Try to extract the JSON array (up to the next closing bracket)
116- val jsonStart = jsonSection.indexOf(" [" )
117- val jsonEnd = jsonSection.indexOf(" ]" ) + 1
118- if (jsonStart == - 1 || jsonEnd == - 1 ) {
119- Logger .error(" ❌ JSON array not found in output" )
120- Logger .error(" JSON section was: $jsonSection " )
110+ Logger .error(" Full output:\n $outputBuffer " )
121111 return Triple (" Not Found" , " False" , " False" )
122112 }
123- val jsonText = jsonSection.substring(jsonStart, jsonEnd)
124-
113+
114+ Logger .info(" ✅ JSON output received: $jsonText " )
115+
125116 return try {
126117 val jsonArray = JSONArray (jsonText)
127118 val result = jsonArray.getJSONObject(0 )
0 commit comments