mirror of
https://github.com/hansjone/oclaw.git
synced 2026-10-10 10:20:45 +08:00
同时收敛启动与运维脚本默认行为(含 wiki worker)、更新 Admin 可观测性与相关测试,降低首轮时延并提高运行稳定性。 Made-with: Cursor
61 lines
2.2 KiB
Swift
61 lines
2.2 KiB
Swift
import Foundation
|
|
import OpenClawDiscovery
|
|
import SwiftUI
|
|
import Testing
|
|
@testable import OpenClaw
|
|
|
|
@Suite(.serialized)
|
|
@MainActor
|
|
struct OnboardingViewSmokeTests {
|
|
@Test func `onboarding view builds body`() {
|
|
let state = AppState(preview: true)
|
|
let view = OnboardingView(
|
|
state: state,
|
|
permissionMonitor: PermissionMonitor.shared,
|
|
discoveryModel: GatewayDiscoveryModel(localDisplayName: InstanceIdentity.displayName))
|
|
_ = view.body
|
|
}
|
|
|
|
@Test func `page order omits workspace and identity steps`() {
|
|
let order = OnboardingView.pageOrder(for: .local, showOnboardingChat: false)
|
|
#expect(!order.contains(7))
|
|
#expect(order.contains(3))
|
|
}
|
|
|
|
@Test func `page order omits onboarding chat when identity known`() {
|
|
let order = OnboardingView.pageOrder(for: .local, showOnboardingChat: false)
|
|
#expect(!order.contains(8))
|
|
}
|
|
|
|
@Test func `select remote gateway clears stale ssh target when endpoint unresolved`() async {
|
|
let override = FileManager().temporaryDirectory
|
|
.appendingPathComponent("openclaw-config-\(UUID().uuidString)")
|
|
.appendingPathComponent("openclaw.json")
|
|
.path
|
|
|
|
await TestIsolation.withEnvValues(["OPENCLAW_CONFIG_PATH": override]) {
|
|
let state = AppState(preview: true)
|
|
state.remoteTransport = .ssh
|
|
state.remoteTarget = "user@old-host:2222"
|
|
let view = OnboardingView(
|
|
state: state,
|
|
permissionMonitor: PermissionMonitor.shared,
|
|
discoveryModel: GatewayDiscoveryModel(localDisplayName: InstanceIdentity.displayName))
|
|
let gateway = GatewayDiscoveryModel.DiscoveredGateway(
|
|
displayName: "Unresolved",
|
|
serviceHost: nil,
|
|
servicePort: nil,
|
|
lanHost: "txt-host.local",
|
|
tailnetDns: "txt-host.ts.net",
|
|
sshPort: 22,
|
|
gatewayPort: 18789,
|
|
cliPath: "/tmp/openclaw",
|
|
stableID: UUID().uuidString,
|
|
debugID: UUID().uuidString,
|
|
isLocal: false)
|
|
|
|
view.selectRemoteGateway(gateway)
|
|
#expect(state.remoteTarget.isEmpty)
|
|
}
|
|
}
|
|
}
|