Merge branch 'develop' of github.com:akatreyt/MyCribKMM into develop
# Conflicts: # iosApp/CaseraUITests/SimpleLoginTest.swift # iosApp/CaseraUITests/Suite0_OnboardingTests.swift # iosApp/CaseraUITests/Suite10_ComprehensiveE2ETests.swift # iosApp/CaseraUITests/Suite1_RegistrationTests.swift # iosApp/CaseraUITests/Suite2_AuthenticationTests.swift # iosApp/CaseraUITests/Suite3_ResidenceTests.swift # iosApp/CaseraUITests/Suite4_ComprehensiveResidenceTests.swift # iosApp/CaseraUITests/Suite5_TaskTests.swift # iosApp/CaseraUITests/Suite6_ComprehensiveTaskTests.swift # iosApp/CaseraUITests/Suite7_ContractorTests.swift # iosApp/CaseraUITests/Suite8_DocumentWarrantyTests.swift # iosApp/CaseraUITests/Suite9_IntegrationE2ETests.swift # iosApp/CaseraUITests/UITestHelpers.swift # iosApp/iosApp/RootView.swift # iosApp/iosApp/iOSApp.swift
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
import Foundation
|
||||
import UIKit
|
||||
import ComposeApp
|
||||
|
||||
/// Runtime contract between the app and XCUITests.
|
||||
enum UITestRuntime {
|
||||
static let uiTestingFlag = "--ui-testing"
|
||||
static let disableAnimationsFlag = "--disable-animations"
|
||||
static let resetStateFlag = "--reset-state"
|
||||
static let mockAuthFlag = "--ui-test-mock-auth"
|
||||
|
||||
static var launchArguments: [String] {
|
||||
ProcessInfo.processInfo.arguments
|
||||
}
|
||||
|
||||
static var isEnabled: Bool {
|
||||
launchArguments.contains(uiTestingFlag)
|
||||
}
|
||||
|
||||
static var shouldDisableAnimations: Bool {
|
||||
isEnabled && launchArguments.contains(disableAnimationsFlag)
|
||||
}
|
||||
|
||||
static var shouldResetState: Bool {
|
||||
isEnabled && launchArguments.contains(resetStateFlag)
|
||||
}
|
||||
|
||||
static var shouldMockAuth: Bool {
|
||||
isEnabled && launchArguments.contains(mockAuthFlag)
|
||||
}
|
||||
|
||||
static func configureForLaunch() {
|
||||
guard isEnabled else { return }
|
||||
|
||||
if shouldDisableAnimations {
|
||||
UIView.setAnimationsEnabled(false)
|
||||
}
|
||||
|
||||
UserDefaults.standard.set(true, forKey: "ui_testing_mode")
|
||||
}
|
||||
|
||||
static func resetStateIfRequested() {
|
||||
guard shouldResetState else { return }
|
||||
|
||||
DataManager.shared.clear()
|
||||
OnboardingState.shared.reset()
|
||||
ThemeManager.shared.currentTheme = .bright
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user