feat: consolidate iOS with API and web preserving history
Rebuild & Deploy / rebuild (push) Failing after 23s
Rebuild & Deploy / rebuild (push) Failing after 23s
This commit is contained in:
commit
d735ee72fa
102 files changed
+13077
-258
No files matched your search
@@ -0,0 +1,94 @@
|
||||
import XCTest
|
||||
|
||||
final class ChatUITests: XCTestCase {
|
||||
func testNativeTextChatWithoutVoiceAndAccountPrivacy() {
|
||||
let app = XCUIApplication()
|
||||
app.launchArguments = ["--ui-testing", "--reset-ui-testing", "--ui-chat", "-UIPreferredContentSizeCategoryName", "UICTContentSizeCategoryL"]
|
||||
app.launch()
|
||||
XCTAssertTrue(app.navigationBars["Chats"].waitForExistence(timeout: 10))
|
||||
app.buttons["New chat"].tap()
|
||||
let field = app.textFields["chat-draft"]
|
||||
XCTAssertTrue(field.waitForExistence(timeout: 10))
|
||||
field.tap(); field.typeText("Native offline text")
|
||||
app.buttons["Send message"].tap()
|
||||
XCTAssertTrue(app.staticTexts["Native offline text"].waitForExistence(timeout: 10))
|
||||
XCTAssertTrue(app.staticTexts["Offline reply"].exists)
|
||||
app.swipeDown()
|
||||
capture(app, "Native chat standard Opal")
|
||||
XCTAssertFalse(app.buttons["End conversation"].exists)
|
||||
app.navigationBars.buttons.element(boundBy: 0).tap()
|
||||
app.buttons["Chat options"].tap()
|
||||
app.buttons["Sign out"].tap()
|
||||
XCTAssertTrue(app.secureTextFields["Password"].waitForExistence(timeout: 10))
|
||||
XCTAssertFalse(app.staticTexts["Native offline text"].exists)
|
||||
}
|
||||
func testOfflineAdvancedLibraryAndArtifactEditor() {
|
||||
let app = XCUIApplication()
|
||||
app.launchArguments = ["--ui-testing", "--reset-ui-testing", "--ui-chat", "-UIPreferredContentSizeCategoryName", "UICTContentSizeCategoryL"]
|
||||
app.launch()
|
||||
XCTAssertTrue(app.buttons["Chat options"].waitForExistence(timeout: 10))
|
||||
app.buttons["Chat options"].tap(); app.buttons["Library and tools"].tap()
|
||||
XCTAssertTrue(app.buttons["New artifact"].waitForExistence(timeout: 10))
|
||||
app.buttons["New artifact"].tap()
|
||||
XCTAssertTrue(app.textFields["Title"].waitForExistence(timeout: 10))
|
||||
app.textFields["Title"].tap(); app.textFields["Title"].typeText("Local artifact")
|
||||
app.textViews.firstMatch.tap(); app.textViews.firstMatch.typeText("Native fixture content")
|
||||
app.buttons["Save"].tap()
|
||||
let artifact = app.buttons.matching(NSPredicate(format: "label CONTAINS 'Local artifact'")).firstMatch
|
||||
XCTAssertTrue(artifact.waitForExistence(timeout: 10))
|
||||
artifact.tap()
|
||||
XCTAssertTrue(app.textViews.firstMatch.waitForExistence(timeout: 10))
|
||||
XCTAssertEqual(app.textViews.firstMatch.value as? String, "Native fixture content")
|
||||
capture(app, "Native artifact")
|
||||
app.buttons["Cancel"].tap()
|
||||
app.buttons["Done"].tap()
|
||||
}
|
||||
private func capture(_ app: XCUIApplication, _ name: String) {
|
||||
let attachment = XCTAttachment(screenshot: app.screenshot()); attachment.name = name; attachment.lifetime = .keepAlways; add(attachment)
|
||||
}
|
||||
func testWorkspaceNativeFixture() {
|
||||
let app = XCUIApplication()
|
||||
app.launchArguments = ["--ui-testing", "--reset-ui-testing", "--ui-chat", "-UIPreferredContentSizeCategoryName", "UICTContentSizeCategoryL"]
|
||||
app.launch()
|
||||
XCTAssertTrue(app.buttons["Chat options"].waitForExistence(timeout: 10))
|
||||
app.buttons["Chat options"].tap(); app.buttons["Manage workspaces"].tap()
|
||||
let field = app.textFields["Workspace name"]
|
||||
XCTAssertTrue(field.waitForExistence(timeout: 10)); field.tap(); field.typeText("Writing")
|
||||
app.buttons["Save workspace"].tap()
|
||||
XCTAssertTrue(app.buttons["Writing"].waitForExistence(timeout: 10))
|
||||
capture(app, "Native workspaces")
|
||||
}
|
||||
func testStandardDarkChatScreenshot() {
|
||||
let app = XCUIApplication()
|
||||
app.launchArguments = ["--ui-testing", "--reset-ui-testing", "--ui-chat", "-UIPreferredContentSizeCategoryName", "UICTContentSizeCategoryL"]
|
||||
app.launch()
|
||||
XCTAssertTrue(app.buttons["Chat options"].waitForExistence(timeout: 10))
|
||||
app.buttons["Chat options"].tap(); app.buttons["Appearance and model"].tap()
|
||||
app.buttons.matching(NSPredicate(format: "label CONTAINS 'Appearance' AND label CONTAINS 'System'")).firstMatch.tap(); app.buttons["Dark"].tap()
|
||||
app.buttons["Save appearance"].tap(); app.buttons["Done"].tap()
|
||||
capture(app, "Native chat list dark standard")
|
||||
app.buttons["New chat"].tap()
|
||||
let field = app.textFields["chat-draft"]
|
||||
XCTAssertTrue(field.waitForExistence(timeout: 10)); field.tap(); field.typeText("Dark mode fixture")
|
||||
app.buttons["Send message"].tap()
|
||||
XCTAssertTrue(app.staticTexts["Offline reply"].waitForExistence(timeout: 10))
|
||||
app.swipeDown()
|
||||
capture(app, "Native chat dark standard")
|
||||
}
|
||||
func testChatLargeTextAndPreferences() {
|
||||
let app = XCUIApplication()
|
||||
app.launchArguments = ["--ui-testing", "--reset-ui-testing", "--ui-chat", "-UIPreferredContentSizeCategoryName", "UICTContentSizeCategoryAccessibilityXXXL"]
|
||||
app.launch()
|
||||
XCTAssertTrue(app.buttons["New chat"].waitForExistence(timeout: 10))
|
||||
app.buttons["Chat options"].tap()
|
||||
app.buttons["Appearance and model"].tap()
|
||||
XCTAssertTrue(app.navigationBars["Chat preferences"].waitForExistence(timeout: 10))
|
||||
XCTAssertTrue(app.buttons["Save appearance"].exists)
|
||||
capture(app, "Appearance accessibility size")
|
||||
app.buttons["Done"].tap()
|
||||
app.tabBars.buttons["Talk"].tap()
|
||||
XCTAssertTrue(app.buttons["Start chatting"].waitForExistence(timeout: 10))
|
||||
app.tabBars.buttons["Activity"].tap()
|
||||
XCTAssertTrue(app.staticTexts["No tasks yet"].waitForExistence(timeout: 15))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
import XCTest
|
||||
|
||||
/// Opt-in tests against the actual NAS deployment. No injected replies.
|
||||
final class VoiceLiveTests: XCTestCase {
|
||||
private var app: XCUIApplication!
|
||||
|
||||
override func record(_ issue: XCTIssue) {
|
||||
if let app, app.state == .runningForeground {
|
||||
capture("Failure state")
|
||||
let hierarchy = XCTAttachment(string: app.debugDescription)
|
||||
hierarchy.name = "Failure UI hierarchy"
|
||||
hierarchy.lifetime = .keepAlways
|
||||
add(hierarchy)
|
||||
}
|
||||
super.record(issue)
|
||||
}
|
||||
|
||||
override func tearDownWithError() throws {
|
||||
app?.terminate()
|
||||
}
|
||||
|
||||
override func setUpWithError() throws {
|
||||
try XCTSkipUnless(ProcessInfo.processInfo.environment["HOPE_RUN_LIVE_TESTS"] == "1", "Requires the live Hope server")
|
||||
continueAfterFailure = false
|
||||
app = XCUIApplication()
|
||||
app.launchArguments = ["--ui-testing", "--reset-ui-testing", "--live-testing"]
|
||||
app.launch()
|
||||
}
|
||||
|
||||
func testLiveConversationAndBackgroundTask() {
|
||||
app.buttons["Start chatting"].tap()
|
||||
let composer = app.descendants(matching: .any).matching(identifier: "Message Hope").firstMatch
|
||||
XCTAssertTrue(composer.waitForExistence(timeout: 60), "Agent must join the real LiveKit room")
|
||||
composer.tap()
|
||||
composer.typeText("What is six times seven? Reply in one short sentence.")
|
||||
app.buttons["Send message"].tap()
|
||||
let reply = app.staticTexts.matching(NSPredicate(format: "label CONTAINS[c] 'forty-two' OR label CONTAINS[c] 'forty two' OR label CONTAINS '42'")).firstMatch
|
||||
XCTAssertTrue(reply.waitForExistence(timeout: 60), "Qwen must produce a real response")
|
||||
capture("Live Qwen reply")
|
||||
|
||||
composer.tap()
|
||||
composer.typeText("Compare espresso and filter coffee in a short background task. Use your existing knowledge; no web search needed.")
|
||||
app.buttons["Send message"].tap()
|
||||
app.tabBars.buttons["Activity"].tap()
|
||||
let complete = app.staticTexts["Complete"].firstMatch
|
||||
XCTAssertTrue(complete.waitForExistence(timeout: 90), "Background task must finish and deliver its result")
|
||||
capture("Live background result")
|
||||
app.tabBars.buttons["Talk"].tap()
|
||||
app.buttons["End conversation"].tap()
|
||||
XCTAssertTrue(app.buttons["Start chatting"].waitForExistence(timeout: 20))
|
||||
// A second room must connect cleanly after the first was torn down.
|
||||
app.buttons["Start chatting"].tap()
|
||||
XCTAssertTrue(composer.waitForExistence(timeout: 60))
|
||||
app.buttons["End conversation"].tap()
|
||||
XCTAssertTrue(app.buttons["Start chatting"].waitForExistence(timeout: 20))
|
||||
}
|
||||
|
||||
private func capture(_ name: String) {
|
||||
let attachment = XCTAttachment(screenshot: app.screenshot())
|
||||
attachment.name = name
|
||||
attachment.lifetime = .keepAlways
|
||||
add(attachment)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,148 @@
|
||||
import XCTest
|
||||
|
||||
/// Real UI interactions with isolated preferences. These cover the client,
|
||||
/// including offline recovery; they do not claim to verify the live backend.
|
||||
final class VoiceUITests: XCTestCase {
|
||||
private var app: XCUIApplication!
|
||||
|
||||
override func setUpWithError() throws {
|
||||
continueAfterFailure = false
|
||||
app = XCUIApplication()
|
||||
app.launchArguments = ["--ui-testing", "--reset-ui-testing"]
|
||||
}
|
||||
|
||||
func testLogoutDoesNotLeakPriorAccountTranscriptOrTasks() {
|
||||
app.launchArguments.append("--ui-fixtures")
|
||||
app.launch()
|
||||
XCTAssertTrue(app.staticTexts["Help me plan a quiet weekend."].waitForExistence(timeout: 10))
|
||||
app.buttons["Account"].tap()
|
||||
app.buttons["Sign out"].tap()
|
||||
XCTAssertTrue(app.secureTextFields["Password"].waitForExistence(timeout: 10))
|
||||
let username = app.textFields["Username"]
|
||||
username.tap()
|
||||
username.typeText("second-user")
|
||||
app.secureTextFields["Password"].tap()
|
||||
app.secureTextFields["Password"].typeText("offline-only")
|
||||
app.buttons["Sign in"].tap()
|
||||
XCTAssertTrue(app.buttons["Start chatting"].waitForExistence(timeout: 10))
|
||||
XCTAssertFalse(app.staticTexts["Help me plan a quiet weekend."].exists)
|
||||
app.tabBars.buttons["Activity"].tap()
|
||||
XCTAssertFalse(app.staticTexts["Search backend timed out after 30s"].exists)
|
||||
}
|
||||
|
||||
func testWelcomeNavigationAndOfflineRecovery() {
|
||||
app.launch()
|
||||
XCTAssertTrue(app.buttons["Start chatting"].waitForExistence(timeout: 10))
|
||||
XCTAssertTrue(app.staticTexts["Your microphone starts after you connect."].exists)
|
||||
app.buttons["Type"].tap()
|
||||
XCTAssertTrue(app.buttons["Start chatting"].exists)
|
||||
XCTAssertTrue(app.staticTexts["Your microphone stays off."].exists)
|
||||
app.buttons["Start chatting"].tap()
|
||||
XCTAssertTrue(app.buttons["Try again"].waitForExistence(timeout: 20))
|
||||
XCTAssertTrue(app.staticTexts["Couldn’t connect"].exists)
|
||||
app.buttons["Settings"].tap()
|
||||
XCTAssertTrue(app.textFields["Server URL"].waitForExistence(timeout: 5))
|
||||
capture("Offline recovery")
|
||||
}
|
||||
|
||||
func testVoiceSelectionPersistsAndURLValidation() {
|
||||
app.launch()
|
||||
app.buttons["Settings"].tap()
|
||||
app.buttons.matching(NSPredicate(format: "label CONTAINS 'Speaking voice'")).firstMatch.tap()
|
||||
let voice = app.buttons.matching(NSPredicate(format: "label CONTAINS 'Jenny'")).firstMatch
|
||||
XCTAssertTrue(voice.waitForExistence(timeout: 5))
|
||||
voice.tap()
|
||||
XCTAssertTrue(app.buttons.matching(NSPredicate(format: "label CONTAINS 'Speaking voice' AND label CONTAINS 'Jenny'")).firstMatch.exists)
|
||||
let server = app.textFields["Server URL"]
|
||||
server.tap()
|
||||
let original = server.value as? String ?? ""
|
||||
server.typeText(String(repeating: XCUIKeyboardKey.delete.rawValue, count: original.count) + "http://example.com")
|
||||
app.buttons["Change server"].tap()
|
||||
XCTAssertTrue(app.staticTexts.matching(NSPredicate(format: "label CONTAINS 'must use https'")).firstMatch.waitForExistence(timeout: 5))
|
||||
|
||||
let invalid = server.value as? String ?? ""
|
||||
server.tap()
|
||||
server.typeText(String(repeating: XCUIKeyboardKey.delete.rawValue, count: invalid.count) + " https://127.0.0.1:1 ")
|
||||
app.buttons["Change server"].tap()
|
||||
// A validated address presents an explicit account-switch action rather
|
||||
// than silently replacing the active authenticated server.
|
||||
let confirm = app.buttons["Change server and sign out"]
|
||||
XCTAssertTrue(confirm.waitForExistence(timeout: 5))
|
||||
// Do not apply the destructive action in this fixture: the assertion
|
||||
// above proves a validated change cannot bypass the confirmation gate.
|
||||
|
||||
}
|
||||
|
||||
|
||||
func testTranscriptClearConfirmationAndActivityDetails() {
|
||||
app.launchArguments.append("--ui-fixtures")
|
||||
app.launch()
|
||||
XCTAssertTrue(app.staticTexts["Help me plan a quiet weekend."].waitForExistence(timeout: 10))
|
||||
app.buttons["Conversation options"].tap()
|
||||
app.buttons["Clear conversation"].tap()
|
||||
app.buttons["Cancel"].tap()
|
||||
XCTAssertTrue(app.staticTexts["Help me plan a quiet weekend."].exists)
|
||||
app.buttons["Conversation options"].tap()
|
||||
app.buttons["Clear conversation"].tap()
|
||||
app.buttons["Clear conversation"].tap()
|
||||
XCTAssertTrue(app.buttons["Start chatting"].exists)
|
||||
XCTAssertFalse(app.staticTexts["Help me plan a quiet weekend."].exists)
|
||||
app.tabBars.buttons["Activity"].tap()
|
||||
XCTAssertTrue(app.staticTexts["Needs attention"].waitForExistence(timeout: 5))
|
||||
XCTAssertTrue(app.staticTexts["Search backend timed out after 30s"].exists)
|
||||
app.staticTexts["Search backend timed out after 30s"].tap()
|
||||
XCTAssertTrue(app.staticTexts["Fetching benchmark articles…"].waitForExistence(timeout: 5))
|
||||
capture("Activity details")
|
||||
}
|
||||
|
||||
func testRestoredTranscriptStaysAtTopUntilLatest() {
|
||||
app.launchArguments.append("--ui-long-transcript")
|
||||
app.launch()
|
||||
|
||||
let first = app.staticTexts.matching(NSPredicate(format: "label CONTAINS 'Earlier message 1:'")).firstMatch
|
||||
let last = app.staticTexts.matching(NSPredicate(format: "label CONTAINS 'Earlier message 30:'")).firstMatch
|
||||
XCTAssertTrue(first.waitForExistence(timeout: 10))
|
||||
XCTAssertTrue(app.buttons["Latest"].exists)
|
||||
XCTAssertFalse(last.isHittable)
|
||||
|
||||
app.buttons["Latest"].tap()
|
||||
XCTAssertTrue(last.waitForExistence(timeout: 5))
|
||||
XCTAssertTrue(last.isHittable)
|
||||
}
|
||||
|
||||
func testLargeTypeNavigation() {
|
||||
app.launchArguments += ["-UIPreferredContentSizeCategoryName", "UICTContentSizeCategoryAccessibilityXXXL"]
|
||||
app.launch()
|
||||
XCTAssertTrue(app.buttons["Start chatting"].waitForExistence(timeout: 10))
|
||||
XCTAssertTrue(app.buttons["Start chatting"].isHittable)
|
||||
app.tabBars.buttons["Activity"].tap()
|
||||
XCTAssertTrue(app.staticTexts["No tasks yet"].waitForExistence(timeout: 15))
|
||||
app.buttons["Settings"].tap()
|
||||
XCTAssertTrue(app.navigationBars["Settings"].exists)
|
||||
capture("Accessibility text size")
|
||||
}
|
||||
|
||||
func testOpalPromptPreparesEditableDraftWithoutConnecting() {
|
||||
app.launch()
|
||||
XCTAssertTrue(app.staticTexts["A little room for you,"].waitForExistence(timeout: 10))
|
||||
app.buttons["Explore an idea"].tap()
|
||||
let draft = app.textFields["Message Hope"]
|
||||
XCTAssertTrue(draft.waitForExistence(timeout: 5))
|
||||
XCTAssertEqual(draft.value as? String, "Help me explore an idea.")
|
||||
draft.tap()
|
||||
draft.typeText(String(repeating: XCUIKeyboardKey.delete.rawValue, count: "Help me explore an idea.".count))
|
||||
XCTAssertTrue(draft.exists)
|
||||
draft.typeText("My own thought")
|
||||
XCTAssertEqual(draft.value as? String, "My own thought")
|
||||
XCTAssertTrue(app.buttons["Start chatting"].exists)
|
||||
XCTAssertTrue(app.staticTexts["Your microphone stays off."].exists)
|
||||
capture("Opal editable prompt")
|
||||
}
|
||||
|
||||
private func capture(_ name: String) {
|
||||
let attachment = XCTAttachment(screenshot: app.screenshot())
|
||||
attachment.name = name
|
||||
attachment.lifetime = .keepAlways
|
||||
add(attachment)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user