Skip to content

Commit

Permalink
Tests: check that home screen becomes black on sign
Browse files Browse the repository at this point in the history
 - on preattestation, attestation, attestation-with-dal and block
 - currently, it is only effective on nanos
  • Loading branch information
spalmer25 committed Jan 31, 2024
1 parent fa1cc5c commit 9262156
Show file tree
Hide file tree
Showing 18 changed files with 15 additions and 7 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.
8 changes: 8 additions & 0 deletions test/python/test_instructions.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,8 @@ def test_sign_preattestation(
f"Expected hash {preattestation.hash.hex()} but got {preattestation_hash.hex()}"
account.check_signature(signature, bytes(preattestation))

tezos_navigator.assert_screen(Path(test_name) / "black_screen.png")

tezos_navigator.check_app_context(
account,
chain_id=main_chain_id,
Expand Down Expand Up @@ -349,6 +351,8 @@ def test_sign_attestation(
f"Expected hash {attestation.hash.hex()} but got {attestation_hash.hex()}"
account.check_signature(signature, bytes(attestation))

tezos_navigator.assert_screen(Path(test_name) / "black_screen.png")

tezos_navigator.check_app_context(
account,
chain_id=main_chain_id,
Expand Down Expand Up @@ -393,6 +397,8 @@ def test_sign_attestation_dal(
f"Expected hash {attestation.hash.hex()} but got {attestation_hash.hex()}"
account.check_signature(signature, bytes(attestation))

tezos_navigator.assert_screen(Path(test_name) / "black_screen.png")

tezos_navigator.check_app_context(
account,
chain_id=main_chain_id,
Expand Down Expand Up @@ -439,6 +445,8 @@ def test_sign_block(
f"Expected hash {block.hash.hex()} but got {block_hash.hex()}"
account.check_signature(signature, bytes(block))

tezos_navigator.assert_screen(Path(test_name) / "black_screen.png")

tezos_navigator.check_app_context(
account,
chain_id=main_chain_id,
Expand Down
14 changes: 7 additions & 7 deletions test/python/utils/navigator.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def _send_and_navigate(self,
)
)

def _assert_screen(self, path: Path) -> None:
def assert_screen(self, path: Path) -> None:
golden_path = self._snapshots_dir / path
if not golden_path.parent.is_dir() and self._golden_run:
golden_path.parent.mkdir(parents=True)
Expand Down Expand Up @@ -211,27 +211,27 @@ def check_app_context(self,
[NavInsID.RIGHT_CLICK] * 2,
screen_change_before_first_instruction=False
)
self._assert_screen(path / "chain_id.png")
self.assert_screen(path / "chain_id.png")
self.backend.right_click()
self.backend.wait_for_screen_change()
if account is not None and self.firmware.device == "nanos":
self._assert_screen(path / "public_key_hash_1.png")
self.assert_screen(path / "public_key_hash_1.png")
self.backend.right_click()
self.backend.wait_for_screen_change()
self._assert_screen(path / "public_key_hash_2.png")
self.assert_screen(path / "public_key_hash_2.png")
else:
self._assert_screen(path / "public_key_hash.png")
self.assert_screen(path / "public_key_hash.png")
self.backend.right_click()
self.backend.wait_for_screen_change()
self._assert_screen(path / "high_watermark.png")
self.assert_screen(path / "high_watermark.png")
self.navigator.navigate(
[NavInsID.LEFT_CLICK] * 4,
screen_change_before_first_instruction=False
)
else:
self.home.settings()
self.backend.wait_for_screen_change()
self._assert_screen(path / "app_context.png")
self.assert_screen(path / "app_context.png")
self.settings.multi_page_exit()
self.backend.wait_for_screen_change()

Expand Down

0 comments on commit 9262156

Please sign in to comment.