优化 UI Test 路由直达与会话复用,提升自定义 TabBar 下的稳定性。
新增启动参数直达首页与个人中心页面,引入 AppUITestRouteDriver 与 UITestSession 共享登录,并重构各模块用例的导航断言逻辑。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@ -11,11 +11,20 @@ import XCTest
|
||||
enum DebugMenuNavigator {
|
||||
/// 进入「我的 → 首页调试」列表。
|
||||
static func open(app: SuixinkanApp, file: StaticString = #filePath, line: UInt = #line) {
|
||||
TabBarNavigator.select(.profile, app: app)
|
||||
let debugEntry = app.application.staticTexts["首页调试"]
|
||||
XCTAssertTrue(debugEntry.waitForExistence(timeout: 8), "未找到首页调试入口。", file: file, line: line)
|
||||
debugEntry.tap()
|
||||
NavigationAssertions.waitForNavigationTitle("首页菜单调试", in: app, file: file, line: 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)
|
||||
}
|
||||
|
||||
/// 在调试菜单中点击指定标题。
|
||||
@ -25,10 +34,7 @@ enum DebugMenuNavigator {
|
||||
file: StaticString = #filePath,
|
||||
line: UInt = #line
|
||||
) {
|
||||
let cell = app.application.staticTexts[title]
|
||||
XCTAssertTrue(cell.waitForExistence(timeout: 8), "调试菜单未找到:\(title)", file: file, line: line)
|
||||
cell.tap()
|
||||
app.waitForGlobalLoadingToDisappear()
|
||||
UITestTapHelper.tapLabel(title, in: app, timeout: 8, file: file, line: line)
|
||||
}
|
||||
|
||||
/// 返回调试菜单列表。
|
||||
|
||||
Reference in New Issue
Block a user