Files
openclaw/apps/macos/Sources/OpenClaw/OnboardingView+Testing.swift
Peter Steinberger 96f0983a85 fix(onboarding): skip setup for configured gateways and require inference first (#102883)
* fix(crestodian): keep onboarding RPCs restart-safe

* fix(profiles): isolate approval state migrations

* fix(crestodian): bypass configured gateway setup

* test(crestodian): type onboarding mocks

* fix(onboarding): require inference before Crestodian

* fix(onboarding): enforce verified inference handoff

* fix(macos): reset setup on gateway endpoint edits

* chore(i18n): refresh native source inventory

* fix(gateway): keep socket on request cancellation

* test(packaging): require workspace templates

* fix(onboarding): bind setup to verified inference

* fix(onboarding): align inference gate contracts

* fix(crestodian): classify concurrent policy rejection

* test(crestodian): expect registry restoration

* fix(onboarding): bind setup to configured gateways

* fix(codex): preserve startup phase deadlines

* test(crestodian): match fail-closed policy ordering

* test(onboarding): assert bound gateway handoff

* fix(codex): bind runtime resolution to spawn cwd

* test(crestodian): assert policy rejection order

* fix(cli): preserve gateway routing across restarts

* fix(macos): fail closed during gateway edits

* test(macos): cover gateway route generation races

* chore: keep release notes out of onboarding PR

* fix(ci): refresh onboarding generated checks

* style(swift): align gateway channel formatting

* fix(ci): refresh plugin SDK surface budgets

* fix(ci): resync native string inventory

* refactor(swift): split gateway channel support

* test(doctor): isolate plugin compatibility registry

* test(macos): isolate gateway onboarding fixtures

* test(macos): assert gateway lease health ordering

* fix(codex): reconcile computer-use startup changes
2026-07-11 10:25:14 -07:00

74 lines
2.5 KiB
Swift

import OpenClawDiscovery
import SwiftUI
#if DEBUG
@MainActor
extension OnboardingView {
static func exerciseForTesting() {
let state = AppState(preview: true)
let discovery = GatewayDiscoveryModel(localDisplayName: InstanceIdentity.displayName)
discovery.statusText = "Searching..."
let gateway = GatewayDiscoveryModel.DiscoveredGateway(
displayName: "Test Gateway",
lanHost: "gateway.local",
tailnetDns: "gateway.ts.net",
sshPort: 2222,
gatewayPort: 18789,
cliPath: "/usr/local/bin/openclaw",
stableID: "gateway-1",
debugID: "gateway-1",
isLocal: false)
discovery.gateways = [gateway]
let view = OnboardingView(
state: state,
permissionMonitor: PermissionMonitor.shared,
discoveryModel: discovery)
view.localGatewayProbe = LocalGatewayProbe(
port: GatewayEnvironment.gatewayPort(),
pid: 123,
command: "openclaw-gateway",
expected: true)
view.showAdvancedConnection = true
view.preferredGatewayID = gateway.stableID
view.cliInstalled = true
view.cliInstallLocation = "/usr/local/bin/openclaw"
view.cliStatus = "Installed"
view.state.connectionMode = .local
let contentHeight = view.contentHeight(for: OnboardingView.windowHeight)
_ = view.welcomePage()
_ = view.connectionPage()
_ = view.aiSetupPage(contentHeight: contentHeight)
_ = view.permissionsPage(contentHeight: contentHeight)
_ = view.cliPage()
_ = view.readyPage()
view.selectLocalGateway()
view.selectRemoteGateway(gateway)
view.selectUnconfiguredGateway()
view.state.connectionMode = .remote
_ = view.connectionPage()
view.state.connectionMode = .unconfigured
_ = view.connectionPage()
view.currentPage = 0
view.handleNext()
view.handleBack()
_ = view.onboardingPage { Text("Test") }
_ = view.onboardingCard { Text("Card") }
_ = view.featureRow(title: "Feature", subtitle: "Subtitle", systemImage: "sparkles")
_ = view.featureActionRow(
title: "Action",
subtitle: "Action subtitle",
systemImage: "gearshape",
buttonTitle: "Action",
action: {})
_ = view.gatewaySubtitle(for: gateway)
_ = view.isSelectedGateway(gateway)
}
}
#endif