优化 UI Test 路由直达与会话复用,提升自定义 TabBar 下的稳定性。

新增启动参数直达首页与个人中心页面,引入 AppUITestRouteDriver 与 UITestSession 共享登录,并重构各模块用例的导航断言逻辑。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-06-26 11:25:36 +08:00
parent 0c01ee26c3
commit aac8458b04
31 changed files with 587 additions and 166 deletions

View File

@ -13,12 +13,36 @@ enum AppUITestLaunchState {
static let uiTestsArgument = "-suixinkan-ui-tests"
///
static let resetArgument = "-suixinkan-ui-tests-reset-state"
///
static let openMenuArgument = "-suixinkan-ui-tests-open-menu"
///
static let openProfileArgument = "-suixinkan-ui-tests-open-profile"
/// XCUITest
static var isRunningUITests: Bool {
ProcessInfo.processInfo.arguments.contains(uiTestsArgument)
}
///
static var pendingMenuTitle: String? {
argumentValue(following: openMenuArgument)
}
///
static var pendingProfileRouteRawValue: String? {
argumentValue(following: openProfileArgument)
}
/// flag
private static func argumentValue(following flag: String) -> String? {
let arguments = ProcessInfo.processInfo.arguments
guard let index = arguments.firstIndex(of: flag), index + 1 < arguments.count else {
return nil
}
let value = arguments[index + 1].trimmingCharacters(in: .whitespacesAndNewlines)
return value.isEmpty ? nil : value
}
/// token
static func resetIfNeeded(arguments: [String] = ProcessInfo.processInfo.arguments) {
guard arguments.contains(resetArgument) else { return }