按模块拆分 XCUITest 用例与 Support 基础设施,UI Test 运行时跳过推送与排队 WebSocket,并将 Podfile 最低版本对齐 iOS 16。 Co-authored-by: Cursor <cursoragent@cursor.com>
32 lines
1002 B
Swift
32 lines
1002 B
Swift
//
|
||
// AppUITestLaunchState.swift
|
||
// suixinkan
|
||
//
|
||
// Created by Codex on 2026/6/26.
|
||
//
|
||
|
||
import Foundation
|
||
|
||
/// UI 测试启动状态,仅在测试进程显式传入启动参数时生效。
|
||
enum AppUITestLaunchState {
|
||
/// UI Test 主开关,测试进程统一传入。
|
||
static let uiTestsArgument = "-suixinkan-ui-tests"
|
||
/// 冷启动前清理本地登录缓存。
|
||
static let resetArgument = "-suixinkan-ui-tests-reset-state"
|
||
|
||
/// 当前进程是否由 XCUITest 启动。
|
||
static var isRunningUITests: Bool {
|
||
ProcessInfo.processInfo.arguments.contains(uiTestsArgument)
|
||
}
|
||
|
||
/// 按需在冷启动时清理 token、账号快照和偏好设置。
|
||
static func resetIfNeeded(arguments: [String] = ProcessInfo.processInfo.arguments) {
|
||
guard arguments.contains(resetArgument) else { return }
|
||
|
||
try? SessionTokenStore().clear()
|
||
AccountSnapshotStore().clear()
|
||
let preferences = AppPreferencesStore()
|
||
preferences.clear()
|
||
}
|
||
}
|