2019-12-30 13:09:18 +00:00
|
|
|
import shutil
|
2021-09-02 11:04:16 +00:00
|
|
|
import sys
|
2019-12-30 13:09:18 +00:00
|
|
|
from pathlib import Path
|
|
|
|
|
2022-01-28 15:02:17 +00:00
|
|
|
ROOT = Path(__file__).resolve().parent.parent
|
2021-09-02 11:04:16 +00:00
|
|
|
sys.path.insert(0, str(ROOT))
|
|
|
|
# Needed for setup purposes, filling the FILE_HASHES dict
|
|
|
|
from tests.ui_tests import read_fixtures # isort:skip
|
2019-12-30 13:09:18 +00:00
|
|
|
|
2021-09-02 11:04:16 +00:00
|
|
|
read_fixtures()
|
|
|
|
from tests.ui_tests import _hash_files, FILE_HASHES, SCREENS_DIR # isort:skip
|
2019-12-30 13:09:18 +00:00
|
|
|
|
2022-02-09 12:51:56 +00:00
|
|
|
# As in CI we are running T1 and TT tests separately, there will
|
|
|
|
# always be the other model missing.
|
|
|
|
# Therefore, choosing just the cases for our model.
|
|
|
|
if len(sys.argv) > 1 and sys.argv[1].upper() == "T1":
|
|
|
|
model = "T1"
|
|
|
|
else:
|
|
|
|
model = "TT"
|
|
|
|
model_file_hashes = {k: v for k, v in FILE_HASHES.items() if k.startswith(f"{model}_")}
|
2019-12-30 13:09:18 +00:00
|
|
|
|
2022-02-09 12:51:56 +00:00
|
|
|
for test_case, expected_hash in model_file_hashes.items():
|
2021-09-02 11:04:16 +00:00
|
|
|
recorded_dir = SCREENS_DIR / test_case / "recorded"
|
2020-01-06 14:44:30 +00:00
|
|
|
actual_hash = _hash_files(recorded_dir)
|
|
|
|
assert expected_hash == actual_hash
|
2022-01-28 15:02:17 +00:00
|
|
|
shutil.make_archive(
|
|
|
|
str(ROOT / "ci/ui_test_records" / actual_hash), "zip", recorded_dir
|
|
|
|
)
|