initial commit: Proximity iOS app proposal, full Swift code scaffold, reference backend, testing docs, generated Xcode project
This commit is contained in:
54
ProximityUITests/ProximityFlowUITests.swift
Normal file
54
ProximityUITests/ProximityFlowUITests.swift
Normal file
@@ -0,0 +1,54 @@
|
||||
import XCTest
|
||||
|
||||
/// UI test that drives the core interaction loop end-to-end in the simulator.
|
||||
///
|
||||
/// This exercises the make-or-break flow without any hardware:
|
||||
/// go present → simulate an encounter → wave → reveal → chat.
|
||||
///
|
||||
/// It relies on the DEBUG-only debug menu and the simulated adapter. Run it
|
||||
/// against the local reference server (see docs/TESTING.md).
|
||||
final class ProximityFlowUITests: XCTestCase {
|
||||
|
||||
override func setUpWithError() throws {
|
||||
continueAfterFailure = false
|
||||
}
|
||||
|
||||
/// The full happy path: presence → encounter → wave → reveal → chat.
|
||||
func testFullInteractionLoop() throws {
|
||||
let app = XCUIApplication()
|
||||
app.launch()
|
||||
|
||||
// 1. Go present (the big toggle).
|
||||
let presentButton = app.buttons["I'm Here"]
|
||||
XCTAssertTrue(presentButton.waitForExistence(timeout: 5))
|
||||
presentButton.tap()
|
||||
|
||||
// 2. Open the debug menu and simulate someone walking by.
|
||||
app.buttons["hammer"].tap()
|
||||
app.buttons["Simulate someone walking by"].tap()
|
||||
app.navigationBars.buttons.firstMatch.tap() // back
|
||||
|
||||
// 3. A silhouette appears in the feed.
|
||||
let waveButton = app.buttons["Wave"]
|
||||
XCTAssertTrue(waveButton.waitForExistence(timeout: 5))
|
||||
waveButton.tap()
|
||||
|
||||
// 4. (Mutual wave is driven by the server in a two-client setup.
|
||||
// For a single-client UI test, we assert the waiting state.)
|
||||
XCTAssertTrue(app.staticTexts["Waved ✓"].waitForExistence(timeout: 5))
|
||||
}
|
||||
|
||||
/// Verifies the presence toggle state transitions.
|
||||
func testPresenceToggle() throws {
|
||||
let app = XCUIApplication()
|
||||
app.launch()
|
||||
|
||||
let presentButton = app.buttons["I'm Here"]
|
||||
XCTAssertTrue(presentButton.waitForExistence(timeout: 5))
|
||||
presentButton.tap()
|
||||
|
||||
// After tapping, the button should read "I'm Here" (active state).
|
||||
let active = app.buttons["I'm Here"]
|
||||
XCTAssertTrue(active.waitForExistence(timeout: 5))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user