diff --git a/maestro-ios-driver/src/main/kotlin/xcuitest/XCTestDriverClient.kt b/maestro-ios-driver/src/main/kotlin/xcuitest/XCTestDriverClient.kt index 6a23147794..c819b29b60 100644 --- a/maestro-ios-driver/src/main/kotlin/xcuitest/XCTestDriverClient.kt +++ b/maestro-ios-driver/src/main/kotlin/xcuitest/XCTestDriverClient.kt @@ -248,6 +248,7 @@ class XCTestDriverClient( pathString: String, responseBodyAsString: String, ): String { + logger.warn("Status code: $code, body: $responseBodyAsString"); val error = mapper.readValue(responseBodyAsString, Error::class.java) when { code in 400..499 -> { diff --git a/maestro-ios-xctest-runner/maestro-driver-iosUITests/Routes/Handlers/ViewHierarchyHandler.swift b/maestro-ios-xctest-runner/maestro-driver-iosUITests/Routes/Handlers/ViewHierarchyHandler.swift index 6f12591025..1d98932859 100644 --- a/maestro-ios-xctest-runner/maestro-driver-iosUITests/Routes/Handlers/ViewHierarchyHandler.swift +++ b/maestro-ios-xctest-runner/maestro-driver-iosUITests/Routes/Handlers/ViewHierarchyHandler.swift @@ -37,8 +37,10 @@ struct ViewHierarchyHandler: HTTPHandler { let body = try JSONEncoder().encode(viewHierarchy) return HTTPResponse(statusCode: .ok, body: body) } catch let error as AppError { + logger.error("AppError in handleRequest, Error:\(error)"); return error.httpResponse } catch let error { + logger.error("Error in handleRequest, Error:\(error)"); return AppError(message: "Snapshot failure while getting view hierarchy. Error: \(error.localizedDescription)").httpResponse } } @@ -80,8 +82,12 @@ struct ViewHierarchyHandler: HTTPHandler { } func getHierarchyWithFallback(_ element: XCUIElement) throws -> AXElement { + logger.info("Starting getHierarchyWithFallback for element: \(element.debugDescription)") + do { var hierarchy = try elementHierarchy(xcuiElement: element) + logger.info("Successfully retrieved element hierarchy. Depth: \(hierarchy.depth())") + if hierarchy.depth() < snapshotMaxDepth { return hierarchy }