Skip to content

Commit 2d53d9f

Browse files
committed
test: add hardware connect journeys
1 parent 33fe152 commit 2d53d9f

3 files changed

Lines changed: 76 additions & 15 deletions

File tree

journeys/hardware-wallet/README.md

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,15 @@ The Bridge transport is HTTP (`TrezorBridgeTransport` → `http://127.0.0.1:2132
1313

1414
- **Reliably simulated**: the device itself (deterministic seed and label), the full
1515
wallet protocol (scan, connect, features, xpubs, watchers, signing), and therefore all
16-
home-screen UI behavior: tiles, balances, activity, indicators, sheets.
16+
home-screen UI behavior: tiles, balances, activity, indicators, sheets. This includes the
17+
Connect Hardware flow's Searching → Found → Paired steps (the device pairs without a code).
1718
- **Partially simulated**: the USB attach → auto-reconnect chain. The OS-level attach
1819
intent can be injected with `am start -a android.hardware.usb.action.USB_DEVICE_ATTACHED`,
1920
which drives the full in-app path (MainActivity → AppViewModel → reconnect loop), with
2021
the Bridge standing in for the transport.
2122
- **Not simulated**: kernel/libusbhost behavior, USB enumeration timing, permission
22-
grants, the OS app picker, and THP pairing (the Pair Device sheet). Those need a
23-
physical device.
23+
grants, the OS app picker, and the THP one-time pairing code (the inline Pair Device step
24+
of the connect flow). Those need a physical device.
2425

2526
Journey steps that start with `adb:` are device commands the runner executes verbatim
2627
instead of UI interactions.
@@ -47,19 +48,24 @@ instead of UI interactions.
4748
## Journeys
4849

4950
Run in this order — `connect-home-tile.xml` pairs the emulator that the later journeys
50-
rely on, `suggestion-intro-sheet.xml` and `settings-hardware-wallets.xml` each end by
51-
re-pairing after a forget, and `detail-overview.xml` runs last because its final Remove step
52-
forgets the device.
51+
rely on, `suggestion-intro-sheet.xml`, `connect-flow.xml` and `settings-hardware-wallets.xml`
52+
each end by re-pairing after a forget, and `detail-overview.xml` runs last because its final
53+
Remove step forgets the device.
5354

5455
| Journey | Covers |
5556
| - | - |
5657
| `connect-home-tile.xml` | Dev-screen connect, home tile, indicator, balance, detail screen opens |
5758
| `activity-blue-icons.xml` | Hardware activity merge, blue icons, All Activity filters, detail fallback |
5859
| `usb-reconnect.xml` | Disconnect indicator, injected USB attach intent → silent auto-reconnect |
59-
| `suggestion-intro-sheet.xml` | Forget device, Hardware suggestion card, connect intro sheet |
60+
| `suggestion-intro-sheet.xml` | Forget device, Hardware suggestion card, full connect flow (Searching → Found → Paired → Finish) re-pairs |
61+
| `connect-flow.xml` | Settings Add button → connect flow with an edited Label Funds → paired device count + name |
6062
| `settings-hardware-wallets.xml` | Payments count row, Hardware Wallets screen list, Add button sheet, per-row delete confirm + re-pair |
6163
| `detail-overview.xml` | Detail screen overview, Transfer placeholder, activity, Remove confirm + forget |
6264

65+
Connect-flow testTags: `hardware_sheet`, `hw_intro_screen`, `hw_searching_screen`,
66+
`hw_found_screen`, `hw_paired_screen`, `hw_paired_label_field`, `hw_paired_finish`,
67+
`hw_pair_screen` (inline pair code, physical device only).
68+
6369
To exercise the received-money sheet (not covered by a journey because it needs an
6470
out-of-band transfer), fund the emulator wallet on regtest from `bitkit-docker`, e.g.
6571
send to an address generated via Dev Settings → Trezor → Get Address, then mine a block
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<journey name="Hardware Wallet Connect Flow From Settings">
2+
<description>
3+
Verifies the Connect Hardware flow entered from Hardware Wallets settings: forgets the
4+
paired device so it can be rediscovered, opens Settings then Hardware Wallets, taps Add,
5+
and runs Searching, Found and Paired, editing the Label Funds field before finishing.
6+
Confirms the paired device is listed under its custom label, which re-pairs the emulator
7+
so later journeys can run. Requires a paired Bridge emulator (run connect-home-tile.xml
8+
first).
9+
</description>
10+
<actions>
11+
<action>
12+
Launch the Bitkit app, open the menu, navigate to Settings, then Dev Settings, then tap the "Trezor" row
13+
</action>
14+
<action>
15+
Tap the forget-device (trash) icon next to the known device, confirming any dialog, so the device becomes discoverable again
16+
</action>
17+
<action>
18+
Navigate back to Settings, open General, then Payments, then tap the "Hardware Wallets" row
19+
</action>
20+
<action>
21+
Verify the Hardware Wallets screen (testTag "HardwareWalletsScreen") shows no paired devices
22+
</action>
23+
<action>
24+
Tap the "Add Hardware Wallet" button (testTag "AddHardwareWallet")
25+
</action>
26+
<action>
27+
Verify a bottom sheet opens titled "Hardware Wallet" (testTag "hw_intro_screen"); tap the "Continue" button
28+
</action>
29+
<action>
30+
Verify the sheet advances to the "Connect Device" step (testTag "hw_searching_screen") headed "Searching for devices"
31+
</action>
32+
<action>
33+
Verify the sheet advances to the "Found Device" step (testTag "hw_found_screen") headed "Found Trezor" within 15 seconds, then tap "Connect"
34+
</action>
35+
<action>
36+
Verify the sheet advances to the "Device Connected" step (testTag "hw_paired_screen") headed "Paired Trezor", showing a balance and an editable "Label Funds" field, with no PIN or pairing prompt
37+
</action>
38+
<action>
39+
Clear the "Label Funds" field (testTag "hw_paired_label_field") and type "My Trezor"
40+
</action>
41+
<action>
42+
Tap the "Finish" button (testTag "hw_paired_finish") and verify the sheet closes back to the Hardware Wallets screen
43+
</action>
44+
<action>
45+
Verify the Hardware Wallets screen now lists one paired device named "My Trezor" with a green connection indicator
46+
</action>
47+
</actions>
48+
</journey>

journeys/hardware-wallet/suggestion-intro-sheet.xml

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
<journey name="Hardware Wallet Suggestion Card and Intro Sheet">
22
<description>
3-
Verifies the no-device home state: forgetting the paired device removes the
4-
hardware tile, the Hardware suggestion card appears, and tapping it opens the
5-
connect intro sheet with disabled Continue. Re-pairs the emulator at the end so
6-
other journeys can run afterwards. Requires a paired Bridge emulator.
3+
Verifies the no-device home state and the full Connect Hardware flow: forgetting the
4+
paired device removes the hardware tile, the Hardware suggestion card appears, and
5+
tapping it opens the connect intro sheet. Continuing runs Searching, Found and Paired,
6+
which re-pairs the emulator at the end so other journeys can run afterwards. Requires a
7+
paired Bridge emulator.
78
</description>
89
<actions>
910
<action>
@@ -31,16 +32,22 @@
3132
Verify the headline reads "Add your hardware wallet" with the words "hardware wallet" in blue
3233
</action>
3334
<action>
34-
Verify the "Continue" button appears disabled and tapping it does nothing
35+
Tap the "Continue" button and verify the sheet advances to the "Connect Device" step headed "Searching for devices", showing a loading animation and a "Cancel" button
3536
</action>
3637
<action>
37-
Tap the "Cancel" button and verify the sheet closes back to the home screen
38+
Verify the sheet advances to the "Found Device" step within 15 seconds, headed "Found Trezor" with a "Connect" button
3839
</action>
3940
<action>
40-
Open the menu, navigate to Settings, then Dev Settings, then tap the "Trezor" row, tap "Scan", and tap the discovered device to re-pair it
41+
Tap the "Connect" button
4142
</action>
4243
<action>
43-
Verify the device connects within 15 seconds
44+
Verify the sheet advances to the "Device Connected" step headed "Paired Trezor" within 15 seconds, showing a balance and an editable "Label Funds" field defaulting to the device name, with no PIN or pairing prompt
45+
</action>
46+
<action>
47+
Tap the "Finish" button and verify the sheet closes back to the home screen
48+
</action>
49+
<action>
50+
Verify the hardware wallet tile reappears beneath the SAVINGS and SPENDING tiles with the device name and a green connection indicator
4451
</action>
4552
</actions>
4653
</journey>

0 commit comments

Comments
 (0)