Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: added log for null hierarchy #2217

Merged
merged 4 commits into from
Dec 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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 -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down Expand Up @@ -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
}
Expand Down
Loading