mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-25 03:45:46 -06:00
4af09d4961
* feat(ui): unify focused presentation routes /focus/<target> replaces unshipped standalone query links across dashboard, terminal, desktop, and native apps. Gateway-served index assets are anchored so nested documents resolve their bundles from the Control UI base path. * test(gateway): narrow emitted asset URLs Fixes check:test-types TS18048/TS2322 by dropping unmatched optional captures before comparing emitted asset URLs. * test(docs): follow centralized cloud secret guidance Fixes the stale current-main docs test after #126132 centralized GCP and Hetzner setup in docker-vm-runtime. * test(ui): retry missing locator reads The 500ms locator text read can time out while the menu label is still rendering, causing expect.poll to reject instead of using its owning 10s retry window. Treat only Playwright TimeoutError as a missing value so the outer poll retries while page-closure and arbitrary failures still surface. * test(android): capture TLS probe coroutine The TLS probe test inferred its coroutine from mutable scope children, racing unrelated child startup and teardown in CI. Capture the exact Job from inside the probe coroutine and join that owner before asserting the stale-attempt guard. * fix(gateway): preserve plugin focus routes Keep approval handling ahead of plugin dispatch, but treat focus documents as an unclaimed Control UI fallback after plugin authentication and routing. Exact and prefix plugin routes therefore retain ownership, while unclaimed reads serve the focus document and other methods return 404. * fix(ui): migrate released terminal links Preserve stable v2026.7.1 terminal query compatibility by rewriting the root/base ?view=terminal URL once to the canonical /focus/terminal path with history.replace. Keep URL parsing path-only, and leave the removed desktop and dashboard query forms as a hard cut. * test(codex): assign run-attempt tools shard Cached filtered configs caused duplicate ownership, and the test lacked a canonical full-suite owner. * test(ui): keep cloud recovery proof state-owned The recovery test should assert owner state and reload identity, while dedicated tests own transient alert visibility. * test(qa): wait for outbound bus state * fix(qa): reserve gateway ports through staging * refactor(qa): keep socket creation in gateway owner
98 lines
3.8 KiB
Swift
98 lines
3.8 KiB
Swift
import Foundation
|
|
import Testing
|
|
@testable import OpenClaw
|
|
@testable import OpenClawKit
|
|
|
|
@MainActor
|
|
struct DesktopHubScreenTests {
|
|
private static func makeConfig(
|
|
url: URL,
|
|
token: String? = nil,
|
|
password: String? = nil) -> GatewayConnectConfig
|
|
{
|
|
GatewayConnectConfig(
|
|
url: url,
|
|
stableID: "manual|gateway.example.com|443",
|
|
tls: nil,
|
|
token: token,
|
|
bootstrapToken: nil,
|
|
password: password,
|
|
nodeOptions: GatewayConnectOptions(
|
|
role: "node",
|
|
scopes: [],
|
|
caps: [],
|
|
commands: [],
|
|
permissions: [:],
|
|
clientId: "ios",
|
|
clientMode: "node",
|
|
clientDisplayName: "Phone"))
|
|
}
|
|
|
|
@Test func `standalone desktop URL uses document mode without credentials`() throws {
|
|
let config = try Self.makeConfig(
|
|
url: #require(URL(string: "wss://gateway.example.com:8443/openclaw/")),
|
|
token: "secret-token",
|
|
password: "secret-password")
|
|
|
|
let url = DesktopHubScreen.desktopURL(config: config, source: nil, session: nil)
|
|
|
|
#expect(url?.absoluteString == "https://gateway.example.com:8443/openclaw/focus/desktop")
|
|
#expect(url?.absoluteString.contains("secret-token") == false)
|
|
#expect(url?.absoluteString.contains("secret-password") == false)
|
|
}
|
|
|
|
@Test func `session desktop URL includes the session key`() throws {
|
|
let config = try Self.makeConfig(
|
|
url: #require(URL(string: "ws://192.168.1.10:18789")),
|
|
token: "secret-token")
|
|
|
|
let url = DesktopHubScreen.desktopURL(
|
|
config: config,
|
|
source: nil,
|
|
session: "agent:main/mobile session")
|
|
|
|
#expect(
|
|
url?.absoluteString ==
|
|
"http://192.168.1.10:18789/focus/desktop/session/agent%3Amain%2Fmobile%20session")
|
|
#expect(url?.absoluteString.contains("secret-token") == false)
|
|
}
|
|
|
|
@Test func `explicit desktop source wins over the session`() throws {
|
|
let config = try Self.makeConfig(url: #require(URL(string: "wss://gateway.example.com")))
|
|
|
|
let url = DesktopHubScreen.desktopURL(
|
|
config: config,
|
|
source: "node:worker-1/primary?mode=qa",
|
|
session: "agent:main:mobile")
|
|
|
|
#expect(
|
|
url?.absoluteString ==
|
|
"https://gateway.example.com/focus/desktop/source/node%3Aworker-1%2Fprimary%3Fmode%3Dqa")
|
|
}
|
|
|
|
@Test func `empty desktop source and session are normalized away`() throws {
|
|
let config = try Self.makeConfig(url: #require(URL(string: "wss://gateway.example.com")))
|
|
|
|
let url = DesktopHubScreen.desktopURL(config: config, source: " ", session: " ")
|
|
|
|
#expect(url?.absoluteString == "https://gateway.example.com/focus/desktop")
|
|
}
|
|
|
|
@Test func `desktop auth script carries credentials outside the URL`() throws {
|
|
let config = try Self.makeConfig(
|
|
url: #require(URL(string: "wss://gateway.example.com")),
|
|
token: " secret-token ",
|
|
password: "secret-password")
|
|
|
|
let url = DesktopHubScreen.desktopURL(config: config, source: "gateway")
|
|
let script = DesktopHubScreen.desktopAuthUserScript(config: config, source: "gateway")
|
|
|
|
#expect(url?.absoluteString == "https://gateway.example.com/focus/desktop/source/gateway")
|
|
#expect(url?.absoluteString.contains("secret-token") == false)
|
|
#expect(url?.absoluteString.contains("secret-password") == false)
|
|
#expect(script?.contains("__OPENCLAW_NATIVE_CONTROL_AUTH__") == true)
|
|
#expect(script?.contains("\"token\":\"secret-token\"") == true)
|
|
#expect(script?.contains("\"password\":\"secret-password\"") == true)
|
|
}
|
|
}
|