this repo has no description
1import Testing
2import Foundation
3
4@Suite("Stream Video Cancellation Tests")
5struct StreamVideoDebugTests {
6 @Test("Stream video command can be cancelled without hanging")
7 func streamVideoBasicExecution() async throws {
8 guard let udid = defaultSimulatorUDID else {
9 throw TestError.commandError("No simulator UDID specified")
10 }
11
12 let axePath = try TestHelpers.getAxePath()
13 let tempURL = FileManager.default.temporaryDirectory
14 .appendingPathComponent("axe-video-debug-\(UUID().uuidString).mp4")
15 defer { try? FileManager.default.removeItem(at: tempURL) }
16
17 let process = Process()
18 process.executableURL = URL(fileURLWithPath: axePath)
19 process.arguments = [
20 "record-video",
21 "--udid", udid,
22 "--fps", "5",
23 "--output", tempURL.path
24 ]
25 process.standardOutput = Pipe()
26 process.standardError = Pipe()
27
28 try process.run()
29 try await Task.sleep(nanoseconds: 3_000_000_000) // 3 seconds
30
31 process.interrupt()
32 process.waitUntilExit()
33
34 #expect(process.terminationStatus == 0, "Command should exit cleanly after cancellation")
35 }
36}