mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-22 14:28:07 +00:00
feat(tests): add test for going back from Ethereum summary page
[no changelog]
This commit is contained in:
parent
747fd17214
commit
de16ee69e6
@ -27,6 +27,7 @@ from ...input_flows import (
|
|||||||
InputFlowEthereumSignTxDataGoBack,
|
InputFlowEthereumSignTxDataGoBack,
|
||||||
InputFlowEthereumSignTxDataScrollDown,
|
InputFlowEthereumSignTxDataScrollDown,
|
||||||
InputFlowEthereumSignTxDataSkip,
|
InputFlowEthereumSignTxDataSkip,
|
||||||
|
InputFlowEthereumSignTxGoBackFromSummary,
|
||||||
InputFlowEthereumSignTxShowFeeInfo,
|
InputFlowEthereumSignTxShowFeeInfo,
|
||||||
)
|
)
|
||||||
from .common import encode_network
|
from .common import encode_network
|
||||||
@ -90,11 +91,9 @@ def _do_test_signtx(
|
|||||||
assert sig_v == result["sig_v"]
|
assert sig_v == result["sig_v"]
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.skip_t1("T1 does not support input flows")
|
# Data taken from sign_tx_eip1559.json["tests"][0]
|
||||||
def test_signtx_fee_info(client: Client):
|
example_input_data = {
|
||||||
input_flow = InputFlowEthereumSignTxShowFeeInfo(client).get()
|
"parameters": {
|
||||||
# Data taken from sign_tx_eip1559.json["tests"][0]
|
|
||||||
parameters = {
|
|
||||||
"chain_id": 1,
|
"chain_id": 1,
|
||||||
"path": "m/44'/60'/0'/0/0",
|
"path": "m/44'/60'/0'/0/0",
|
||||||
"nonce": "0x0",
|
"nonce": "0x0",
|
||||||
@ -104,13 +103,35 @@ def test_signtx_fee_info(client: Client):
|
|||||||
"to_address": "0x8eA7a3fccC211ED48b763b4164884DDbcF3b0A98",
|
"to_address": "0x8eA7a3fccC211ED48b763b4164884DDbcF3b0A98",
|
||||||
"tx_type": None,
|
"tx_type": None,
|
||||||
"data": "",
|
"data": "",
|
||||||
}
|
},
|
||||||
result = {
|
"result": {
|
||||||
"sig_v": 38,
|
"sig_v": 38,
|
||||||
"sig_r": "6a6349bddb5749bb8b96ce2566a035ef87a09dbf89b5c7e3dfdf9ed725912f24",
|
"sig_r": "6a6349bddb5749bb8b96ce2566a035ef87a09dbf89b5c7e3dfdf9ed725912f24",
|
||||||
"sig_s": "4ae58ccd3bacee07cdc4a3e8540544fd009c4311af7048122da60f2054c07ee4",
|
"sig_s": "4ae58ccd3bacee07cdc4a3e8540544fd009c4311af7048122da60f2054c07ee4",
|
||||||
}
|
},
|
||||||
_do_test_signtx(client, parameters, result, input_flow)
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.skip_t1("T1 does not support input flows")
|
||||||
|
def test_signtx_fee_info(client: Client):
|
||||||
|
input_flow = InputFlowEthereumSignTxShowFeeInfo(client).get()
|
||||||
|
_do_test_signtx(
|
||||||
|
client,
|
||||||
|
example_input_data["parameters"],
|
||||||
|
example_input_data["result"],
|
||||||
|
input_flow,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.skip_t1("T1 does not support input flows")
|
||||||
|
def test_signtx_go_back_from_summary(client: Client):
|
||||||
|
input_flow = InputFlowEthereumSignTxGoBackFromSummary(client).get()
|
||||||
|
_do_test_signtx(
|
||||||
|
client,
|
||||||
|
example_input_data["parameters"],
|
||||||
|
example_input_data["result"],
|
||||||
|
input_flow,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@parametrize_using_common_fixtures("ethereum/sign_tx_eip1559.json")
|
@parametrize_using_common_fixtures("ethereum/sign_tx_eip1559.json")
|
||||||
|
@ -834,14 +834,21 @@ class InputFlowEIP712Cancel(InputFlowBase):
|
|||||||
|
|
||||||
|
|
||||||
class InputFlowEthereumSignTxShowFeeInfo(InputFlowBase):
|
class InputFlowEthereumSignTxShowFeeInfo(InputFlowBase):
|
||||||
def __init__(self, client: Client, cancel: bool = False):
|
def __init__(self, client: Client):
|
||||||
super().__init__(client)
|
super().__init__(client)
|
||||||
self.cancel = cancel
|
|
||||||
|
|
||||||
def input_flow_common(self) -> BRGeneratorType:
|
def input_flow_common(self) -> BRGeneratorType:
|
||||||
yield from self.ETH.confirm_tx(info=True)
|
yield from self.ETH.confirm_tx(info=True)
|
||||||
|
|
||||||
|
|
||||||
|
class InputFlowEthereumSignTxGoBackFromSummary(InputFlowBase):
|
||||||
|
def __init__(self, client: Client):
|
||||||
|
super().__init__(client)
|
||||||
|
|
||||||
|
def input_flow_common(self) -> BRGeneratorType:
|
||||||
|
yield from self.ETH.confirm_tx(go_back_from_summary=True)
|
||||||
|
|
||||||
|
|
||||||
class InputFlowEthereumSignTxDataSkip(InputFlowBase):
|
class InputFlowEthereumSignTxDataSkip(InputFlowBase):
|
||||||
def __init__(self, client: Client, cancel: bool = False):
|
def __init__(self, client: Client, cancel: bool = False):
|
||||||
super().__init__(client)
|
super().__init__(client)
|
||||||
|
@ -293,7 +293,12 @@ class EthereumFlow:
|
|||||||
self.debug.press_left()
|
self.debug.press_left()
|
||||||
self.debug.press_left()
|
self.debug.press_left()
|
||||||
|
|
||||||
def confirm_tx(self, cancel: bool = False, info: bool = False) -> BRGeneratorType:
|
def confirm_tx(
|
||||||
|
self,
|
||||||
|
cancel: bool = False,
|
||||||
|
info: bool = False,
|
||||||
|
go_back_from_summary: bool = False,
|
||||||
|
) -> BRGeneratorType:
|
||||||
yield
|
yield
|
||||||
assert self.debug.wait_layout().title() == "RECIPIENT"
|
assert self.debug.wait_layout().title() == "RECIPIENT"
|
||||||
|
|
||||||
@ -305,6 +310,11 @@ class EthereumFlow:
|
|||||||
yield
|
yield
|
||||||
assert self.debug.wait_layout().title() == "SUMMARY"
|
assert self.debug.wait_layout().title() == "SUMMARY"
|
||||||
assert "Maximum fee:" in self.debug.wait_layout().text_content()
|
assert "Maximum fee:" in self.debug.wait_layout().text_content()
|
||||||
|
if go_back_from_summary:
|
||||||
|
self.debug.press_no()
|
||||||
|
yield
|
||||||
|
self.debug.press_yes()
|
||||||
|
yield
|
||||||
if info:
|
if info:
|
||||||
self.debug.press_info(wait=True)
|
self.debug.press_info(wait=True)
|
||||||
assert "Gas limit:" in self.debug.wait_layout().text_content()
|
assert "Gas limit:" in self.debug.wait_layout().text_content()
|
||||||
@ -318,6 +328,11 @@ class EthereumFlow:
|
|||||||
self.debug.press_right()
|
self.debug.press_right()
|
||||||
yield
|
yield
|
||||||
assert "Maximum fee:" in self.debug.wait_layout().text_content()
|
assert "Maximum fee:" in self.debug.wait_layout().text_content()
|
||||||
|
if go_back_from_summary:
|
||||||
|
self.debug.press_left()
|
||||||
|
yield
|
||||||
|
self.debug.press_right()
|
||||||
|
yield
|
||||||
if info:
|
if info:
|
||||||
self.debug.press_right(wait=True)
|
self.debug.press_right(wait=True)
|
||||||
assert "Gas limit:" in self.debug.wait_layout().text_content()
|
assert "Gas limit:" in self.debug.wait_layout().text_content()
|
||||||
|
Loading…
Reference in New Issue
Block a user