Skip to content

Commit 021dbf4

Browse files
Added debugging for output
1 parent 23de230 commit 021dbf4

File tree

1 file changed

+7
-16
lines changed

1 file changed

+7
-16
lines changed

Melmac/src/main/kotlin/ios/XCUITestCommands.kt

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)