Skip to content

Commit

Permalink
[test] check screen has changed after review
Browse files Browse the repository at this point in the history
  • Loading branch information
spalmer25 committed Dec 9, 2024
1 parent 58f80f5 commit 5c00ba0
Show file tree
Hide file tree
Showing 179 changed files with 72 additions and 20 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
87 changes: 71 additions & 16 deletions tests/integration/nano/test_sign/test_blindsign.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,15 @@ def _sign_decodable_too_long(tezos_navigator: TezosNavigator,
"""Sign a decodable too long message"""

def navigate() -> None:
tezos_navigator.navigate_review(text=ScreenText.ACCEPT_RISK, snap_path=path / "clear_n_too_long_warning")
tezos_navigator.navigate_review(text=ScreenText.SIGN_ACCEPT, snap_path=path / "summary")
tezos_navigator.navigate_review(
text=ScreenText.ACCEPT_RISK,
screen_change_after_last_instruction=False,
snap_path=path / "clear_n_too_long_warning"
)
tezos_navigator.navigate_review(
text=ScreenText.SIGN_ACCEPT,
snap_path=path / "summary"
)

_sign_too_long(tezos_navigator, message, navigate)

Expand Down Expand Up @@ -163,16 +170,26 @@ def test_reject_basic_too_long_operation_at_warning(tezos_navigator: TezosNaviga
"""Check reject too long operation at warning"""

def navigate() -> None:
tezos_navigator.navigate_review(text=ScreenText.SIGN_REJECT, snap_path=snapshot_dir / "clear_n_too_long_warning")
tezos_navigator.navigate_review(
text=ScreenText.SIGN_REJECT,
snap_path=snapshot_dir / "clear_n_too_long_warning"
)

_reject_too_long(tezos_navigator, BASIC_OPERATION, StatusCode.REJECT, navigate)

def test_reject_basic_too_long_operation_at_summary(tezos_navigator: TezosNavigator, snapshot_dir: Path):
"""Check reject too long operation at summary"""

def navigate() -> None:
tezos_navigator.navigate_review(text=ScreenText.ACCEPT_RISK, snap_path=snapshot_dir / "clear_n_too_long_warning")
tezos_navigator.navigate_review(text=ScreenText.SIGN_REJECT, snap_path=snapshot_dir / "summary")
tezos_navigator.navigate_review(
text=ScreenText.ACCEPT_RISK,
screen_change_after_last_instruction=False,
snap_path=snapshot_dir / "clear_n_too_long_warning"
)
tezos_navigator.navigate_review(
text=ScreenText.SIGN_REJECT,
snap_path=snapshot_dir / "summary"
)

_reject_too_long(tezos_navigator, BASIC_OPERATION, StatusCode.REJECT, navigate)

Expand Down Expand Up @@ -326,25 +343,42 @@ def test_sign_too_long_operation_with_too_large(tezos_navigator: TezosNavigator,
"""Check sign too long operation that will also fail the parsing"""

def navigate() -> None:
tezos_navigator.navigate_review(text=ScreenText.ACCEPT_RISK, snap_path=snapshot_dir / "clear_n_too_large_warning")
tezos_navigator.navigate_review(text=ScreenText.SIGN_ACCEPT, snap_path=snapshot_dir / "blindsigning")
tezos_navigator.navigate_review(
text=ScreenText.ACCEPT_RISK,
screen_change_after_last_instruction=False,
snap_path=snapshot_dir / "clear_n_too_large_warning"
)
tezos_navigator.navigate_review(
text=ScreenText.SIGN_ACCEPT,
snap_path=snapshot_dir / "blindsigning"
)

_sign_too_long(tezos_navigator, OPERATION_WITH_TOO_LARGE, navigate)

def test_reject_too_long_operation_with_too_large_at_too_large_warning(tezos_navigator: TezosNavigator, snapshot_dir: Path):
"""Check reject too long operation that will also fail the parsing at too large warning"""

def navigate() -> None:
tezos_navigator.navigate_review(text=ScreenText.SIGN_REJECT, snap_path=snapshot_dir / "clear_n_too_large_warning")
tezos_navigator.navigate_review(
text=ScreenText.SIGN_REJECT,
snap_path=snapshot_dir / "clear_n_too_large_warning"
)

_reject_too_long(tezos_navigator, OPERATION_WITH_TOO_LARGE, StatusCode.PARSE_ERROR, navigate)

def test_reject_too_long_operation_with_too_large_at_blindsigning(tezos_navigator: TezosNavigator, snapshot_dir: Path):
"""Check reject too long operation that will also fail the parsing at blindsigning"""

def navigate() -> None:
tezos_navigator.navigate_review(text=ScreenText.ACCEPT_RISK, snap_path=snapshot_dir / "clear_n_too_large_warning")
tezos_navigator.navigate_review(text=ScreenText.SIGN_REJECT, snap_path=snapshot_dir / "blindsigning")
tezos_navigator.navigate_review(
text=ScreenText.ACCEPT_RISK,
screen_change_after_last_instruction=False,
snap_path=snapshot_dir / "clear_n_too_large_warning"
)
tezos_navigator.navigate_review(
text=ScreenText.SIGN_REJECT,
snap_path=snapshot_dir / "blindsigning"
)

_reject_too_long(tezos_navigator, OPERATION_WITH_TOO_LARGE, StatusCode.REJECT, navigate)

Expand Down Expand Up @@ -379,9 +413,16 @@ def navigate() -> None:
snap_path=snapshot_dir / "clear",
)
else:
tezos_navigator.navigate_review(text=ScreenText.ACCEPT_RISK, snap_path=snapshot_dir / "clear")
tezos_navigator.navigate_review(
text=ScreenText.ACCEPT_RISK,
screen_change_after_last_instruction=False,
snap_path=snapshot_dir / "clear"
)

tezos_navigator.navigate_review(text=ScreenText.SIGN_ACCEPT, snap_path=snapshot_dir / "blind")
tezos_navigator.navigate_review(
text=ScreenText.SIGN_ACCEPT,
snap_path=snapshot_dir / "blind"
)

data = tezos_navigator.sign(
DEFAULT_ACCOUNT,
Expand All @@ -401,8 +442,15 @@ def test_blindsign_too_large(tezos_navigator: TezosNavigator, snapshot_dir: Path
message = MichelineExpr({'int':12345678901234567890123456789012345678901234567890123456789012345678901234567890})

def navigate() -> None:
tezos_navigator.navigate_review(text=ScreenText.ACCEPT_RISK, snap_path=snapshot_dir / "clear")
tezos_navigator.navigate_review(text=ScreenText.SIGN_ACCEPT, snap_path=snapshot_dir / "blind")
tezos_navigator.navigate_review(
text=ScreenText.ACCEPT_RISK,
screen_change_after_last_instruction=False,
snap_path=snapshot_dir / "clear"
)
tezos_navigator.navigate_review(
text=ScreenText.SIGN_ACCEPT,
snap_path=snapshot_dir / "blind"
)

data = tezos_navigator.sign(
DEFAULT_ACCOUNT,
Expand Down Expand Up @@ -435,8 +483,15 @@ def test_blindsign_reject_from_blind(tezos_navigator: TezosNavigator, snapshot_d
expression = MichelineExpr({'int':12345678901234567890123456789012345678901234567890123456789012345678901234567890})

def navigate() -> None:
tezos_navigator.navigate_review(text=ScreenText.ACCEPT_RISK, snap_path=snapshot_dir / "clear")
tezos_navigator.navigate_review(text=ScreenText.SIGN_REJECT, snap_path=snapshot_dir / "blind")
tezos_navigator.navigate_review(
text=ScreenText.ACCEPT_RISK,
screen_change_after_last_instruction=False,
snap_path=snapshot_dir / "clear"
)
tezos_navigator.navigate_review(
text=ScreenText.SIGN_REJECT,
snap_path=snapshot_dir / "blind"
)

with StatusCode.REJECT.expected():
tezos_navigator.sign(
Expand Down
1 change: 1 addition & 0 deletions tests/integration/nano/test_sign/test_parsing_errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ def test_parsing_hard_fail(tezos_navigator: TezosNavigator, raw_msg: str, snapsh
with_hash=True,
navigate=lambda: tezos_navigator.navigate_review(
text=ScreenText.HOME,
screen_change_after_last_instruction=False,
snap_path=snapshot_dir
)
)
2 changes: 0 additions & 2 deletions tests/integration/nano/test_wrong_apdu.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ def test_regression_continue_after_reject(
with StatusCode.REJECT.expected():
tezos_navigator.reject_public_key(DEFAULT_ACCOUNT, snap_path=snapshot_dir / "reject_public_key")

backend.wait_for_home_screen()

message = Transaction(
source = 'tz1ixvCiPJYyMjsp2nKBVaq54f6AdbV8hCKa',
fee = 10000,
Expand Down
2 changes: 0 additions & 2 deletions tests/integration/nano/utils/navigator.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,12 +224,10 @@ def navigate_forward(self, **kwargs) -> None:

def navigate_review(self,
screen_change_before_first_instruction=True,
screen_change_after_last_instruction=False,
**kwargs) -> None:
"""Navigate forward until the text is found. Confirm at the end."""
self.navigate_forward(
screen_change_before_first_instruction=screen_change_before_first_instruction,
screen_change_after_last_instruction=screen_change_after_last_instruction,
**kwargs
)

Expand Down

0 comments on commit 5c00ba0

Please sign in to comment.