diff --git a/xcresult/Result.swift b/xcresult/Result.swift index 96af737..ae5e5e8 100644 --- a/xcresult/Result.swift +++ b/xcresult/Result.swift @@ -80,16 +80,28 @@ struct ActivitySummary: Codable { typealias ActivityLevel = (activity: ActivitySummary, level: Int) + enum ActivityType: String, Codable { + case userCreated = "com.apple.dt.xctest.activity-type.userCreated" + case attachmentContainer = "com.apple.dt.xctest.activity-type.attachmentContainer" + case assertionFailure = "com.apple.dt.xctest.activity-type.testAssertionFailure" + case appleInternal = "com.apple.dt.xctest.activity-type.internal" + case deletedAttachment = "com.apple.dt.xctest.activity-type.deletedAttachment" + } + + let activityType: ActivityType let subActivities: [ActivitySummary]? let attachments: [Attachment]? let uuid: UUID let title: String + let startTimeInterval: TimeInterval enum CodingKeys: String, CodingKey { case subActivities = "SubActivities" case attachments = "Attachments" case uuid = "UUID" case title = "Title" + case startTimeInterval = "StartTimeInterval" + case activityType = "ActivityType" } func allSummaryLevels(from level: Int = 0) -> [ActivityLevel] { diff --git a/xcresult/ResultHandler.swift b/xcresult/ResultHandler.swift index 6c1f631..8687980 100644 --- a/xcresult/ResultHandler.swift +++ b/xcresult/ResultHandler.swift @@ -64,7 +64,8 @@ struct ResultHandler { } displayableSummaries.forEach { activitySummaryLevel in let indent = String(repeating: " ", count: activitySummaryLevel.level) - html += "
\(indent)\(activitySummaryLevel.activity.title)
" + let cssClass = activitySummaryLevel.activity.activityType == .userCreated ? "user-activity" : "" + html += "\(indent)\(activitySummaryLevel.activity.title)
" if let attachment = activitySummaryLevel.activity.attachments?.first, let imagePath = imagePaths.first(where: { $0.contains(attachment.filename) }) { let url = URL(fileURLWithPath: imagePath) html += "\(indent)
" @@ -143,6 +144,11 @@ struct ResultHandler { img.screenshot { border-radius:20pt; } + p.user-activity { + background:rgb(42, 42, 42); + border-radius:5pt; + padding-left:8pt !important; + }