| 1 | import XCTest |
| 2 | |
| 3 | /// The unlocked foreground half only. Real APNs, Face ID and hidden previews |
| 4 | /// remain a physical-device gate before enabling production capability. |
| 5 | final class NotificationActionUITests: XCTestCase { |
| 6 | @MainActor func testBoundQuestionShowsItsOptions() { |
| 7 | let app = XCUIApplication() |
| 8 | app.launchEnvironment["EQUIPO_NOTIFICATION_FIXTURE"] = "question" |
| 9 | app.launch() |
| 10 | defer { app.terminate() } |
| 11 | XCTAssertTrue(app.staticTexts["Should the badge clear when you switch teams too?"].waitForExistence(timeout: 10)) |
| 12 | XCTAssertTrue(app.buttons["Clear it when switching teams"].exists) |
| 13 | XCTAssertTrue(app.buttons["Keep each team’s count"].exists) |
| 14 | capture("iphone-notification-question") |
| 15 | } |
| 16 | @MainActor func testMergeShowsFreshEvidenceBeforeFinalTap() { |
| 17 | let app = XCUIApplication() |
| 18 | app.launchEnvironment["EQUIPO_NOTIFICATION_FIXTURE"] = "merge" |
| 19 | app.launch() |
| 20 | defer { app.terminate() } |
| 21 | XCTAssertTrue(app.buttons["task-confirm"].waitForExistence(timeout: 10)) |
| 22 | XCTAssertTrue(app.staticTexts["Approved"].firstMatch.exists) |
| 23 | XCTAssertTrue(app.staticTexts.matching(NSPredicate(format: "label BEGINSWITH %@", "The badge now resets when the person signs out.")).firstMatch.exists) |
| 24 | XCTAssertTrue(app.staticTexts["equipo/needs-badge-sign-out"].exists) |
| 25 | XCTAssertTrue(app.staticTexts["3f9c2a167de8"].exists) |
| 26 | capture("iphone-notification-merge") |
| 27 | app.buttons["task-confirm"].tap() |
| 28 | XCTAssertTrue(app.buttons["task-confirm"].waitForNonExistence(timeout: 5)) |
| 29 | } |
| 30 | @MainActor private func capture(_ name: String) { |
| 31 | let attachment = XCTAttachment(screenshot: XCUIScreen.main.screenshot()) |
| 32 | attachment.name = name; attachment.lifetime = .keepAlways; add(attachment) |
| 33 | } |
| 34 | } |
| 35 | |