优化 UI Test 路由直达与会话复用,提升自定义 TabBar 下的稳定性。
新增启动参数直达首页与个人中心页面,引入 AppUITestRouteDriver 与 UITestSession 共享登录,并重构各模块用例的导航断言逻辑。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@ -7,9 +7,8 @@ import XCTest
|
||||
|
||||
final class InviteUITests: AuthenticatedUITestCase {
|
||||
/// 测试邀请页与邀请记录页。
|
||||
func testInviteAndRecordPages() {
|
||||
DebugMenuNavigator.open(app: app)
|
||||
DebugMenuNavigator.tapMenu(title: "注册邀请", app: app)
|
||||
func testInviteAndRecordPages() throws {
|
||||
app = try UITestSession.relaunch(openMenu: "注册邀请")
|
||||
NavigationAssertions.waitForNavigationTitle("摄影师邀请", in: app)
|
||||
|
||||
let recordEntry = app.application.staticTexts.matching(NSPredicate(format: "label CONTAINS '邀请记录'")).firstMatch
|
||||
@ -17,9 +16,7 @@ final class InviteUITests: AuthenticatedUITestCase {
|
||||
recordEntry.tap()
|
||||
NavigationAssertions.waitForNavigationTitle("邀请记录", in: app)
|
||||
} else {
|
||||
BackNavigator.goBack(app: app)
|
||||
DebugMenuNavigator.open(app: app)
|
||||
DebugMenuNavigator.tapMenu(title: "邀请记录", app: app)
|
||||
app = try UITestSession.relaunch(openMenu: "邀请记录")
|
||||
NavigationAssertions.waitForNavigationTitle("邀请记录", in: app)
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,9 +7,8 @@ import XCTest
|
||||
|
||||
final class LiveUITests: AuthenticatedUITestCase {
|
||||
/// 测试直播管理列表与创建页。
|
||||
func testLiveManagementAndCreatePage() {
|
||||
DebugMenuNavigator.open(app: app)
|
||||
DebugMenuNavigator.tapMenu(title: "直播管理", app: app)
|
||||
func testLiveManagementAndCreatePage() throws {
|
||||
app = try UITestSession.relaunch(openMenu: "直播管理")
|
||||
NavigationAssertions.waitForNavigationTitle("直播管理", in: app)
|
||||
|
||||
let addButton = app.application.buttons.matching(NSPredicate(format: "label CONTAINS '添加'")).firstMatch
|
||||
@ -21,9 +20,8 @@ final class LiveUITests: AuthenticatedUITestCase {
|
||||
}
|
||||
|
||||
/// 测试直播相册页可打开。
|
||||
func testLiveAlbumPage() {
|
||||
DebugMenuNavigator.open(app: app)
|
||||
DebugMenuNavigator.tapMenu(title: "直播相册", app: app)
|
||||
func testLiveAlbumPage() throws {
|
||||
app = try UITestSession.relaunch(openMenu: "直播相册")
|
||||
NavigationAssertions.waitForNavigationTitle("直播相册", in: app)
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,9 +7,8 @@ import XCTest
|
||||
|
||||
final class LocationReportUITests: AuthenticatedUITestCase {
|
||||
/// 测试位置上报与历史记录页。
|
||||
func testLocationReportAndHistory() {
|
||||
DebugMenuNavigator.open(app: app)
|
||||
DebugMenuNavigator.tapMenu(title: "位置上报", app: app)
|
||||
func testLocationReportAndHistory() throws {
|
||||
app = try UITestSession.relaunch(openMenu: "位置上报")
|
||||
NavigationAssertions.waitForNavigationTitle("位置上报", in: app)
|
||||
|
||||
let historyEntry = app.application.staticTexts.matching(NSPredicate(format: "label CONTAINS '历史'")).firstMatch
|
||||
@ -17,9 +16,7 @@ final class LocationReportUITests: AuthenticatedUITestCase {
|
||||
historyEntry.tap()
|
||||
NavigationAssertions.waitForNavigationTitle("位置上报历史", in: app)
|
||||
} else {
|
||||
BackNavigator.goBack(app: app)
|
||||
DebugMenuNavigator.open(app: app)
|
||||
DebugMenuNavigator.tapMenu(title: "定位上报历史", app: app)
|
||||
app = try UITestSession.relaunch(openMenu: "定位上报历史")
|
||||
NavigationAssertions.waitForNavigationTitle("位置上报历史", in: app)
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,9 +7,8 @@ import XCTest
|
||||
|
||||
final class MessageCenterUITests: AuthenticatedUITestCase {
|
||||
/// 测试消息中心列表可展示并尝试进入详情。
|
||||
func testMessageCenterListAndDetail() {
|
||||
DebugMenuNavigator.open(app: app)
|
||||
DebugMenuNavigator.tapMenu(title: "消息中心", app: app)
|
||||
func testMessageCenterListAndDetail() throws {
|
||||
app = try UITestSession.relaunch(openMenu: "消息中心")
|
||||
NavigationAssertions.waitForNavigationTitle("消息中心", in: app)
|
||||
|
||||
let firstCell = app.application.cells.element(boundBy: 0)
|
||||
|
||||
@ -7,9 +7,8 @@ import XCTest
|
||||
|
||||
final class PilotCertificationUITests: AuthenticatedUITestCase {
|
||||
/// 测试飞手认证表单校验与验证码按钮。
|
||||
func testPilotCertificationValidation() {
|
||||
DebugMenuNavigator.open(app: app)
|
||||
DebugMenuNavigator.tapMenu(title: "飞手认证", app: app)
|
||||
func testPilotCertificationValidation() throws {
|
||||
app = try UITestSession.relaunch(openMenu: "飞手认证")
|
||||
NavigationAssertions.waitForNavigationTitle("飞手认证", in: app)
|
||||
|
||||
let submitButton = app.application.buttons.matching(NSPredicate(format: "label CONTAINS '提交'")).firstMatch
|
||||
|
||||
@ -7,9 +7,8 @@ import XCTest
|
||||
|
||||
final class ProjectsUITests: AuthenticatedUITestCase {
|
||||
/// 测试摄影师项目列表与新建页。
|
||||
func testProjectManagementCreatePage() {
|
||||
DebugMenuNavigator.open(app: app)
|
||||
DebugMenuNavigator.tapMenu(title: "项目管理", app: app)
|
||||
func testProjectManagementCreatePage() throws {
|
||||
app = try UITestSession.relaunch(openMenu: "项目管理")
|
||||
NavigationAssertions.waitForNavigationTitle("项目管理", in: app)
|
||||
|
||||
let createButton = app.application.buttons.matching(NSPredicate(format: "label CONTAINS '新建'")).firstMatch
|
||||
@ -21,9 +20,8 @@ final class ProjectsUITests: AuthenticatedUITestCase {
|
||||
}
|
||||
|
||||
/// 测试店铺项目管理页可打开。
|
||||
func testStoreProjectManagementPage() {
|
||||
DebugMenuNavigator.open(app: app)
|
||||
DebugMenuNavigator.tapMenu(title: "店铺项目管理", app: app)
|
||||
func testStoreProjectManagementPage() throws {
|
||||
app = try UITestSession.relaunch(openMenu: "店铺项目管理")
|
||||
NavigationAssertions.waitForNavigationTitle("店铺项目管理", in: app)
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,9 +7,8 @@ import XCTest
|
||||
|
||||
final class PunchPointUITests: AuthenticatedUITestCase {
|
||||
/// 测试打卡点列表与新建页。
|
||||
func testPunchPointListAndCreatePage() {
|
||||
DebugMenuNavigator.open(app: app)
|
||||
DebugMenuNavigator.tapMenu(title: "打卡点管理", app: app)
|
||||
func testPunchPointListAndCreatePage() throws {
|
||||
app = try UITestSession.relaunch(openMenu: "打卡点管理")
|
||||
NavigationAssertions.waitForNavigationTitle("打卡点管理", in: app)
|
||||
|
||||
let createButton = app.application.buttons.matching(NSPredicate(format: "label CONTAINS '新增'")).firstMatch
|
||||
|
||||
@ -7,9 +7,8 @@ import XCTest
|
||||
|
||||
final class QueueManagementUITests: AuthenticatedUITestCase {
|
||||
/// 测试排队管理首页与设置页。
|
||||
func testQueueManagementAndSettings() {
|
||||
DebugMenuNavigator.open(app: app)
|
||||
DebugMenuNavigator.tapMenu(title: "排队管理", app: app)
|
||||
func testQueueManagementAndSettings() throws {
|
||||
app = try UITestSession.relaunch(openMenu: "排队管理")
|
||||
NavigationAssertions.waitForNavigationTitle("排队管理", in: app)
|
||||
|
||||
let settingsEntry = app.application.staticTexts.matching(NSPredicate(format: "label CONTAINS '设置'")).firstMatch
|
||||
|
||||
@ -7,9 +7,8 @@ import XCTest
|
||||
|
||||
final class ScheduleUITests: AuthenticatedUITestCase {
|
||||
/// 测试日程管理页与新增排班页。
|
||||
func testScheduleManagementAndAddPage() {
|
||||
DebugMenuNavigator.open(app: app)
|
||||
DebugMenuNavigator.tapMenu(title: "日程管理", app: app)
|
||||
func testScheduleManagementAndAddPage() throws {
|
||||
app = try UITestSession.relaunch(openMenu: "日程管理")
|
||||
NavigationAssertions.waitForNavigationTitle("日程管理", in: app)
|
||||
|
||||
let addButton = app.application.buttons.matching(NSPredicate(format: "label CONTAINS '添加'")).firstMatch
|
||||
|
||||
@ -8,7 +8,7 @@ import XCTest
|
||||
final class TasksUITests: AuthenticatedUITestCase {
|
||||
/// 测试任务列表可进入详情,发布任务页可打开。
|
||||
func testTaskListDetailAndCreateValidation() throws {
|
||||
openTaskManagement()
|
||||
try openTaskManagement()
|
||||
|
||||
let firstCell = app.application.cells.element(boundBy: 0)
|
||||
if firstCell.waitForExistence(timeout: 10) {
|
||||
@ -19,14 +19,13 @@ final class TasksUITests: AuthenticatedUITestCase {
|
||||
throw XCTSkip("测试账号暂无任务数据,跳过详情流测试。")
|
||||
}
|
||||
|
||||
DebugMenuNavigator.open(app: app)
|
||||
DebugMenuNavigator.tapMenu(title: "发布任务", app: app)
|
||||
app = try UITestSession.relaunch(openMenu: "发布任务")
|
||||
NavigationAssertions.waitForNavigationTitle("发布任务", in: app)
|
||||
}
|
||||
|
||||
private func openTaskManagement() {
|
||||
DebugMenuNavigator.open(app: app)
|
||||
DebugMenuNavigator.tapMenu(title: "任务管理", app: app)
|
||||
/// 直达任务管理页。
|
||||
private func openTaskManagement() throws {
|
||||
app = try UITestSession.relaunch(openMenu: "任务管理")
|
||||
NavigationAssertions.waitForNavigationTitle("任务管理", in: app)
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,10 +7,10 @@ import XCTest
|
||||
|
||||
final class WalletUITests: AuthenticatedUITestCase {
|
||||
/// 测试钱包首页与提现表单校验。
|
||||
func testWalletWithdrawValidation() {
|
||||
openWallet()
|
||||
func testWalletWithdrawValidation() throws {
|
||||
try openWallet()
|
||||
|
||||
app.application.staticTexts["提现"].tap()
|
||||
UITestTapHelper.tapLabel("提现", in: app)
|
||||
NavigationAssertions.waitForNavigationTitle("提现申请", in: app)
|
||||
|
||||
let submitButton = app.application.buttons["提交提现申请"]
|
||||
@ -23,20 +23,20 @@ final class WalletUITests: AuthenticatedUITestCase {
|
||||
}
|
||||
|
||||
/// 测试银行卡与积分兑换二级页可打开。
|
||||
func testWalletSecondaryPages() {
|
||||
openWallet()
|
||||
func testWalletSecondaryPages() throws {
|
||||
try openWallet()
|
||||
|
||||
app.application.staticTexts["银行卡"].tap()
|
||||
UITestTapHelper.tapLabel("银行卡", in: app)
|
||||
NavigationAssertions.waitForNavigationTitle("银行卡设置", in: app)
|
||||
BackNavigator.goBack(app: app)
|
||||
|
||||
app.application.staticTexts["积分兑换"].tap()
|
||||
UITestTapHelper.tapLabel("积分兑换", in: app)
|
||||
NavigationAssertions.waitForNavigationTitle("积分兑换", in: app)
|
||||
}
|
||||
|
||||
private func openWallet() {
|
||||
DebugMenuNavigator.open(app: app)
|
||||
DebugMenuNavigator.tapMenu(title: "我的钱包", app: app)
|
||||
/// 直达钱包首页。
|
||||
private func openWallet() throws {
|
||||
app = try UITestSession.relaunch(openMenu: "我的钱包")
|
||||
NavigationAssertions.waitForNavigationTitle("我的钱包", in: app)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user