mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-12 21:53:00 -06:00
test(macos): remove body-only smoke probes (#122645)
This commit is contained in:
committed by
GitHub
parent
189ce7537e
commit
f9f602a0df
@@ -33081,14 +33081,6 @@
|
||||
"surface": "apple",
|
||||
"id": "native.apple.2a5e0e9e073b8db1"
|
||||
},
|
||||
{
|
||||
"kind": "ui-modifier",
|
||||
"line": 115,
|
||||
"path": "apps/macos/Sources/OpenClaw/GatewayDiscoveryMenu.swift",
|
||||
"source": "Discover OpenClaw gateways on your LAN",
|
||||
"surface": "apple",
|
||||
"id": "native.apple.66ad783199ef9729"
|
||||
},
|
||||
{
|
||||
"kind": "conditional-branch",
|
||||
"line": 220,
|
||||
|
||||
@@ -94,24 +94,3 @@ struct GatewayDiscoveryInlineList: View {
|
||||
value?.trimmingCharacters(in: .whitespacesAndNewlines) ?? ""
|
||||
}
|
||||
}
|
||||
|
||||
struct GatewayDiscoveryMenu: View {
|
||||
var discovery: GatewayDiscoveryModel
|
||||
var onSelect: (GatewayDiscoveryModel.DiscoveredGateway) -> Void
|
||||
|
||||
var body: some View {
|
||||
Menu {
|
||||
if self.discovery.gateways.isEmpty {
|
||||
Button(self.discovery.statusText) {}
|
||||
.disabled(true)
|
||||
} else {
|
||||
ForEach(self.discovery.gateways) { gateway in
|
||||
Button(gateway.displayName) { self.onSelect(gateway) }
|
||||
}
|
||||
}
|
||||
} label: {
|
||||
Image(systemName: "dot.radiowaves.left.and.right")
|
||||
}
|
||||
.help("Discover OpenClaw gateways on your LAN")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import Foundation
|
||||
import OpenClawProtocol
|
||||
import SwiftUI
|
||||
import Testing
|
||||
@testable import OpenClaw
|
||||
|
||||
@@ -41,122 +41,6 @@ private func makeChannelsStore(
|
||||
@Suite(.serialized)
|
||||
@MainActor
|
||||
struct ChannelsSettingsSmokeTests {
|
||||
@Test func `channels settings builds body with snapshot`() {
|
||||
let store = makeChannelsStore(
|
||||
channels: [
|
||||
"whatsapp": SnapshotAnyCodable([
|
||||
"configured": true,
|
||||
"linked": true,
|
||||
"authAgeMs": 86_400_000,
|
||||
"self": ["e164": "+15551234567"],
|
||||
"running": true,
|
||||
"connected": false,
|
||||
"lastConnectedAt": 1_700_000_000_000,
|
||||
"lastDisconnect": [
|
||||
"at": 1_700_000_050_000,
|
||||
"status": 401,
|
||||
"error": "logged out",
|
||||
"loggedOut": true,
|
||||
],
|
||||
"reconnectAttempts": 2,
|
||||
"lastMessageAt": 1_700_000_060_000,
|
||||
"lastEventAt": 1_700_000_060_000,
|
||||
"lastError": "needs login",
|
||||
]),
|
||||
"telegram": SnapshotAnyCodable([
|
||||
"configured": true,
|
||||
"tokenSource": "env",
|
||||
"running": true,
|
||||
"mode": "polling",
|
||||
"lastStartAt": 1_700_000_000_000,
|
||||
"probe": [
|
||||
"ok": true,
|
||||
"status": 200,
|
||||
"elapsedMs": 120,
|
||||
"bot": ["id": 123, "username": "openclawbot"],
|
||||
"webhook": ["url": "https://example.com/hook", "hasCustomCert": false],
|
||||
],
|
||||
"lastProbeAt": 1_700_000_050_000,
|
||||
]),
|
||||
"signal": SnapshotAnyCodable([
|
||||
"configured": true,
|
||||
"baseUrl": "http://127.0.0.1:8080",
|
||||
"running": true,
|
||||
"lastStartAt": 1_700_000_000_000,
|
||||
"probe": [
|
||||
"ok": true,
|
||||
"status": 200,
|
||||
"elapsedMs": 140,
|
||||
"version": "0.12.4",
|
||||
],
|
||||
"lastProbeAt": 1_700_000_050_000,
|
||||
]),
|
||||
"imessage": SnapshotAnyCodable([
|
||||
"configured": false,
|
||||
"running": false,
|
||||
"lastError": "not configured",
|
||||
"probe": ["ok": false, "error": "imsg not found (imsg)"],
|
||||
"lastProbeAt": 1_700_000_050_000,
|
||||
]),
|
||||
])
|
||||
|
||||
store.whatsappLoginMessage = "Scan QR"
|
||||
store.whatsappLoginQrDataUrl =
|
||||
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMB/ay7pS8AAAAASUVORK5CYII="
|
||||
|
||||
let view = ChannelsSettings(store: store)
|
||||
_ = view.body
|
||||
}
|
||||
|
||||
@Test func `channels settings builds body without snapshot`() {
|
||||
let store = makeChannelsStore(
|
||||
channels: [
|
||||
"whatsapp": SnapshotAnyCodable([
|
||||
"configured": false,
|
||||
"linked": false,
|
||||
"running": false,
|
||||
"connected": false,
|
||||
"reconnectAttempts": 0,
|
||||
]),
|
||||
"telegram": SnapshotAnyCodable([
|
||||
"configured": false,
|
||||
"running": false,
|
||||
"lastError": "bot missing",
|
||||
"probe": [
|
||||
"ok": false,
|
||||
"status": 403,
|
||||
"error": "unauthorized",
|
||||
"elapsedMs": 120,
|
||||
],
|
||||
"lastProbeAt": 1_700_000_100_000,
|
||||
]),
|
||||
"signal": SnapshotAnyCodable([
|
||||
"configured": false,
|
||||
"baseUrl": "http://127.0.0.1:8080",
|
||||
"running": false,
|
||||
"lastError": "not configured",
|
||||
"probe": [
|
||||
"ok": false,
|
||||
"status": 404,
|
||||
"error": "unreachable",
|
||||
"elapsedMs": 200,
|
||||
],
|
||||
"lastProbeAt": 1_700_000_200_000,
|
||||
]),
|
||||
"imessage": SnapshotAnyCodable([
|
||||
"configured": false,
|
||||
"running": false,
|
||||
"lastError": "not configured",
|
||||
"cliPath": "imsg",
|
||||
"probe": ["ok": false, "error": "imsg not found (imsg)"],
|
||||
"lastProbeAt": 1_700_000_200_000,
|
||||
]),
|
||||
])
|
||||
|
||||
let view = ChannelsSettings(store: store)
|
||||
_ = view.body
|
||||
}
|
||||
|
||||
@Test func `whatsapp login wait result keeps latest qr until connected`() {
|
||||
let store = makeChannelsStore(channels: [:])
|
||||
store.whatsappLoginQrDataUrl = "data:image/png;base64,initial"
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
import Testing
|
||||
@testable import OpenClaw
|
||||
|
||||
@MainActor
|
||||
struct ClawHubSkillsBrowserSmokeTests {
|
||||
@Test func `ClawHub browser builds guarded review flow`() {
|
||||
let view = ClawHubSkillsBrowser(installedSkills: [], onInstalled: { _ in })
|
||||
_ = view.body
|
||||
}
|
||||
}
|
||||
@@ -15,17 +15,7 @@ struct CronJobEditorSmokeTests {
|
||||
onSave: { _ in })
|
||||
}
|
||||
|
||||
@Test func `status pill builds body`() {
|
||||
_ = StatusPill(text: "ok", tint: .green).body
|
||||
_ = StatusPill(text: "disabled", tint: .secondary).body
|
||||
}
|
||||
|
||||
@Test func `cron job editor builds body for new job`() {
|
||||
let view = self.makeEditor()
|
||||
_ = view.body
|
||||
}
|
||||
|
||||
@Test func `cron job editor builds body for existing job`() {
|
||||
@Test func `cron job editor preserves advanced delivery routes`() {
|
||||
let channelsStore = ChannelsStore(isPreview: true)
|
||||
let job = CronJob(
|
||||
id: "job-1",
|
||||
@@ -72,8 +62,6 @@ struct CronJobEditorSmokeTests {
|
||||
lastDurationMs: 1000))
|
||||
|
||||
let view = self.makeEditor(job: job, channelsStore: channelsStore)
|
||||
_ = view.body
|
||||
|
||||
let delivery = view.buildDelivery()
|
||||
#expect(delivery["threadId"] as? Int == 42)
|
||||
#expect((delivery["completionDestination"] as? [String: Any])?["to"] as? String ==
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
import Testing
|
||||
@testable import OpenClaw
|
||||
|
||||
@Suite(.serialized)
|
||||
@MainActor
|
||||
struct InstancesSettingsSmokeTests {
|
||||
@Test func `instances settings builds body with multiple instances`() {
|
||||
let store = InstancesStore(isPreview: true)
|
||||
store.statusMessage = "Loaded"
|
||||
store.instances = [
|
||||
InstanceInfo(
|
||||
id: "macbook",
|
||||
host: "macbook-pro",
|
||||
ip: "10.0.0.2",
|
||||
version: "1.2.3",
|
||||
platform: "macOS 15.1",
|
||||
deviceFamily: "Mac",
|
||||
modelIdentifier: "MacBookPro18,1",
|
||||
lastInputSeconds: 15,
|
||||
mode: "local",
|
||||
reason: "heartbeat",
|
||||
text: "MacBook Pro local",
|
||||
ts: 1_700_000_000_000),
|
||||
InstanceInfo(
|
||||
id: "android",
|
||||
host: "pixel",
|
||||
ip: "10.0.0.3",
|
||||
version: "2.0.0",
|
||||
platform: "Android 14",
|
||||
deviceFamily: "Android",
|
||||
modelIdentifier: nil,
|
||||
lastInputSeconds: 120,
|
||||
mode: "node",
|
||||
reason: "presence",
|
||||
text: "Android node",
|
||||
ts: 1_700_000_100_000),
|
||||
InstanceInfo(
|
||||
id: "gateway",
|
||||
host: "gateway",
|
||||
ip: "10.0.0.4",
|
||||
version: "3.0.0",
|
||||
platform: "iOS 18",
|
||||
deviceFamily: nil,
|
||||
modelIdentifier: nil,
|
||||
lastInputSeconds: nil,
|
||||
mode: "gateway",
|
||||
reason: "gateway",
|
||||
text: "Gateway",
|
||||
ts: 1_700_000_200_000),
|
||||
]
|
||||
|
||||
let view = InstancesSettings(store: store)
|
||||
_ = view.body
|
||||
}
|
||||
}
|
||||
@@ -1,78 +0,0 @@
|
||||
import OpenClawDiscovery
|
||||
import SwiftUI
|
||||
import Testing
|
||||
@testable import OpenClaw
|
||||
|
||||
@Suite(.serialized)
|
||||
@MainActor
|
||||
struct MasterDiscoveryMenuSmokeTests {
|
||||
@Test func `inline list builds body when empty`() {
|
||||
let discovery = GatewayDiscoveryModel(localDisplayName: InstanceIdentity.displayName)
|
||||
discovery.statusText = "Searching…"
|
||||
discovery.gateways = []
|
||||
|
||||
let view = GatewayDiscoveryInlineList(
|
||||
discovery: discovery,
|
||||
currentTarget: nil,
|
||||
currentUrl: nil,
|
||||
transport: .ssh,
|
||||
onSelect: { _ in })
|
||||
_ = view.body
|
||||
}
|
||||
|
||||
@Test func `inline list builds body with master and selection`() {
|
||||
let discovery = GatewayDiscoveryModel(localDisplayName: InstanceIdentity.displayName)
|
||||
discovery.statusText = "Found 1"
|
||||
discovery.gateways = [
|
||||
GatewayDiscoveryModel.DiscoveredGateway(
|
||||
displayName: "Office Mac",
|
||||
lanHost: "office.local",
|
||||
tailnetDns: "office.tailnet-123.ts.net",
|
||||
sshPort: 2222,
|
||||
gatewayPort: nil,
|
||||
cliPath: nil,
|
||||
stableID: "office",
|
||||
debugID: "office",
|
||||
isLocal: false),
|
||||
]
|
||||
|
||||
let currentTarget = "\(NSUserName())@office.tailnet-123.ts.net:2222"
|
||||
let view = GatewayDiscoveryInlineList(
|
||||
discovery: discovery,
|
||||
currentTarget: currentTarget,
|
||||
currentUrl: nil,
|
||||
transport: .ssh,
|
||||
onSelect: { _ in })
|
||||
_ = view.body
|
||||
}
|
||||
|
||||
@Test func `menu builds body with masters`() {
|
||||
let discovery = GatewayDiscoveryModel(localDisplayName: InstanceIdentity.displayName)
|
||||
discovery.statusText = "Found 2"
|
||||
discovery.gateways = [
|
||||
GatewayDiscoveryModel.DiscoveredGateway(
|
||||
displayName: "A",
|
||||
lanHost: "a.local",
|
||||
tailnetDns: nil,
|
||||
sshPort: 22,
|
||||
gatewayPort: nil,
|
||||
cliPath: nil,
|
||||
stableID: "a",
|
||||
debugID: "a",
|
||||
isLocal: false),
|
||||
GatewayDiscoveryModel.DiscoveredGateway(
|
||||
displayName: "B",
|
||||
lanHost: nil,
|
||||
tailnetDns: "b.ts.net",
|
||||
sshPort: 22,
|
||||
gatewayPort: nil,
|
||||
cliPath: nil,
|
||||
stableID: "b",
|
||||
debugID: "b",
|
||||
isLocal: false),
|
||||
]
|
||||
|
||||
let view = GatewayDiscoveryMenu(discovery: discovery, onSelect: { _ in })
|
||||
_ = view.body
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
import AppKit
|
||||
import SwiftUI
|
||||
import Testing
|
||||
@testable import OpenClaw
|
||||
|
||||
@@ -10,40 +9,6 @@ struct MenuContentSmokeTests {
|
||||
#expect(AppTerminationTiming.cleanupDeadlineSeconds < AppTerminationTiming.signalExitFailsafeSeconds)
|
||||
}
|
||||
|
||||
@Test func `menu content builds body local mode`() {
|
||||
let state = AppState(preview: true)
|
||||
state.connectionMode = .local
|
||||
let view = MenuContent(state: state, updater: nil)
|
||||
_ = view.body
|
||||
}
|
||||
|
||||
@Test func `menu content builds body remote mode`() {
|
||||
let state = AppState(preview: true)
|
||||
state.connectionMode = .remote
|
||||
let view = MenuContent(state: state, updater: nil)
|
||||
_ = view.body
|
||||
}
|
||||
|
||||
@Test func `menu content builds body unconfigured mode`() {
|
||||
let state = AppState(preview: true)
|
||||
state.connectionMode = .unconfigured
|
||||
let view = MenuContent(state: state, updater: nil)
|
||||
_ = view.body
|
||||
}
|
||||
|
||||
@Test func `menu content builds body with debug and canvas`() {
|
||||
let state = AppState(preview: true)
|
||||
state.connectionMode = .local
|
||||
state.debugPaneEnabled = true
|
||||
state.canvasEnabled = true
|
||||
state.canvasPanelVisible = true
|
||||
state.swabbleEnabled = true
|
||||
state.voicePushToTalkEnabled = true
|
||||
state.heartbeatsEnabled = true
|
||||
let view = MenuContent(state: state, updater: nil)
|
||||
_ = view.body
|
||||
}
|
||||
|
||||
@Test func `dock menu exposes primary shortcuts`() throws {
|
||||
let delegate = AppDelegate()
|
||||
let menu = try #require(delegate.applicationDockMenu(NSApplication.shared))
|
||||
|
||||
@@ -3,7 +3,6 @@ import Foundation
|
||||
import OpenClawDiscovery
|
||||
import OpenClawIPC
|
||||
import OpenClawKit
|
||||
import SwiftUI
|
||||
import Testing
|
||||
@testable import OpenClaw
|
||||
|
||||
@@ -41,14 +40,6 @@ struct OnboardingViewSmokeTests {
|
||||
"2 gateways found on your network — click to choose one.")
|
||||
}
|
||||
|
||||
@Test func `onboarding view builds body`() {
|
||||
let state = AppState(preview: true)
|
||||
let view = OnboardingView(
|
||||
state: state,
|
||||
discoveryModel: GatewayDiscoveryModel(localDisplayName: InstanceIdentity.displayName))
|
||||
_ = view.body
|
||||
}
|
||||
|
||||
@Test func `foreign local listener is not advertised as attachable`() {
|
||||
let profile = AppProfile(environment: ["OPENCLAW_PROFILE": "p2380"])
|
||||
let foreign = OnboardingView.LocalGatewayProbe(
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
import OpenClawProtocol
|
||||
import SwiftUI
|
||||
import Testing
|
||||
@testable import OpenClaw
|
||||
|
||||
@Suite(.serialized)
|
||||
@MainActor
|
||||
struct QuickChatViewSmokeTests {
|
||||
@Test func `quick chat view builds body`() {
|
||||
let model = QuickChatModel(
|
||||
sessionKeyProvider: { "main" },
|
||||
agentsProvider: {
|
||||
AgentsListResult(
|
||||
defaultid: "main",
|
||||
mainkey: "main",
|
||||
scope: AnyCodable("per-agent"),
|
||||
agents: [AgentSummary(id: "main", name: "Agent")])
|
||||
},
|
||||
agentIdentityProvider: { _ in QuickChatAgentDisplay(id: "main", name: "Agent", emoji: nil) },
|
||||
sendProvider: { _, _, _, _, _, _ in "ok" },
|
||||
permissionStatusProvider: { capabilities in
|
||||
Dictionary(uniqueKeysWithValues: capabilities.map { ($0, true) })
|
||||
},
|
||||
permissionGrantProvider: { capabilities in
|
||||
Dictionary(uniqueKeysWithValues: capabilities.map { ($0, true) })
|
||||
},
|
||||
connectionGateProvider: { .available },
|
||||
modelControlsProvider: { _ in .testFixture },
|
||||
modelPatchProvider: { _, _ in nil })
|
||||
let view = QuickChatView(
|
||||
model: model,
|
||||
replyBinding: QuickChatReplyBinding(),
|
||||
onDismiss: {},
|
||||
onSendAccepted: { _ in },
|
||||
onShowAgentPicker: {},
|
||||
onShowModelMenu: {},
|
||||
onShowRecentSessions: {},
|
||||
onToggleDictation: {},
|
||||
onStopDictation: {},
|
||||
onCaptureTextContext: {},
|
||||
onShowCaptureMenu: {},
|
||||
onGrantPermissions: {},
|
||||
onPasteReply: {},
|
||||
onContentHeightChange: { _ in },
|
||||
onTextViewReady: { _ in })
|
||||
|
||||
_ = view.body
|
||||
}
|
||||
}
|
||||
@@ -60,22 +60,6 @@ struct SettingsViewSmokeTests {
|
||||
_ = hosting.fittingSize
|
||||
}
|
||||
|
||||
@Test func `config settings builds body`() {
|
||||
let view = ConfigSettings()
|
||||
_ = view.body
|
||||
}
|
||||
|
||||
@Test func `debug settings builds body`() {
|
||||
let view = DebugSettings()
|
||||
_ = view.body
|
||||
}
|
||||
|
||||
@Test func `connection settings builds body`() {
|
||||
let state = AppState(preview: true)
|
||||
let view = GeneralSettings(state: state, page: .connection)
|
||||
_ = view.body
|
||||
}
|
||||
|
||||
@Test func `general settings renders the keyboard shortcut recorder`() {
|
||||
let state = AppState(preview: true)
|
||||
let hosting = NSHostingView(rootView: GeneralSettings(state: state))
|
||||
@@ -84,41 +68,10 @@ struct SettingsViewSmokeTests {
|
||||
_ = hosting.fittingSize
|
||||
}
|
||||
|
||||
@Test func `sessions settings builds body`() {
|
||||
let view = SessionsSettings(rows: SessionRow.previewRows, isPreview: true)
|
||||
_ = view.body
|
||||
}
|
||||
|
||||
@Test func `permissions settings builds body`() {
|
||||
let state = AppState(preview: true)
|
||||
let view = PermissionsSettings(
|
||||
state: state,
|
||||
status: [
|
||||
.notifications: .granted,
|
||||
.screenRecording: .notGranted,
|
||||
],
|
||||
refresh: {},
|
||||
showOnboarding: {})
|
||||
_ = view.body
|
||||
}
|
||||
|
||||
@Test func `settings root view builds body`() {
|
||||
let state = AppState(preview: true)
|
||||
let view = SettingsRootView(state: state, updater: nil, initialTab: .general)
|
||||
_ = view.body
|
||||
}
|
||||
|
||||
@Test func `Gateway settings is visible and builds body`() throws {
|
||||
@Test func `Gateway settings is visible`() {
|
||||
let tabs = SettingsTabGroup.defaultGroups(showDebug: false, showSystemAgent: false)
|
||||
.flatMap(\.tabs)
|
||||
#expect(tabs.contains(.gateways))
|
||||
|
||||
let profile = try MacGatewayProfile(
|
||||
id: "studio",
|
||||
name: "Studio",
|
||||
url: #require(URL(string: "wss://studio.example")))
|
||||
let view = GatewaySettings(profiles: [profile], isPreview: true)
|
||||
_ = view.body
|
||||
}
|
||||
|
||||
@Test func `OpenClaw settings require configured inference`() {
|
||||
@@ -197,25 +150,4 @@ struct SettingsViewSmokeTests {
|
||||
previousGatewayID: directA,
|
||||
currentGatewayID: directB) == .init(clearsPrevious: true, resetsSystemAgent: true))
|
||||
}
|
||||
|
||||
@Test func `about settings builds body`() {
|
||||
let view = AboutSettings(updater: nil)
|
||||
_ = view.body
|
||||
}
|
||||
|
||||
@Test func `voice wake settings builds body`() {
|
||||
let state = AppState(preview: true)
|
||||
let view = VoiceWakeSettings(state: state, isActive: false)
|
||||
_ = view.body
|
||||
}
|
||||
|
||||
@Test func `skills settings builds body`() {
|
||||
let view = SkillsSettings(state: .preview)
|
||||
_ = view.body
|
||||
}
|
||||
|
||||
@Test func `exec approvals settings builds body`() {
|
||||
let view = ExecApprovalsSettings()
|
||||
_ = view.body
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
import SwiftUI
|
||||
import Testing
|
||||
@testable import OpenClaw
|
||||
|
||||
@Suite(.serialized)
|
||||
@MainActor
|
||||
struct VoiceWakeOverlayViewSmokeTests {
|
||||
@Test func `overlay view builds body in display mode`() {
|
||||
let controller = VoiceWakeOverlayController(enableUI: false)
|
||||
_ = controller.startSession(source: .wakeWord, transcript: "hello", forwardEnabled: true)
|
||||
let view = VoiceWakeOverlayView(controller: controller)
|
||||
_ = view.body
|
||||
}
|
||||
|
||||
@Test func `overlay view builds body in editing mode`() {
|
||||
let controller = VoiceWakeOverlayController(enableUI: false)
|
||||
let token = controller.startSession(source: .pushToTalk, transcript: "edit me", forwardEnabled: true)
|
||||
controller.userBeganEditing()
|
||||
controller.updateLevel(token: token, 0.6)
|
||||
let view = VoiceWakeOverlayView(controller: controller)
|
||||
_ = view.body
|
||||
}
|
||||
|
||||
@Test func `close button overlay builds body`() {
|
||||
let view = CloseButtonOverlay(isVisible: true, onHover: { _ in }, onClose: {})
|
||||
_ = view.body
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user