为 TabBar 和扫码页补充 accessibilityIdentifier,并在模拟器/UI Test 中禁用真实相机采集。

预初始化各 Tab 路由容器,修正 iOS 17 ContentUnavailableView 调用,提升自定义 TabBar 与扫码流程的 UI Test 稳定性。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-06-29 09:34:09 +08:00
parent d27438b264
commit 79e735f628
7 changed files with 105 additions and 28 deletions

View File

@ -14,6 +14,19 @@ enum TabBarNavigator {
case orders = "订单"
case statistics = "数据"
case profile = "我的"
var identifier: String {
switch self {
case .home:
return "main.tab.home"
case .orders:
return "main.tab.orders"
case .statistics:
return "main.tab.statistics"
case .profile:
return "main.tab.profile"
}
}
}
/// Tab
@ -26,6 +39,13 @@ enum TabBarNavigator {
/// TabBar Tab
private static func bottomTabButton(named title: String, in app: SuixinkanApp) -> XCUIElement {
if let tab = Tab(rawValue: title) {
let identifiedButton = app.application.buttons[tab.identifier]
if identifiedButton.exists {
return identifiedButton
}
}
let candidates = app.application.buttons.matching(NSPredicate(format: "label == %@", title))
let screenHeight = app.application.windows.element(boundBy: 0).frame.height
var bestMatch: XCUIElement?