Files
suixinkan_ios_new/suixinkanUITests/Support/BackNavigator.swift
汉秋 0c01ee26c3 新增完整 UI Test 回归套件,并完善启动隔离逻辑。
按模块拆分 XCUITest 用例与 Support 基础设施,UI Test 运行时跳过推送与排队 WebSocket,并将 Podfile 最低版本对齐 iOS 16。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-26 10:45:00 +08:00

35 lines
1.2 KiB
Swift
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//
// BackNavigator.swift
// suixinkanUITests
//
// Created by Codex on 2026/6/26.
//
import XCTest
///
enum BackNavigator {
///
static func goBack(app: SuixinkanApp, file: StaticString = #filePath, line: UInt = #line) {
let navigationBar = app.application.navigationBars.element(boundBy: 0)
guard navigationBar.exists else {
XCTFail("当前页面没有可返回的导航栏。", file: file, line: line)
return
}
let backButton = navigationBar.buttons.element(boundBy: 0)
XCTAssertTrue(backButton.waitForExistence(timeout: 4), "未找到返回按钮。", file: file, line: line)
backButton.tap()
app.waitForGlobalLoadingToDisappear()
}
///
static func dismissCustomTopBarIfNeeded(app: SuixinkanApp) {
let backCandidates = app.application.buttons.matching(NSPredicate(format: "label CONTAINS 'chevron.left'"))
if backCandidates.count > 0 {
backCandidates.element(boundBy: 0).tap()
app.waitForGlobalLoadingToDisappear()
}
}
}