Skip to content

Commit

Permalink
Update UI test
Browse files Browse the repository at this point in the history
  • Loading branch information
vishnuravi committed Apr 4, 2024
1 parent dad7ab8 commit dbec660
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion HealthGPT/HealthGPT/HealthGPTView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@

import SpeziChat
import SpeziLLM
import SpeziLLMLocal
import SpeziLLMOpenAI
import SpeziSpeechSynthesizer
import SwiftUI
import SpeziLLMLocal


struct HealthGPTView: View {
Expand Down
2 changes: 1 addition & 1 deletion HealthGPT/Onboarding/LLMSource.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import Foundation


enum LLMSource: String, CaseIterable, Identifiable, Codable {
case local
case openai
case local

var id: String {
self.rawValue
Expand Down
1 change: 1 addition & 0 deletions HealthGPT/Onboarding/LLMSourceSelection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ struct LLMSourceSelection: View {
}
}
.pickerStyle(.inline)
.accessibilityIdentifier("llmSourcePicker")
}
}

Expand Down
12 changes: 12 additions & 0 deletions HealthGPTUITests/OnboardingUITests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ extension XCUIApplication {
func navigateOnboardingFlow(assertThatHealthKitConsentIsShown: Bool = true) throws {
try navigateOnboardingFlowWelcome()
try navigateOnboardingFlowDisclaimer()
try navigateOnboardingFlowLLMSourceSelection()
try navigateOnboardingFlowApiKey()
try navigateOnboardingFlowModelSelection()
try navigateOnboardingFlowHealthKitAccess(assertThatHealthKitConsentIsShown: assertThatHealthKitConsentIsShown)
Expand All @@ -66,6 +67,17 @@ extension XCUIApplication {
XCTAssertTrue(buttons["I Agree"].waitForExistence(timeout: 10))
buttons["I Agree"].tap()
}

private func navigateOnboardingFlowLLMSourceSelection() throws {
XCTAssertTrue(staticTexts["LLM Source Selection"].waitForExistence(timeout: 5))

let picker = pickers["llmSourcePicker"]
let optionToSelect = picker.pickerWheels.element(boundBy: 0)
optionToSelect.adjust(toPickerWheelValue: "Open AI LLM")

XCTAssertTrue(buttons["Save Choice"].waitForExistence(timeout: 5))
buttons["Save Choice"].tap()
}

private func navigateOnboardingFlowApiKey() throws {
try textFields["OpenAI API Key"].enter(value: "sk-123456789")
Expand Down

0 comments on commit dbec660

Please sign in to comment.