适配上传中订单并完善机巢操作与订阅兜底
支持订单状态 25 和持续拍摄、交付确认;安全指令点击后直接提交;鉴权超时保留 HTTP 兜底并退避换票重连。补充对应隔离回归测试。
This commit is contained in:
@@ -275,7 +275,7 @@ final class DroneDockTaskControlStateViewTests: XCTestCase {
|
||||
XCTAssertFalse(spinner.isAnimating)
|
||||
}
|
||||
|
||||
/// 继续任务的受理不覆盖暂停面板,仅中央按钮加载;返航入口仍能打开确认提示。
|
||||
/// 继续任务待确认时保留暂停面板与独立返航权限,返航可直接提交且不重复发送。
|
||||
func testPendingResumeLoadsOnlyPrimaryAndKeepsReturnAvailable() async throws {
|
||||
let service = try ControlStateViewService(state: "paused")
|
||||
service.confirmsCommand = false
|
||||
@@ -306,14 +306,26 @@ final class DroneDockTaskControlStateViewTests: XCTestCase {
|
||||
XCTAssertTrue(returnButton.isEnabled)
|
||||
capture(window, name: "恢复受理待设备确认-保持暂停(隔离模拟)")
|
||||
returnButton.sendActions(for: .touchUpInside)
|
||||
try await settle(window) { controller.presentedViewController is UIAlertController }
|
||||
XCTAssertEqual((controller.presentedViewController as? UIAlertController)?.actions.compactMap(\.title), ["取消", "模拟返航"])
|
||||
controller.dismiss(animated: false)
|
||||
try await settle(window) { controller.presentedViewController == nil }
|
||||
service.response = try ControlStateViewService.snapshot(state: "executing", version: 3,
|
||||
pendingCommand: service.progress(for: 0, status: "succeeded"))
|
||||
returnButton.sendActions(for: .touchUpInside)
|
||||
XCTAssertNil(controller.presentedViewController, "恢复待确认不会让返航新增确认弹窗")
|
||||
XCTAssertFalse(returnButton.isEnabled)
|
||||
let returnSpinner = try XCTUnwrap(find(in: controller.view, id: "drone.task.remote.return.loading") as? UIActivityIndicatorView)
|
||||
XCTAssertTrue(returnSpinner.isAnimating)
|
||||
try await settle(window) { service.commands.count == 2 && !controller.viewModel.isSendingCommand }
|
||||
XCTAssertEqual(service.commands.map(\.command), [.resume, .returnHome])
|
||||
XCTAssertEqual(Set(service.commands.map(\.clientRequestID)).count, 2)
|
||||
XCTAssertTrue(service.commands.allSatisfy { $0.taskID == 501 })
|
||||
XCTAssertTrue(controller.viewModel.isCommandLoading(.returnHome))
|
||||
XCTAssertFalse(controller.viewModel.isCommandLoading(.resume), "后受理返航替代旧的继续意图")
|
||||
XCTAssertEqual(controller.viewModel.presentation.phase, .paused, "受理本身不替代完整设备快照")
|
||||
XCTAssertNil(controller.presentedViewController)
|
||||
service.response = try ControlStateViewService.snapshot(state: "returning", version: 3,
|
||||
pendingCommand: service.progress(for: 1, status: "succeeded"))
|
||||
try tapNavigationRefresh(controller)
|
||||
try await settle(window) { controller.viewModel.presentation.phase == .shooting && !controller.viewModel.isCommandLoading(.resume) }
|
||||
try await settle(window) { controller.viewModel.presentation.phase == .returning && !controller.viewModel.isCommandLoading(.returnHome) }
|
||||
XCTAssertFalse(returnSpinner.isAnimating)
|
||||
XCTAssertFalse(returnButton.isEnabled)
|
||||
XCTAssertEqual(service.commands.count, 2)
|
||||
XCTAssertFalse(visibleTexts(in: controller.view).contains("指令已受理"))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user