Files
suixinkan_ios_new/suixinkanUITests/Orders/OrdersFlowUITests.swift
汉秋 8997d1ba1c 集成 MJRefresh 并重构主 TabBar 为系统 TabView 样式。
新增 SwiftUI 桥接层与单元测试,更新 Tab 图标资源命名和多倍图,同步调整 UI Test 的 Tab/扫码定位逻辑。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-29 10:22:53 +08:00

79 lines
2.9 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.

//
// OrdersFlowUITests.swift
// suixinkanUITests
//
import XCTest
final class OrdersFlowUITests: AuthenticatedUITestCase {
///
func testStoreOrderDetailFlow() throws {
TabBarNavigator.select(.orders, app: app)
app.application.staticTexts["订单管理"].tap()
app.waitForGlobalLoadingToDisappear()
let firstOrderCard = app.application.otherElements
.matching(NSPredicate(format: "identifier BEGINSWITH 'orders.store.card.'"))
.firstMatch
if !firstOrderCard.waitForExistence(timeout: 10) {
throw XCTSkip("测试账号当前景区下暂无门店订单,跳过详情流测试。")
}
firstOrderCard.tap()
NavigationAssertions.waitForNavigationTitle("订单详情", in: app)
BackNavigator.goBack(app: app)
}
///
func testWriteOffOrderDetailFlow() throws {
TabBarNavigator.select(.orders, app: app)
app.application.staticTexts["核销订单"].tap()
app.waitForGlobalLoadingToDisappear()
let firstDetailButton = app.application.buttons
.matching(NSPredicate(format: "identifier BEGINSWITH 'orders.writeoff.detail.'"))
.firstMatch
if !firstDetailButton.waitForExistence(timeout: 10) {
throw XCTSkip("测试账号当前景区下暂无核销订单,跳过详情流测试。")
}
firstDetailButton.tap()
NavigationAssertions.waitForNavigationTitle("核销订单详情", in: app)
BackNavigator.goBack(app: app)
}
///
func testDepositOrderFlow() throws {
app = try UITestSession.relaunch(openMenu: "押金订单详情")
NavigationAssertions.waitForNavigationTitle("押金订单", in: app)
let firstCell = app.application.cells.element(boundBy: 0)
if firstCell.waitForExistence(timeout: 8) {
firstCell.tap()
NavigationAssertions.waitForNavigationTitle("押金订单详情", in: app)
BackNavigator.goBack(app: app)
} else {
throw XCTSkip("测试账号暂无押金订单,跳过详情流测试。")
}
}
/// Tab
func testScannerCanOpenAndCloseWithoutChangingCurrentTab() {
TabBarNavigator.select(.home, app: app)
let scanButton = TabBarNavigator.scannerButton(in: app)
XCTAssertTrue(scanButton.waitForExistence(timeout: 6))
scanButton.tap()
let closeButton = app.application.buttons["scanner.close"]
XCTAssertTrue(closeButton.waitForExistence(timeout: 8))
closeButton.tap()
XCTAssertTrue(
app.application.staticTexts["常用应用"].waitForExistence(timeout: 8)
|| app.application.staticTexts["请选择景区"].exists
)
}
}