新增完整 UI Test 回归套件,并完善启动隔离逻辑。
按模块拆分 XCUITest 用例与 Support 基础设施,UI Test 运行时跳过推送与排队 WebSocket,并将 Podfile 最低版本对齐 iOS 16。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
42
suixinkanUITests/Support/AuthenticatedUITestCase.swift
Normal file
42
suixinkanUITests/Support/AuthenticatedUITestCase.swift
Normal file
@ -0,0 +1,42 @@
|
||||
//
|
||||
// AuthenticatedUITestCase.swift
|
||||
// suixinkanUITests
|
||||
//
|
||||
// Created by Codex on 2026/6/26.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
|
||||
/// 需要已登录态的 UI Test 基类,每个测试类只启动并登录一次。
|
||||
class AuthenticatedUITestCase: XCTestCase {
|
||||
private static var sharedApp: SuixinkanApp?
|
||||
|
||||
var app: SuixinkanApp!
|
||||
|
||||
override class func setUp() {
|
||||
super.setUp()
|
||||
guard sharedApp == nil else { return }
|
||||
guard UITestLaunchConfiguration.credentials != nil else { return }
|
||||
|
||||
sharedApp = try? UITestAuthenticatedSession.launchLoggedIn()
|
||||
}
|
||||
|
||||
override class func tearDown() {
|
||||
sharedApp?.application.terminate()
|
||||
sharedApp = nil
|
||||
super.tearDown()
|
||||
}
|
||||
|
||||
override func setUpWithError() throws {
|
||||
try super.setUpWithError()
|
||||
continueAfterFailure = false
|
||||
|
||||
guard let sharedApp = Self.sharedApp else {
|
||||
throw XCTSkip("缺少 UI Test 账号或登录失败。")
|
||||
}
|
||||
|
||||
app = sharedApp
|
||||
app.application.activate()
|
||||
app.waitForGlobalLoadingToDisappear()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user