Refactor iOS UI tests to blueprint architecture and migrate legacy suites
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
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 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 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