1818from pathlib import Path
1919from urllib .parse import quote
2020
21- from qml_test_harness import QmlTestHarness , dump_qml_tree
21+ from qml_test_harness import QmlTestHarness , StepScreenshotRecorder , dump_qml_tree
2222
2323REPO_ROOT = Path (__file__ ).resolve ().parents [2 ]
2424BITCOIN_FUNCTIONAL_PATH = REPO_ROOT / "bitcoin" / "test" / "functional"
@@ -42,6 +42,10 @@ def parse_args():
4242 "--socket-path" ,
4343 help = "Attach to an existing bridge socket. Not supported by this test." ,
4444 )
45+ parser .add_argument (
46+ "--screenshot-dir" ,
47+ help = "If set, save step screenshots (PNG) into this directory." ,
48+ )
4549 return parser .parse_args ()
4650
4751
@@ -120,29 +124,34 @@ def run_tests():
120124 try :
121125 harness .start ()
122126 gui = harness .driver
127+ shots = StepScreenshotRecorder (gui , args .screenshot_dir )
123128
124129 rpc , wallet_rpc = connect_rpc (harness .datadir , harness .rpc_port )
125130 ensure_wallet_loaded (rpc )
126131
127132 wait_for_gui_wallet_ready (gui )
133+ shots .capture ("wallet_ready" )
128134
129135 # Fund the wallet with mature coinbase funds.
130136 funding_addr = wallet_rpc .getnewaddress ("qml-e2e-funding" , "bech32" )
131137 rpc .generatetoaddress (101 , funding_addr )
132138
133139 # Capture baseline activity count in UI.
134140 select_wallet_tab (gui , "walletActivityTab" , "activityListView" )
141+ shots .capture ("activity_before" )
135142 activity_count_before = int (gui .get_property ("activityListView" , "count" ))
136143
137144 # Receive flow: create request/address via QML.
138145 select_wallet_tab (gui , "walletReceiveTab" , "walletRequestPaymentPage" )
146+ shots .capture ("receive_page" )
139147 gui .set_text ("receiveAmountInput" , str (SEND_AMOUNT_BTC ))
140148 gui .set_text ("receiveLabelInput" , RECEIVE_LABEL )
141149 gui .set_text ("receiveMessageInput" , RECEIVE_MESSAGE )
142150 gui .click ("receiveCreateAddressButton" )
143151 receive_address_text = gui .wait_for_property (
144152 "receiveAddressText" , "text" , timeout_ms = 15000 , non_empty = True
145153 )
154+ shots .capture ("receive_request_created" )
146155 receive_address = normalize_address (receive_address_text )
147156 assert receive_address , "Receive address is empty"
148157 assert rpc .validateaddress (receive_address )["isvalid" ], "Receive address is invalid"
@@ -156,10 +165,13 @@ def run_tests():
156165 gui .set_text ("sendAddressInput" , receive_address )
157166 gui .set_text ("sendAmountInput" , str (SEND_AMOUNT_BTC ))
158167 gui .set_text ("sendNoteInput" , SEND_NOTE )
168+ shots .capture ("send_form_filled" )
159169 gui .click ("sendContinueButton" )
160170 gui .wait_for_page ("walletSendReviewPage" , timeout_ms = 15000 )
171+ shots .capture ("send_review" )
161172 gui .click ("sendConfirmButton" )
162173 gui .wait_for_page ("sendResultPopup" , timeout_ms = 15000 )
174+ shots .capture ("send_result_popup" )
163175 gui .click ("sendResultCloseButton" )
164176
165177 sent_txid = {"value" : None }
@@ -197,6 +209,7 @@ def find_sent_tx():
197209 lambda : int (gui .get_property ("activityListView" , "count" )) > activity_count_before ,
198210 timeout = 30 ,
199211 )
212+ shots .capture ("activity_after" )
200213
201214 print ("\n " + "=" * 50 )
202215 print ("QML send/receive E2E PASSED" )
0 commit comments