import XCTest final class WorkspaceUITests: XCTestCase { @MainActor private func reveal(_ element: XCUIElement, in scrollView: XCUIElement) { for _ in 0..<8 { if scrollView.frame.contains(CGPoint(x: element.frame.midX, y: element.frame.midY)), element.isHittable { return } let start = scrollView.coordinate(withNormalizedOffset: CGVector(dx: 0.5, dy: 0.5)) let direction: CGFloat = element.frame.midY > scrollView.frame.midY ? 0.2 : 0.8 let end = scrollView.coordinate(withNormalizedOffset: CGVector(dx: 0.5, dy: direction)) start.press(forDuration: 0.05, thenDragTo: end) } XCTAssertTrue(element.isHittable) } @MainActor func testLauncherKeyboardValidationRotationAndAppearance() { continueAfterFailure = false XCUIDevice.shared.orientation = .portrait let app = XCUIApplication() app.launch() let settings = app.buttons["showServerSettings"] if settings.waitForExistence(timeout: 3) { settings.tap() } let address = app.textFields["serverAddress"] XCTAssertTrue(address.waitForExistence(timeout: 15)) address.tap() let clear = address.buttons.firstMatch if clear.exists { clear.tap() } address.typeText("http://invalid.example") app.buttons["openWorkspace"].tap() XCTAssertTrue(app.staticTexts["connectionStatus"].label.contains("valid HTTPS")) XCUIDevice.shared.orientation = .landscapeLeft let launcher = app.scrollViews["serverSettings"] reveal(address, in: launcher) let open = app.buttons["openWorkspace"] reveal(open, in: launcher) let dark = app.segmentedControls["appearance"].buttons["Dark"] reveal(dark, in: launcher) dark.tap() XCTAssertTrue(dark.isSelected) app.segmentedControls["appearance"].buttons["System"].tap() XCUIDevice.shared.orientation = .portrait } }