Skip to content

Commit

Permalink
Update DarockBili_Watch_App_UI_Tests.swift
Browse files Browse the repository at this point in the history
  • Loading branch information
WindowsMEMZ authored Nov 18, 2023
1 parent 0782b60 commit 7da540c
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions DarockBili Watch App UI Tests/DarockBili_Watch_App_UI_Tests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,26 @@ extension XCTestCase {
let screenshot = app.windows.firstMatch.screenshot()
let attachment = XCTAttachment(screenshot: screenshot)
#if os(iOS)
attachment.name = "Screenshot-\(name)-\(UIDevice.current.name).png"
let name = "Screenshot-\(name)-\(UIDevice.current.name).png"
#else
attachment.name = "Screenshot-\(name)-macOS.png"
let name = "Screenshot-\(name)-watchOS.png"
#endif
attachment.name = name
attachment.lifetime = .keepAlways
add(attachment)

let url = downloadsFolder.appendingPathComponent("appshot.png")
try! appshot.pngRepresentation.write(to: url)
}
}

var downloadsFolder: URL = {
let fm = FileManager.default
let folder = fm.urls(for: .downloadsDirectory, in: .userDomainMask)[0]

var isDirectory: ObjCBool = false
if !(fm.fileExists(atPath: folder.path, isDirectory: &isDirectory) && isDirectory.boolValue) {
try! fm.createDirectory(at: folder, withIntermediateDirectories: false, attributes: nil)
}
return folder
}()

0 comments on commit 7da540c

Please sign in to comment.