From a7e8b11489f89331ec35bbe12a7d2d53cb95ab8e Mon Sep 17 00:00:00 2001 From: Sarah GLINER Date: Fri, 19 Apr 2024 14:21:48 +0200 Subject: [PATCH] Tests: update with latest changes --- tests/ragger_bitcoin/ragger_instructions.py | 23 ++++++++++++++------- tests/test_get_pubkey.py | 6 +++--- tests/test_sign.py | 5 ++++- tests/test_sign_message.py | 2 +- 4 files changed, 23 insertions(+), 13 deletions(-) diff --git a/tests/ragger_bitcoin/ragger_instructions.py b/tests/ragger_bitcoin/ragger_instructions.py index 15af4509..545902e6 100644 --- a/tests/ragger_bitcoin/ragger_instructions.py +++ b/tests/ragger_bitcoin/ragger_instructions.py @@ -42,30 +42,37 @@ def navigate_end_of_flow(self, save_screenshot=True): self.new_request("Processing", NavInsID.USE_CASE_REVIEW_TAP, NavInsID.USE_CASE_REVIEW_TAP, save_screenshot=save_screenshot) - def confirm_transaction(self, save_screenshot=True): - self.new_request("Sign", NavInsID.USE_CASE_REVIEW_TAP, NavInsID.USE_CASE_REVIEW_CONFIRM, + def review_start(self, output_count: int = 1, save_screenshot=True): + self.new_request("Review", NavInsID.USE_CASE_REVIEW_TAP, NavInsID.USE_CASE_REVIEW_TAP, save_screenshot=save_screenshot) - self.new_request("TRANSACTION", NavInsID.USE_CASE_REVIEW_TAP, - NavInsID.USE_CASE_STATUS_DISMISS, + for _ in range(0, output_count): + self.same_request("Amount", NavInsID.USE_CASE_REVIEW_TAP, NavInsID.USE_CASE_REVIEW_TAP, + save_screenshot=save_screenshot) + def review_fees(self, fees_on_same_request: bool = True, save_screenshot=True): + if fees_on_same_request: + self.same_request("Fees", NavInsID.USE_CASE_REVIEW_TAP, NavInsID.USE_CASE_REVIEW_TAP, + save_screenshot=save_screenshot) + else: + self.new_request("Fees", NavInsID.USE_CASE_REVIEW_TAP, NavInsID.USE_CASE_REVIEW_TAP, save_screenshot=save_screenshot) - def same_request_confirm_transaction(self, save_screenshot=True): + def confirm_transaction(self, save_screenshot=True): self.same_request("Sign", NavInsID.USE_CASE_REVIEW_TAP, NavInsID.USE_CASE_REVIEW_CONFIRM, save_screenshot=save_screenshot) - self.new_request("TRANSACTION", NavInsID.USE_CASE_REVIEW_TAP, + self.new_request("Transaction", NavInsID.USE_CASE_REVIEW_TAP, NavInsID.USE_CASE_STATUS_DISMISS, save_screenshot=save_screenshot) def confirm_message(self, save_screenshot=True): self.new_request("Sign", NavInsID.USE_CASE_REVIEW_TAP, NavInsID.USE_CASE_REVIEW_CONFIRM, save_screenshot=save_screenshot) - self.new_request("MESSAGE", NavInsID.USE_CASE_REVIEW_TAP, + self.new_request("Message", NavInsID.USE_CASE_REVIEW_TAP, NavInsID.USE_CASE_STATUS_DISMISS, save_screenshot=save_screenshot) def confirm_wallet(self, save_screenshot=True): self.new_request("Approve", NavInsID.USE_CASE_REVIEW_TAP, NavInsID.USE_CASE_REVIEW_CONFIRM, save_screenshot=save_screenshot) - self.same_request("WALLET", NavInsID.USE_CASE_REVIEW_TAP, + self.same_request("Wallet", NavInsID.USE_CASE_REVIEW_TAP, NavInsID.USE_CASE_STATUS_DISMISS, save_screenshot=save_screenshot) def reject_message(self, save_screenshot=True): diff --git a/tests/test_get_pubkey.py b/tests/test_get_pubkey.py index 199e724e..40c82777 100644 --- a/tests/test_get_pubkey.py +++ b/tests/test_get_pubkey.py @@ -12,7 +12,7 @@ def pubkey_instruction_approve(model: Firmware) -> Instructions: instructions.new_request("Approve") else: instructions.address_confirm() - instructions.same_request("ADDRESS", NavInsID.USE_CASE_REVIEW_TAP, + instructions.same_request("Address", NavInsID.USE_CASE_REVIEW_TAP, NavInsID.USE_CASE_STATUS_DISMISS) return instructions @@ -24,11 +24,11 @@ def pubkey_instruction_warning_approve(model: Firmware) -> Instructions: instructions.new_request("Approve") instructions.same_request("Approve") else: - instructions.new_request("Unusual", NavInsID.USE_CASE_REVIEW_TAP, + instructions.new_request("Unusual", NavInsID.USE_CASE_CHOICE_CONFIRM, NavInsID.USE_CASE_CHOICE_CONFIRM) instructions.same_request("Confirm", NavInsID.USE_CASE_ADDRESS_CONFIRMATION_TAP, NavInsID.USE_CASE_ADDRESS_CONFIRMATION_CONFIRM) - instructions.same_request("ADDRESS", NavInsID.USE_CASE_REVIEW_TAP, + instructions.same_request("Address", NavInsID.USE_CASE_REVIEW_TAP, NavInsID.USE_CASE_STATUS_DISMISS) return instructions diff --git a/tests/test_sign.py b/tests/test_sign.py index c9749c83..1a58f3b9 100644 --- a/tests/test_sign.py +++ b/tests/test_sign.py @@ -21,6 +21,8 @@ def sign_psbt_instruction_approve(model: Firmware) -> Instructions: instructions.new_request("Accept") instructions.same_request("Accept") else: + instructions.review_start() + instructions.review_fees() instructions.confirm_transaction() return instructions @@ -32,7 +34,8 @@ def sign_psbt_instruction_approve_2(model: Firmware) -> Instructions: instructions.new_request("Accept") instructions.new_request("Accept") else: - instructions.navigate_end_of_flow() + instructions.review_start() + instructions.review_fees(fees_on_same_request=False) instructions.confirm_transaction() return instructions diff --git a/tests/test_sign_message.py b/tests/test_sign_message.py index aed234a9..aceb59f6 100644 --- a/tests/test_sign_message.py +++ b/tests/test_sign_message.py @@ -14,7 +14,7 @@ def message_instruction_approve(model: Firmware) -> Instructions: instructions.same_request("Sign") else: instructions.address_confirm() - instructions.same_request("ADDRESS", NavInsID.USE_CASE_REVIEW_TAP, + instructions.same_request("Address", NavInsID.USE_CASE_REVIEW_TAP, NavInsID.USE_CASE_STATUS_DISMISS) instructions.confirm_message() return instructions