Compare commits

..
Author SHA1 Message Date
buzzert 7c15357108 fix(ios): restore Quick Question composer behavior
TestFlight / Build and upload (push) Successful in 1m53s
2026-11-17 21:44:44 -08:00
buzzert ea6ee8cc64 feat(ios): submit Quick Question on Return
TestFlight / Build and upload (push) Successful in 1m57s
2026-11-17 20:53:18 -08:00
buzzert 557775af45 fix(ios): align Quick Question composer and selection
TestFlight / Build and upload (push) Successful in 2m12s
2026-11-17 19:55:02 -08:00
buzzert 7333fe03e7 fix(ios): select Quick Question draft on focus
TestFlight / Build and upload (push) Successful in 2m1s
2026-11-16 23:40:12 -08:00
@@ -0,0 +1,91 @@
import XCTest
/// Exercises Quick Question through its real home-screen action and shared SwiftUI field.
@MainActor
final class QuickQuestionSelectionUITests: XCTestCase {
private let app = XCUIApplication()
private let springboard = XCUIApplication(bundleIdentifier: "com.apple.springboard")
override func setUp() async throws {
continueAfterFailure = false
try await control(["action": "reset", "count": 0])
app.launchArguments = [
"-sybil.ios.apiBaseURL", "http://127.0.0.1:8799/api",
"-sybil.ios.adminToken", "fixture-token"
]
}
override func tearDown() async throws {
app.terminate()
}
func testQuickQuestionKeepsKeyboardVisibleAcrossSeparateKeypressesAndStaysCompact() {
app.launch()
openQuickQuestionFromHomeScreen()
let prompt = quickQuestionPrompt()
XCTAssertTrue(prompt.waitForExistence(timeout: 10))
XCTAssertTrue(app.keyboards.firstMatch.waitForExistence(timeout: 10))
XCTAssertLessThan(prompt.frame.height, 80, "Quick Question should retain its original compact single-line field.")
prompt.typeText("a")
XCTAssertTrue(app.keyboards.firstMatch.exists, "Keyboard should remain visible after the first keypress.")
prompt.typeText("b")
XCTAssertTrue(app.keyboards.firstMatch.exists, "Keyboard should remain visible after the second keypress.")
prompt.typeText("c")
XCTAssertTrue(app.keyboards.firstMatch.exists, "Keyboard should remain visible after the third keypress.")
XCTAssertEqual(prompt.value as? String, "abc")
}
func testQuickQuestionReappearanceSelectsRetainedDraftForReplacement() {
app.launch()
openQuickQuestionFromHomeScreen()
let prompt = quickQuestionPrompt()
XCTAssertTrue(prompt.waitForExistence(timeout: 10))
XCTAssertTrue(app.keyboards.firstMatch.waitForExistence(timeout: 10))
prompt.typeText("retained draft")
XCTAssertEqual(prompt.value as? String, "retained draft")
// A second real home-screen Quick Question action advances the existing
// focus request. The original TextSelection binding selects the draft.
openQuickQuestionFromHomeScreen()
XCTAssertTrue(prompt.waitForExistence(timeout: 10))
XCTAssertTrue(app.keyboards.firstMatch.waitForExistence(timeout: 10))
XCTAssertEqual(prompt.value as? String, "retained draft")
prompt.typeText("replacement")
XCTAssertEqual(prompt.value as? String, "replacement")
}
private func quickQuestionPrompt() -> XCUIElement {
app.textFields["Ask anything..."]
}
private func openQuickQuestionFromHomeScreen() {
XCUIDevice.shared.press(.home)
let sybilIcon = springboard.icons.matching(identifier: "Sybil").firstMatch
XCTAssertTrue(sybilIcon.waitForExistence(timeout: 10))
let homeScreen = springboard.otherElements["Home screen icons"]
if !sybilIcon.isHittable, homeScreen.waitForExistence(timeout: 5) {
for _ in 0..<2 where !sybilIcon.isHittable {
homeScreen.swipeLeft()
}
}
XCTAssertTrue(sybilIcon.isHittable, "Navigate to the home-screen page containing Sybil before opening its quick action.")
sybilIcon.press(forDuration: 1.2)
let quickQuestion = springboard.buttons["Quick question"]
XCTAssertTrue(quickQuestion.waitForExistence(timeout: 5))
quickQuestion.tap()
}
private func control(_ body: [String: Any]) async throws {
var request = URLRequest(url: URL(string: "http://127.0.0.1:8799/control")!)
request.httpMethod = "POST"
request.httpBody = try JSONSerialization.data(withJSONObject: body)
request.setValue("application/json", forHTTPHeaderField: "Content-Type")
let (_, response) = try await URLSession.shared.data(for: request)
XCTAssertEqual((response as? HTTPURLResponse)?.statusCode, 200)
}
}