优化 UI Test 路由直达与会话复用,提升自定义 TabBar 下的稳定性。
新增启动参数直达首页与个人中心页面,引入 AppUITestRouteDriver 与 UITestSession 共享登录,并重构各模块用例的导航断言逻辑。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@ -5,29 +5,58 @@
|
||||
|
||||
import XCTest
|
||||
|
||||
/// 首页调试菜单路由覆盖,每条菜单对应一个独立 test 方法,便于逐个执行与定位失败。
|
||||
final class HomeRoutesUITests: AuthenticatedUITestCase {
|
||||
/// 参数化遍历首页调试菜单,覆盖去重后的全部 Home 路由目标页。
|
||||
func testAllHomeRoutesFromDebugMenu() {
|
||||
for entry in UITestHomeMenuCatalog.entries {
|
||||
XCTContext.runActivity(named: entry.menuTitle) { _ in
|
||||
DebugMenuNavigator.open(app: app)
|
||||
DebugMenuNavigator.tapMenu(title: entry.menuTitle, app: app)
|
||||
UITestExpectationVerifier.verify(entry.expectation, app: app)
|
||||
restoreAfterRoute(entry.expectation)
|
||||
}
|
||||
}
|
||||
}
|
||||
func testHomeRoute_空间设置() throws { try run(entryNamed: "空间设置") }
|
||||
func testHomeRoute_相册管理() throws { try run(entryNamed: "相册管理") }
|
||||
func testHomeRoute_相册预览上传() throws { try run(entryNamed: "相册预览上传") }
|
||||
func testHomeRoute_我的钱包() throws { try run(entryNamed: "我的钱包") }
|
||||
func testHomeRoute_立即收款() throws { try run(entryNamed: "立即收款") }
|
||||
func testHomeRoute_相册云盘() throws { try run(entryNamed: "相册云盘") }
|
||||
func testHomeRoute_传输管理() throws { try run(entryNamed: "传输管理") }
|
||||
func testHomeRoute_素材管理() throws { try run(entryNamed: "素材管理") }
|
||||
func testHomeRoute_上传素材() throws { try run(entryNamed: "上传素材") }
|
||||
func testHomeRoute_任务管理() throws { try run(entryNamed: "任务管理") }
|
||||
func testHomeRoute_发布任务() throws { try run(entryNamed: "发布任务") }
|
||||
func testHomeRoute_日程管理() throws { try run(entryNamed: "日程管理") }
|
||||
func testHomeRoute_消息中心() throws { try run(entryNamed: "消息中心") }
|
||||
func testHomeRoute_打卡点管理() throws { try run(entryNamed: "打卡点管理") }
|
||||
func testHomeRoute_样片管理() throws { try run(entryNamed: "样片管理") }
|
||||
func testHomeRoute_上传样片() throws { try run(entryNamed: "上传样片") }
|
||||
func testHomeRoute_直播管理() throws { try run(entryNamed: "直播管理") }
|
||||
func testHomeRoute_直播相册() throws { try run(entryNamed: "直播相册") }
|
||||
func testHomeRoute_景区选择() throws { try run(entryNamed: "景区选择") }
|
||||
func testHomeRoute_景区申请() throws { try run(entryNamed: "景区申请") }
|
||||
func testHomeRoute_权限申请() throws { try run(entryNamed: "权限申请") }
|
||||
func testHomeRoute_权限申请状态() throws { try run(entryNamed: "权限申请状态") }
|
||||
func testHomeRoute_景区结算() throws { try run(entryNamed: "景区结算") }
|
||||
func testHomeRoute_结算审核() throws { try run(entryNamed: "结算审核") }
|
||||
func testHomeRoute_核销订单() throws { try run(entryNamed: "核销订单") }
|
||||
func testHomeRoute_景区订单() throws { try run(entryNamed: "景区订单") }
|
||||
func testHomeRoute_数据统计() throws { try run(entryNamed: "数据统计") }
|
||||
func testHomeRoute_项目管理() throws { try run(entryNamed: "项目管理") }
|
||||
func testHomeRoute_店铺项目管理() throws { try run(entryNamed: "店铺项目管理") }
|
||||
func testHomeRoute_位置上报() throws { try run(entryNamed: "位置上报") }
|
||||
func testHomeRoute_注册邀请() throws { try run(entryNamed: "注册邀请") }
|
||||
func testHomeRoute_邀请记录() throws { try run(entryNamed: "邀请记录") }
|
||||
func testHomeRoute_店铺管理() throws { try run(entryNamed: "店铺管理") }
|
||||
func testHomeRoute_飞行管理() throws { try run(entryNamed: "飞行管理") }
|
||||
func testHomeRoute_飞手认证() throws { try run(entryNamed: "飞手认证") }
|
||||
func testHomeRoute_飞控() throws { try run(entryNamed: "飞控") }
|
||||
func testHomeRoute_排队管理() throws { try run(entryNamed: "排队管理") }
|
||||
func testHomeRoute_运营区域() throws { try run(entryNamed: "运营区域") }
|
||||
func testHomeRoute_押金订单详情() throws { try run(entryNamed: "押金订单详情") }
|
||||
func testHomeRoute_提现审核() throws { try run(entryNamed: "提现审核") }
|
||||
func testHomeRoute_定位上报历史() throws { try run(entryNamed: "定位上报历史") }
|
||||
func testHomeRoute_更多功能() throws { try run(entryNamed: "更多功能") }
|
||||
func testHomeRoute_系统设置() throws { try run(entryNamed: "系统设置") }
|
||||
|
||||
/// 根据打开结果恢复到调试菜单,便于继续下一项。
|
||||
private func restoreAfterRoute(_ expectation: UITestHomeMenuCatalog.Expectation) {
|
||||
switch expectation {
|
||||
case .tab:
|
||||
DebugMenuNavigator.open(app: app)
|
||||
case .staticText:
|
||||
BackNavigator.dismissCustomTopBarIfNeeded(app: app)
|
||||
DebugMenuNavigator.returnToMenu(app: app)
|
||||
default:
|
||||
DebugMenuNavigator.returnToMenu(app: app)
|
||||
/// 按菜单标题执行单条首页路由测试。
|
||||
private func run(entryNamed menuTitle: String) throws {
|
||||
guard let entry = UITestHomeMenuCatalog.entries.first(where: { $0.menuTitle == menuTitle }) else {
|
||||
XCTFail("未在目录中找到菜单:\(menuTitle)")
|
||||
return
|
||||
}
|
||||
app = try HomeRouteTestRunner.verify(entry: entry)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user