diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 43b2f6f..fc3e94e 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -107,7 +107,7 @@ jobs: runsonlabels: '["macOS", "self-hosted"]' path: 'Tests/UITests' scheme: TestApp - destination: 'platform=iOS Simulator,name=iPad Air (5th generation)' + destination: 'platform=iOS Simulator,name=iPad Pro (11-inch) (4th generation)' buildConfig: ${{ matrix.buildConfig }} resultBundle: ${{ matrix.resultBundle }} artifactname: ${{ matrix.artifactname }} diff --git a/Tests/UITests/TestApp/FeatureFlags.swift b/Tests/UITests/TestApp/FeatureFlags.swift index 4d674fe..383d0b7 100644 --- a/Tests/UITests/TestApp/FeatureFlags.swift +++ b/Tests/UITests/TestApp/FeatureFlags.swift @@ -14,4 +14,6 @@ enum FeatureFlags: Sendable { static let mockMode = ProcessInfo.processInfo.arguments.contains("--mockMode") /// Resets all credentials in Secure Storage when the application is launched in order to facilitate testing of OpenAI API keys. static let resetSecureStorage = ProcessInfo.processInfo.arguments.contains("--resetSecureStorage") + /// Always show the onboarding when the application is launched. Makes it easy to modify and test the onboarding flow without the need to manually remove the application or reset the simulator. + static let showOnboarding = ProcessInfo.processInfo.arguments.contains("--showOnboarding") } diff --git a/Tests/UITests/TestApp/LLMLocal/Onboarding/LLMLocalOnboardingFlow.swift b/Tests/UITests/TestApp/LLMLocal/Onboarding/LLMLocalOnboardingFlow.swift index 104392e..f0a52ac 100644 --- a/Tests/UITests/TestApp/LLMLocal/Onboarding/LLMLocalOnboardingFlow.swift +++ b/Tests/UITests/TestApp/LLMLocal/Onboarding/LLMLocalOnboardingFlow.swift @@ -23,7 +23,7 @@ struct LLMLocalOnboardingFlow: View { LLMLocalOnboardingDownloadView() } } - .interactiveDismissDisabled(!completedOnboardingFlow) + .interactiveDismissDisabled(!completedOnboardingFlow) } } diff --git a/Tests/UITests/TestApp/TestAppTestingSetup.swift b/Tests/UITests/TestApp/TestAppTestingSetup.swift index e5f3fdd..692cb4a 100644 --- a/Tests/UITests/TestApp/TestAppTestingSetup.swift +++ b/Tests/UITests/TestApp/TestAppTestingSetup.swift @@ -13,17 +13,18 @@ import SwiftUI private struct TestAppTestingSetup: ViewModifier { @Environment(SecureStorage.self) var secureStorage + @AppStorage(StorageKeys.onboardingFlowComplete) private var completedOnboardingFlow = false func body(content: Content) -> some View { content .task { if FeatureFlags.resetSecureStorage { - do { - try secureStorage.deleteAllCredentials() - } catch { - print(error.localizedDescription) - } + try? secureStorage.deleteAllCredentials() + } + + if FeatureFlags.showOnboarding { + completedOnboardingFlow = false } } } diff --git a/Tests/UITests/TestAppUITests/TestAppLLMLocalUITests.swift b/Tests/UITests/TestAppUITests/TestAppLLMLocalUITests.swift index b915de8..f18d8be 100644 --- a/Tests/UITests/TestAppUITests/TestAppLLMLocalUITests.swift +++ b/Tests/UITests/TestAppUITests/TestAppLLMLocalUITests.swift @@ -17,7 +17,7 @@ class TestAppLLMLocalUITests: XCTestCase { continueAfterFailure = false let app = XCUIApplication() - app.launchArguments = ["--mockMode", "--testMode"] + app.launchArguments = ["--mockMode", "--showOnboarding"] #if !os(macOS) app.deleteAndLaunch(withSpringboardAppName: "TestApp") #else diff --git a/Tests/UITests/TestAppUITests/TestAppLLMOpenAIUITests.swift b/Tests/UITests/TestAppUITests/TestAppLLMOpenAIUITests.swift index de872d9..b56b2c4 100644 --- a/Tests/UITests/TestAppUITests/TestAppLLMOpenAIUITests.swift +++ b/Tests/UITests/TestAppUITests/TestAppLLMOpenAIUITests.swift @@ -17,7 +17,7 @@ class TestAppLLMOpenAIUITests: XCTestCase { continueAfterFailure = false let app = XCUIApplication() - app.launchArguments = ["--mockMode", "--resetSecureStorage", "--testMode"] + app.launchArguments = ["--mockMode", "--resetSecureStorage"] #if !os(macOS) app.deleteAndLaunch(withSpringboardAppName: "TestApp") #else diff --git a/Tests/UITests/UITests.xcodeproj/xcshareddata/xcschemes/TestApp.xcscheme b/Tests/UITests/UITests.xcodeproj/xcshareddata/xcschemes/TestApp.xcscheme index 675d8f9..64ae972 100644 --- a/Tests/UITests/UITests.xcodeproj/xcshareddata/xcschemes/TestApp.xcscheme +++ b/Tests/UITests/UITests.xcodeproj/xcshareddata/xcschemes/TestApp.xcscheme @@ -133,6 +133,10 @@ + +