Files
hash-wallet/ios/RunnerUITests/HashBagsScreenshotsUITests.swift
T
jwinterm c396e94b77 Add store capture harness: record real wallet flows into screenshots + video
Drives the real app through real flows on a device while recording the screen,
then cuts ONE recording into both deliverables — store screenshots and
marketing video — so a listing can't drift out of sync with its own trailer.

integration_test/demo/
  DemoSession adds what a passing test lacks: pacing (beat/hold/typeSlowly, so
  footage is watchable rather than a strobe), timing marks reported through
  binding.reportData, and seed guards. Scenarios reuse the existing 25 page
  robots rather than reimplementing navigation:
    core_store_set     dashboard, receive, send (composed, NEVER broadcast),
                       wallets, security — the store screenshot set
    onboarding_create  welcome -> PIN -> seed -> dashboard
    restore_from_seed  restore -> syncing
    swap_and_buy       Trocador quote, stopping BEFORE creating a trade; Buy
                       skipped when no provider key, matching what reviewers see

tools/demo/
  capture.sh   orchestrates boot/record/cut/shots/reel
  marks.py     maps timing marks onto the recording; cuts, extracts frames,
               builds manifests
  reel.py      branded master; reuses such_graphics video_transitions/video_qa
               when ~/src/such-graphics is present, degrades cleanly when not
               (this repo is public and must build without it)
  build-apk.sh local APK via the CI container image

Seed safety — the demo wallet is a real wallet with real funds:
  - seed comes from Vaultwarden at capture time, never the repo
  - guardNoSeedOnScreen() fails the run on a visible mnemonic, catching both
    the known seed and the generic shape of one (so freshly generated seeds
    are caught too)
  - unavoidable seed screens are wrapped in blindfold(); those spans are
    excised from the video with 0.6s padding, and screenshots honour the same
    padding
  - marks.py refuses to build a publishable master if any clip was cut without
    marks, since blindfold spans could not have been excised

Apple App Preview gets no touch indicators, captions, cards or music, and
reel.py enforces the 15-30s window rather than emitting an out-of-spec file.
Everything else keeps taps on, drawn by SurfaceFlinger via show_touches rather
than composited, so they look real.

Play sizing: the harness builds its own 1080x1920 AVD. The stock Medium Phone
AVD is 1080x2400 = 2.22:1 and Play rejects phone screenshots above 2:1.

Also gitignores android/app/upload-keystore.jks (and *.jks/*.keystore): the
Android workflow decodes ANDROID_KEYSTORE_BASE64 to exactly that path, so the
Play upload signing key was one `git add -A` away from being committed.
2026-07-31 15:25:29 -04:00

71 lines
2.4 KiB
Swift

import XCTest
// fastlane snapshot UI test for Hash Bags.
//
// IMPORTANT — Flutter caveat: Flutter renders the whole UI into ONE native view.
// XCUITest finds "elements" only through the ACCESSIBILITY tree. So for taps to
// work you must either (a) match by the visible label text, or (b) add
// Semantics(identifier: 'send_button') around the widgets you drive. Wallet flows
// (create/restore, PIN) are painful to automate, so the recommended pattern is to
// launch straight into a screenshot-ready DEMO wallet via a launch argument that
// the Flutter app recognizes (see store/SCREENSHOTS.md), then shoot the key
// screens. Adjust identifiers/waits to match the actual UI.
final class HashBagsScreenshotsUITests: XCTestCase {
var app: XCUIApplication!
override func setUpWithError() throws {
continueAfterFailure = false
app = XCUIApplication()
setupSnapshot(app) // from SnapshotHelper.swift (fastlane snapshot init)
// Tell the Flutter app to restore a demo wallet + skip onboarding so the
// shots show a real dashboard. Handle this arg in Dart (see the guide).
app.launchArguments += ["--dart-define=SCREENSHOT_MODE=true", "FASTLANE_SNAPSHOT"]
app.launch()
}
func testScreenshots() throws {
// 1) Home / dashboard — wait for it to settle, then shoot.
_ = app.otherElements["home_dashboard"].waitForExistence(timeout: 45)
snapshot("01-Home")
// 2) Receive
tapFirst(["Receive", "receive_action"])
snapshot("02-Receive")
goBack()
// 3) Send
tapFirst(["Send", "send_action"])
snapshot("03-Send")
goBack()
// 4) Swap (Trocador)
tapFirst(["Swap", "exchange_action"])
snapshot("04-Swap")
goBack()
// 5) Settings
tapFirst(["Settings", "settings_action"])
snapshot("05-Settings")
}
// MARK: - helpers
/// Tap the first element (button or generic) matching any of the given
/// accessibility labels/identifiers.
private func tapFirst(_ names: [String], timeout: TimeInterval = 15) {
for n in names {
let btn = app.buttons[n]
if btn.waitForExistence(timeout: 2) { btn.tap(); return }
let any = app.descendants(matching: .any)[n]
if any.exists { any.tap(); return }
}
XCTFail("Could not find any of: \(names). Add a Semantics(identifier:) to that widget.")
}
private func goBack() {
let back = app.navigationBars.buttons.element(boundBy: 0)
if back.waitForExistence(timeout: 3) { back.tap() }
}
}