import XCTest import UIKit /// 访问真实观察包;不使用 --UITesting,不注入 token,不调用购买接口。 final class IGBusinessRegressionTests: XCTestCase { private let bundleID = "cn.touchv.iosguard.observe.20261110" override func setUpWithError() throws { continueAfterFailure = false } private func capture(_ app: XCUIApplication, _ name: String) { // 截图遮盖输入框,文本树移除输入值,避免登录排查留存凭证。 let source = app.screenshot().image let fields = app.textFields.allElementsBoundByIndex + app.secureTextFields.allElementsBoundByIndex let screenshotImage = UIGraphicsImageRenderer(size: source.size).image { context in source.draw(at: .zero) UIColor.lightGray.setFill() let sx = source.size.width / app.frame.width let sy = source.size.height / app.frame.height for field in fields { let frame = field.frame context.fill(CGRect(x: frame.minX * sx, y: frame.minY * sy, width: frame.width * sx, height: frame.height * sy)) } } let screenshot = XCTAttachment(image: screenshotImage) screenshot.name = name screenshot.lifetime = .keepAlways add(screenshot) let redactedTree = app.debugDescription.components(separatedBy: "\n").map { line in guard line.contains("TextField"), let value = line.range(of: ", value:") else { return line } return String(line[..