mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-24 15:28:10 +00:00
tests: UI test of cancel recovery between shares
[no changelog]
This commit is contained in:
parent
37edfcb974
commit
935afbb46f
@ -28,6 +28,7 @@ from ...common import (
|
||||
from ...input_flows import (
|
||||
InputFlowSlip39BasicRecovery,
|
||||
InputFlowSlip39BasicRecoveryAbort,
|
||||
InputFlowSlip39BasicRecoveryAbortBetweenShares,
|
||||
InputFlowSlip39BasicRecoveryInvalidFirstShare,
|
||||
InputFlowSlip39BasicRecoveryInvalidSecondShare,
|
||||
InputFlowSlip39BasicRecoveryNoAbort,
|
||||
@ -118,6 +119,19 @@ def test_abort(client: Client):
|
||||
assert client.features.initialized is False
|
||||
|
||||
|
||||
@pytest.mark.setup_client(uninitialized=True)
|
||||
def test_abort_between_shares(client: Client):
|
||||
with client:
|
||||
IF = InputFlowSlip39BasicRecoveryAbortBetweenShares(
|
||||
client, MNEMONIC_SLIP39_BASIC_20_3of6
|
||||
)
|
||||
client.set_input_flow(IF.get())
|
||||
with pytest.raises(exceptions.Cancelled):
|
||||
device.recover(client, pin_protection=False, label="label")
|
||||
client.init_device()
|
||||
assert client.features.initialized is False
|
||||
|
||||
|
||||
@pytest.mark.setup_client(uninitialized=True)
|
||||
def test_noabort(client: Client):
|
||||
with client:
|
||||
|
@ -2106,6 +2106,25 @@ class InputFlowSlip39BasicRecoveryAbort(InputFlowBase):
|
||||
yield from self.REC.abort_recovery(True)
|
||||
|
||||
|
||||
class InputFlowSlip39BasicRecoveryAbortBetweenShares(InputFlowBase):
|
||||
def __init__(self, client: Client, shares: list[str]):
|
||||
super().__init__(client)
|
||||
self.first_share = shares[0].split(" ")
|
||||
self.word_count = len(self.first_share)
|
||||
|
||||
def input_flow_common(self) -> BRGeneratorType:
|
||||
yield from self.REC.confirm_recovery()
|
||||
if self.model() in (models.T2T1, models.T3T1):
|
||||
yield from self.REC.input_number_of_words(20)
|
||||
else:
|
||||
yield from self.REC.tr_recovery_homescreen()
|
||||
yield from self.REC.input_number_of_words(self.word_count)
|
||||
|
||||
yield from self.REC.enter_any_share()
|
||||
yield from self.REC.input_mnemonic(self.first_share)
|
||||
yield from self.REC.abort_recovery_between_shares()
|
||||
|
||||
|
||||
class InputFlowSlip39BasicRecoveryNoAbort(InputFlowBase):
|
||||
def __init__(self, client: Client, shares: list[str]):
|
||||
super().__init__(client)
|
||||
|
@ -152,6 +152,37 @@ class RecoveryFlow:
|
||||
else:
|
||||
self.debug.press_no()
|
||||
|
||||
def abort_recovery_between_shares(self) -> BRGeneratorType:
|
||||
yield
|
||||
if self.client.model is models.T2B1:
|
||||
TR.assert_template(
|
||||
self._text_content(), "recovery__x_of_y_entered_template"
|
||||
)
|
||||
self.debug.press_no()
|
||||
assert (yield).name == "abort_recovery"
|
||||
TR.assert_in(self._text_content(), "recovery__wanna_cancel_recovery")
|
||||
self.debug.press_right()
|
||||
self.debug.press_yes()
|
||||
elif self.client.model is models.T3T1:
|
||||
TR.assert_template(
|
||||
self._text_content(), "recovery__x_of_y_entered_template"
|
||||
)
|
||||
self.debug.click(buttons.CORNER_BUTTON, wait=True)
|
||||
self.debug.synchronize_at("VerticalMenu")
|
||||
self.debug.click(buttons.VERTICAL_MENU[0], wait=True)
|
||||
self.debug.swipe_up(wait=True)
|
||||
assert (yield).name == "abort_recovery"
|
||||
self.debug.synchronize_at("PromptScreen")
|
||||
self.debug.click(buttons.TAP_TO_CONFIRM)
|
||||
else:
|
||||
TR.assert_template(
|
||||
self._text_content(), "recovery__x_of_y_entered_template"
|
||||
)
|
||||
self.debug.press_no()
|
||||
assert (yield).name == "abort_recovery"
|
||||
TR.assert_in(self._text_content(), "recovery__wanna_cancel_recovery")
|
||||
self.debug.press_yes()
|
||||
|
||||
def input_number_of_words(self, num_words: int) -> BRGeneratorType:
|
||||
br = yield
|
||||
assert br.code == B.MnemonicWordCount
|
||||
|
Loading…
Reference in New Issue
Block a user