新增启动参数直达首页与个人中心页面,引入 AppUITestRouteDriver 与 UITestSession 共享登录,并重构各模块用例的导航断言逻辑。 Co-authored-by: Cursor <cursoragent@cursor.com>
49 lines
1.7 KiB
Swift
49 lines
1.7 KiB
Swift
//
|
|
// DebugMenuNavigator.swift
|
|
// suixinkanUITests
|
|
//
|
|
// Created by Codex on 2026/6/26.
|
|
//
|
|
|
|
import XCTest
|
|
|
|
/// DEBUG 首页菜单调试页导航封装。
|
|
enum DebugMenuNavigator {
|
|
/// 进入「我的 → 首页调试」列表。
|
|
static func open(app: SuixinkanApp, file: StaticString = #filePath, line: UInt = #line) {
|
|
TabBarNavigator.select(.profile, app: app, file: file, line: line)
|
|
NavigationAssertions.waitForStaticText("系统设置", in: app, timeout: 12, file: file, line: line)
|
|
|
|
if !app.application.buttons["首页调试"].waitForExistence(timeout: 2),
|
|
!app.application.staticTexts["首页调试"].exists {
|
|
app.application.swipeUp()
|
|
}
|
|
|
|
UITestTapHelper.tapLabel("首页调试", in: app, file: file, line: line)
|
|
|
|
let menuOpened =
|
|
NavigationAssertions.waitForAnyNavigationTitle(["首页菜单调试"], in: app, timeout: 20) != nil
|
|
|| app.application.staticTexts["全部首页菜单"].waitForExistence(timeout: 4)
|
|
XCTAssertTrue(menuOpened, "未能打开首页菜单调试页。", file: file, line: line)
|
|
}
|
|
|
|
/// 在调试菜单中点击指定标题。
|
|
static func tapMenu(
|
|
title: String,
|
|
app: SuixinkanApp,
|
|
file: StaticString = #filePath,
|
|
line: UInt = #line
|
|
) {
|
|
UITestTapHelper.tapLabel(title, in: app, timeout: 8, file: file, line: line)
|
|
}
|
|
|
|
/// 返回调试菜单列表。
|
|
static func returnToMenu(app: SuixinkanApp) {
|
|
if app.application.navigationBars["首页菜单调试"].exists {
|
|
return
|
|
}
|
|
BackNavigator.goBack(app: app)
|
|
NavigationAssertions.waitForNavigationTitle("首页菜单调试", in: app)
|
|
}
|
|
}
|