Skip to content

Commit f162a0e

Browse files
test(ui): retry zkEVM receipt while still processing
On CI the receipt query can return 'Status: Still processing' and stay that way until re-queried. Tap GetReceiptButton in a loop until Success (or a terminal failure) before asserting.
1 parent 738e94b commit f162a0e

1 file changed

Lines changed: 23 additions & 9 deletions

File tree

sample/Tests/test/test.py

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -372,16 +372,30 @@ def test_3_zkevm_functions(self):
372372
# Get transaction receipt
373373
hash = self.altdriver.wait_for_object(By.NAME, "HashInput")
374374
hash.set_text(transactionHash)
375-
self.altdriver.find_object(By.NAME, "GetReceiptButton").tap()
375+
receipt_button = self.altdriver.find_object(By.NAME, "GetReceiptButton")
376376
output = self.altdriver.find_object(By.NAME, "Output")
377-
text = self.wait_for_output(
378-
output,
379-
lambda t: t == "Status: Success"
380-
or t == "Status: Failed"
381-
or t.startswith("Error")
382-
or t.startswith("Failed"),
383-
timeout_seconds=90,
384-
)
377+
# The receipt endpoint can legitimately return "Still processing" for a while.
378+
# Re-query until it reaches a terminal status.
379+
deadline = time.time() + 120.0
380+
text = ""
381+
while time.time() < deadline:
382+
receipt_button.tap()
383+
text = self.wait_for_output(
384+
output,
385+
lambda t: len(t) > 0,
386+
timeout_seconds=5,
387+
poll_seconds=0.25,
388+
)
389+
if text == "Status: Success":
390+
break
391+
if (
392+
text == "Status: Failed"
393+
or text.startswith("Error")
394+
or text.startswith("Failed")
395+
):
396+
break
397+
# Still processing (or some other intermediate state) — retry.
398+
time.sleep(2)
385399
print(f"Get transaction receipt output: {text}")
386400
self.assertEqual("Status: Success", text)
387401

0 commit comments

Comments
 (0)