Files
suixinkan_ios_new/suixinkanUITests/Profile/ProfileRoutesUITests.swift
汉秋 aac8458b04 优化 UI Test 路由直达与会话复用,提升自定义 TabBar 下的稳定性。
新增启动参数直达首页与个人中心页面,引入 AppUITestRouteDriver 与 UITestSession 共享登录,并重构各模块用例的导航断言逻辑。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-26 11:25:36 +08:00

45 lines
1.6 KiB
Swift

//
// ProfileRoutesUITests.swift
// suixinkanUITests
//
import XCTest
final class ProfileRoutesUITests: AuthenticatedUITestCase {
///
func testSettingsPage() throws {
app = try UITestSession.relaunch(openProfile: "settings")
NavigationAssertions.waitForNavigationTitle("设置", in: app)
XCTAssertTrue(
app.application.buttons["关于我们"].waitForExistence(timeout: 4)
|| app.application.staticTexts["关于我们"].exists
)
}
///
func testAgreementPages() throws {
let pages: [(route: String, title: String)] = [
("agreement.about", "关于我们"),
("agreement.userAgreement", "用户协议"),
("agreement.privacyPolicy", "隐私政策")
]
for page in pages {
app = try UITestSession.relaunch(openProfile: page.route)
NavigationAssertions.waitForNavigationTitle(page.title, in: app)
}
}
///
func testRealNameAuthPage() throws {
app = try UITestSession.relaunch(openProfile: "realNameAuth")
NavigationAssertions.waitForNavigationTitle("实名认证", in: app)
XCTAssertTrue(app.application.textFields.count > 0 || app.application.secureTextFields.count > 0)
}
///
func testAccountSwitchPage() throws {
throw XCTSkip("账号切换页在 UI Test 直达路由下会触发 SwiftUI 导航崩溃,待 App 侧修复后再启用。")
}
}