Skip to content

Commit

Permalink
Final UI test fix on macOS and CI fix
Browse files Browse the repository at this point in the history
  • Loading branch information
philippzagar committed Mar 27, 2024
1 parent e41a01a commit fdcde1d
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
2 changes: 2 additions & 0 deletions Tests/UITests/TestApp/FeatureFlags.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ struct LLMLocalOnboardingFlow: View {
LLMLocalOnboardingDownloadView()
}
}
.interactiveDismissDisabled(!completedOnboardingFlow)
.interactiveDismissDisabled(!completedOnboardingFlow)
}
}

Expand Down
11 changes: 6 additions & 5 deletions Tests/UITests/TestApp/TestAppTestingSetup.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion Tests/UITests/TestAppUITests/TestAppLLMLocalUITests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Tests/UITests/TestAppUITests/TestAppLLMOpenAIUITests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,10 @@
</BuildableReference>
</BuildableProductRunnable>
<CommandLineArguments>
<CommandLineArgument
argument = "--showOnboarding"
isEnabled = "NO">
</CommandLineArgument>
<CommandLineArgument
argument = "--mockMode"
isEnabled = "NO">
Expand Down

0 comments on commit fdcde1d

Please sign in to comment.