parent
5bc3e353e0
commit
1b932a20e8
@ -1,27 +1,19 @@
|
|||||||
import hashlib
|
|
||||||
import json
|
|
||||||
import shutil
|
import shutil
|
||||||
|
import sys
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
|
ROOT = Path(__file__).parent / ".."
|
||||||
|
sys.path.insert(0, str(ROOT))
|
||||||
|
# Needed for setup purposes, filling the FILE_HASHES dict
|
||||||
|
from tests.ui_tests import read_fixtures # isort:skip
|
||||||
|
|
||||||
def _hash_files(path):
|
read_fixtures()
|
||||||
files = path.iterdir()
|
from tests.ui_tests import _hash_files, FILE_HASHES, SCREENS_DIR # isort:skip
|
||||||
hasher = hashlib.sha256()
|
|
||||||
for file in sorted(files):
|
|
||||||
hasher.update(file.read_bytes())
|
|
||||||
|
|
||||||
return hasher.digest().hex()
|
|
||||||
|
|
||||||
|
for test_case in FILE_HASHES.keys():
|
||||||
root = Path(__file__).parent / ".."
|
recorded_dir = SCREENS_DIR / test_case / "recorded"
|
||||||
screens = root / "tests/ui_tests/screens"
|
expected_hash = FILE_HASHES[test_case]
|
||||||
fixtures = root / "tests/ui_tests/fixtures.json"
|
|
||||||
|
|
||||||
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)
|
actual_hash = _hash_files(recorded_dir)
|
||||||
assert expected_hash == actual_hash
|
assert expected_hash == actual_hash
|
||||||
shutil.make_archive(root / "ci/ui_test_records" / actual_hash, "zip", recorded_dir)
|
shutil.make_archive(ROOT / "ci/ui_test_records" / actual_hash, "zip", recorded_dir)
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in new issue