


























@@ -1,3 +1,4 @@
1+import AppKit
12import SwiftUI
23import Testing
34@testable import OpenClaw
@@ -80,6 +81,60 @@ struct SettingsViewSmokeTests {
8081 _ = view.body
8182}
828384+@Test func `cron settings renders in hosting view`() {
85+let store = CronJobsStore(isPreview: true)
86+ store.schedulerEnabled = false
87+ store.jobs = [
88+CronJob(
89+ id: "job-1",
90+ agentId: "ops",
91+ name: "Morning Check-in",
92+ description: "Summary job",
93+ enabled: true,
94+ deleteAfterRun: nil,
95+ createdAtMs: 1_700_000_000_000,
96+ updatedAtMs: 1_700_000_100_000,
97+ schedule: .cron(expr: "0 8 * * *", tz: "UTC"),
98+ sessionTarget: .isolated,
99+ wakeMode: .nextHeartbeat,
100+ payload: .agentTurn(
101+ message: "Summarize",
102+ thinking: "low",
103+ timeoutSeconds: 120,
104+ deliver: nil,
105+ channel: nil,
106+ to: nil,
107+ bestEffortDeliver: nil),
108+ delivery: CronDelivery(mode: .announce, channel: "whatsapp", to: "+15551234567", bestEffort: true),
109+ state: CronJobState(
110+ nextRunAtMs: 1_700_000_200_000,
111+ runningAtMs: nil,
112+ lastRunAtMs: 1_700_000_050_000,
113+ lastStatus: "ok",
114+ lastError: nil,
115+ lastDurationMs: 1200)),
116+]
117+ store.selectedJobId = "job-1"
118+ store.runEntries = [
119+CronRunLogEntry(
120+ ts: 1_700_000_050_000,
121+ jobId: "job-1",
122+ action: "finished",
123+ status: "ok",
124+ error: nil,
125+ summary: "done",
126+ runAtMs: 1_700_000_050_000,
127+ durationMs: 1200,
128+ nextRunAtMs: 1_700_000_200_000),
129+]
130+131+let view = CronSettings(store: store, channelsStore: ChannelsStore(isPreview: true))
132+let hosting = NSHostingView(rootView: view)
133+ hosting.frame = NSRect(x: 0, y: 0, width: 900, height: 700)
134+ hosting.layoutSubtreeIfNeeded()
135+ _ = hosting.fittingSize
136+}
137+83138@Test func `cron settings exercises private views`() {
84139CronSettings.exerciseForTesting()
85140}
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。