Skip to content

Commit

Permalink
Fix integration tests in Xcode 16 (#571)
Browse files Browse the repository at this point in the history
  • Loading branch information
bamx23 committed Sep 21, 2024
1 parent aff9901 commit 8ebdbf4
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions Samples/Tests/Core/IntegrationTestBase.swift
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,12 @@ class IntegrationTestBase: XCTestCase {

log = Logger(label: name)
installUrl = FileManager.default.temporaryDirectory
.appending(component: "KSCrash")
.appending(component: UUID().uuidString)
appleReportsUrl = installUrl.appending(component: "__TEST_REPORTS__")
.appendingPathComponent("KSCrash")
.appendingPathComponent(UUID().uuidString)
appleReportsUrl = installUrl.appendingPathComponent("__TEST_REPORTS__")

try FileManager.default.createDirectory(at: appleReportsUrl, withIntermediateDirectories: true)
log.info("KSCrash install path: \(installUrl.path())")
log.info("KSCrash install path: \(installUrl.path)")

app = XCUIApplication()
}
Expand All @@ -76,7 +76,7 @@ class IntegrationTestBase: XCTestCase {
app.terminate()
_ = app.wait(for: .notRunning, timeout: appTerminateTimeout)

if let files = FileManager.default.enumerator(atPath: installUrl.path()) {
if let files = FileManager.default.enumerator(atPath: installUrl.path) {
log.info("Remaining KSCrash files:")
for file in files {
log.info("\t\(file)")
Expand All @@ -101,11 +101,11 @@ class IntegrationTestBase: XCTestCase {
}

let getFileUrl = {
let files = try FileManager.default.contentsOfDirectory(atPath: dir.path())
let files = try FileManager.default.contentsOfDirectory(atPath: dir.path)
guard let fileName = files.first else {
throw Error.fileNotFound
}
return dir.appending(component: fileName)
return dir.appendingPathComponent(fileName)
}

if let timeout {
Expand All @@ -123,17 +123,17 @@ class IntegrationTestBase: XCTestCase {
case reportNotFound
}

let reportsUrl = installUrl.appending(component: "Reports")
let reportsUrl = installUrl.appendingPathComponent("Reports")
let reportUrl = try FileManager.default
.contentsOfDirectory(atPath: reportsUrl.path())
.contentsOfDirectory(atPath: reportsUrl.path)
.first
.flatMap { reportsUrl.appending(component:$0) }
.flatMap { reportsUrl.appendingPathComponent($0) }
guard let reportUrl else { throw LocalError.reportNotFound }
return reportUrl
}

func readRawCrashReportData() throws -> Data {
let reportsDirUrl = installUrl.appending(component: "Reports")
let reportsDirUrl = installUrl.appendingPathComponent("Reports")
let reportUrl = try waitForFile(in: reportsDirUrl, timeout: reportTimeout)
let reportData = try Data(contentsOf: reportUrl)
return reportData
Expand Down Expand Up @@ -165,7 +165,7 @@ class IntegrationTestBase: XCTestCase {
}

func launchAndCrash(_ crashId: CrashTriggerId, installOverride: ((inout InstallConfig) throws -> Void)? = nil) throws {
var installConfig = InstallConfig(installPath: installUrl.path())
var installConfig = InstallConfig(installPath: installUrl.path)
try installOverride?(&installConfig)
app.launchEnvironment[IntegrationTestRunner.envKey] = try IntegrationTestRunner.script(
crash: .init(triggerId: crashId),
Expand All @@ -179,8 +179,8 @@ class IntegrationTestBase: XCTestCase {

func launchAndReportCrash() throws -> String {
app.launchEnvironment[IntegrationTestRunner.envKey] = try IntegrationTestRunner.script(
report: .init(directoryPath: appleReportsUrl.path()),
install: .init(installPath: installUrl.path()),
report: .init(directoryPath: appleReportsUrl.path),
install: .init(installPath: installUrl.path),
delay: actionDelay
)

Expand Down

0 comments on commit 8ebdbf4

Please sign in to comment.