同步 Android 启动页到 iOS,并在冷启动期间静默恢复登录态。
新增 SplashView、SplashCoordinator 与 Launch Screen 资源,移除冷启动 Lottie;LoginView 加载 App 配置。同时将 token 存储迁移至 UserDefaults,并更新相关测试与文档。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
// ZLoginSmokeUITests.swift
|
||||
// suixinkanUITests
|
||||
//
|
||||
// 命名以 Z 开头,确保在全套件末尾执行,避免清空 Keychain 影响其它用例。
|
||||
// 命名以 Z 开头,确保在全套件末尾执行,避免清空 UserDefaults 登录态影响其它用例。
|
||||
//
|
||||
|
||||
import XCTest
|
||||
|
||||
@ -57,7 +57,7 @@ xcodebuild test \
|
||||
UI Test 进程会自动传入:
|
||||
|
||||
- `-suixinkan-ui-tests`:主开关,App 侧跳过推送注册与排队 WebSocket
|
||||
- `-suixinkan-ui-tests-reset-state`:冷启动清理 Keychain / UserDefaults
|
||||
- `-suixinkan-ui-tests-reset-state`:冷启动清理 UserDefaults 中的 token、账号快照和偏好
|
||||
- `-suixinkan-ui-tests-open-menu <菜单标题>`:登录后直达首页调试目录中的页面
|
||||
- `-suixinkan-ui-tests-open-profile <路由名>`:登录后直达个人中心二级页(如 `settings`)
|
||||
|
||||
|
||||
@ -43,12 +43,23 @@ final class SuixinkanApp {
|
||||
hasLaunched = true
|
||||
}
|
||||
dismissSystemAlertsIfNeeded()
|
||||
waitForSplashToDisappearIfNeeded()
|
||||
if waitForLoading {
|
||||
waitForGlobalLoadingToDisappear()
|
||||
}
|
||||
return self
|
||||
}
|
||||
|
||||
/// 等待启动页消失后再继续后续断言。
|
||||
func waitForSplashToDisappearIfNeeded(timeout: TimeInterval = 5) {
|
||||
let splash = application.otherElements["splash.root"]
|
||||
guard splash.waitForExistence(timeout: 2) else { return }
|
||||
|
||||
let predicate = NSPredicate(format: "exists == false")
|
||||
let expectation = XCTNSPredicateExpectation(predicate: predicate, object: splash)
|
||||
_ = XCTWaiter.wait(for: [expectation], timeout: timeout)
|
||||
}
|
||||
|
||||
/// 等待全局 Loading 层消失。
|
||||
func waitForGlobalLoadingToDisappear(timeout: TimeInterval = 45) {
|
||||
let loading = application.staticTexts["加载中"]
|
||||
|
||||
@ -25,7 +25,7 @@ enum UITestSession {
|
||||
return launched
|
||||
}
|
||||
|
||||
/// 以指定首页菜单直达参数重启 App,并复用 Keychain 登录态。
|
||||
/// 以指定首页菜单直达参数重启 App,并复用 UserDefaults 登录态。
|
||||
@discardableResult
|
||||
static func relaunch(
|
||||
openMenu menuTitle: String,
|
||||
@ -44,7 +44,7 @@ enum UITestSession {
|
||||
return relaunched
|
||||
}
|
||||
|
||||
/// 以指定个人中心路由直达参数重启 App,并复用 Keychain 登录态。
|
||||
/// 以指定个人中心路由直达参数重启 App,并复用 UserDefaults 登录态。
|
||||
@discardableResult
|
||||
static func relaunch(
|
||||
openProfile route: String,
|
||||
|
||||
Reference in New Issue
Block a user