From 89877013e7881ea2732b665ad6a8a7d2785594fe Mon Sep 17 00:00:00 2001 From: Ossie Irondi Date: Wed, 11 Nov 2026 08:32:31 -0600 Subject: [PATCH 1/2] test(hush-ios): a copied value survives the real background lock and pastes Presses Home so the scene phase drives the background lock, returns, unlocks, and pastes through the system Paste menu. Fails on the code before #105 (TestFlight build 3) and passes on main. --- hush-ios/Tests/UITests/HushUITests.swift | 28 ++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/hush-ios/Tests/UITests/HushUITests.swift b/hush-ios/Tests/UITests/HushUITests.swift index 630c340..0073e9a 100644 --- a/hush-ios/Tests/UITests/HushUITests.swift +++ b/hush-ios/Tests/UITests/HushUITests.swift @@ -79,6 +79,34 @@ import XCTest XCTAssertFalse(element("detail-value-masked").exists) } + /// Copy, leave for the Home Screen, and come back. The background lock must leave the copy, so + /// the system Paste menu pastes it at once. + func testCopiedValueSurvivesLeavingTheAppAndPastes() { + launch("saved") + unlock() + rows().element(boundBy: 0).tap() + XCTAssertTrue(element("reveal-button").waitForExistence(timeout: 5)) + element("reveal-button").tap() + XCTAssertTrue(element("detail-value").waitForExistence(timeout: 2)) + let copied = element("detail-value").label + element("copy-button").tap() + XCTAssertTrue(element("copied-status").waitForExistence(timeout: 2)) + + XCUIDevice.shared.press(.home) + XCTAssertTrue(app.wait(for: .runningBackground, timeout: 5) || app.wait(for: .runningBackgroundSuspended, timeout: 5)) + app.activate() + unlock() + app.buttons["add-button"].tap() + let key = app.textFields["draft-key"] + XCTAssertTrue(key.waitForExistence(timeout: 5)) + key.tap() + key.press(forDuration: 1.2) + let paste = app.menuItems["Paste"] + XCTAssertTrue(paste.waitForExistence(timeout: 3), "the pasteboard is empty after leaving Hush") + paste.tap() + XCTAssertEqual(key.value as? String, copied) + } + /// Empty save marks the field and keeps the draft. A good save opens the new secret, masked. func testAddValidatesThenOpensTheNewSecret() { launch("saved") From a3251675fa4e8fc3030eb44b41bcc9df7dee0a66 Mon Sep 17 00:00:00 2001 From: Ossie Irondi Date: Wed, 11 Nov 2026 09:46:47 -0600 Subject: [PATCH 2/2] test(hush-ios): wait for either background state at once --- hush-ios/Tests/UITests/HushUITests.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hush-ios/Tests/UITests/HushUITests.swift b/hush-ios/Tests/UITests/HushUITests.swift index 0073e9a..f7a1c48 100644 --- a/hush-ios/Tests/UITests/HushUITests.swift +++ b/hush-ios/Tests/UITests/HushUITests.swift @@ -93,7 +93,9 @@ import XCTest XCTAssertTrue(element("copied-status").waitForExistence(timeout: 2)) XCUIDevice.shared.press(.home) - XCTAssertTrue(app.wait(for: .runningBackground, timeout: 5) || app.wait(for: .runningBackgroundSuspended, timeout: 5)) + let backgroundStates = [XCUIApplication.State.runningBackground, .runningBackgroundSuspended].map(\.rawValue) + let inBackground = XCTNSPredicateExpectation(predicate: NSPredicate(format: "state IN %@", backgroundStates), object: app) + XCTAssertEqual(XCTWaiter().wait(for: [inBackground], timeout: 5), .completed) app.activate() unlock() app.buttons["add-button"].tap()