1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-25 17:09:44 +00:00

tests/ui: fix deploy script

This commit is contained in:
Tomas Susanka 2020-01-31 13:35:21 +00:00
parent 4baa76dc67
commit 30684bc46b

View File

@ -1,4 +1,5 @@
import hashlib
import json
import shutil
from pathlib import Path
@ -12,10 +13,15 @@ def _hash_files(path):
return hasher.digest().hex()
fixture_root = Path().cwd() / "../tests/ui_tests/fixtures/"
root = Path().cwd() / "../tests/ui_tests"
screens = root / "screens"
fixtures = root / "fixtures.json"
for recorded_dir in fixture_root.glob("*/recorded"):
expected_hash = (recorded_dir.parent / "hash.txt").read_text()
hashes = json.loads(fixtures.read_text())
for test_case in hashes.keys():
recorded_dir = screens / test_case / "recorded"
expected_hash = hashes[test_case]
actual_hash = _hash_files(recorded_dir)
assert expected_hash == actual_hash
shutil.make_archive("ui_test_records/" + actual_hash, "zip", recorded_dir)