mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-22 06:18:07 +00:00
feat(tests): number the screens in UI test reports, give unique IDs to images
[no changelog]
This commit is contained in:
parent
87d4a2622e
commit
a4034097d6
@ -47,11 +47,11 @@ def write(fixture_test_path: Path, doc: document, filename: str) -> Path:
|
|||||||
return fixture_test_path / filename
|
return fixture_test_path / filename
|
||||||
|
|
||||||
|
|
||||||
def image_column(hash: str | None, cur_dir: Path) -> None:
|
def image_column(hash: str | None, cur_dir: Path, img_id: str | None = None) -> None:
|
||||||
"""Put image into table as one cell."""
|
"""Put image into table as one cell."""
|
||||||
with td():
|
with td():
|
||||||
if hash:
|
if hash:
|
||||||
image_link(hash, cur_dir)
|
image_link(hash, cur_dir, img_id=img_id)
|
||||||
else:
|
else:
|
||||||
i("missing")
|
i("missing")
|
||||||
|
|
||||||
@ -72,10 +72,13 @@ def _relative_path(cur_dir: Path, path_to: Path) -> str:
|
|||||||
return "/".join(components)
|
return "/".join(components)
|
||||||
|
|
||||||
|
|
||||||
def image_link(hash: str, cur_dir: Path, title: str = "") -> None:
|
def image_link(
|
||||||
|
hash: str, cur_dir: Path, title: str = "", img_id: str | None = None
|
||||||
|
) -> None:
|
||||||
"""Put image into table as one cell."""
|
"""Put image into table as one cell."""
|
||||||
path = _IMAGE_DIR / f"{hash}.png"
|
path = _IMAGE_DIR / f"{hash}.png"
|
||||||
img(
|
img(
|
||||||
|
id=img_id,
|
||||||
src=_relative_path(cur_dir, path),
|
src=_relative_path(cur_dir, path),
|
||||||
title=title,
|
title=title,
|
||||||
loading="lazy",
|
loading="lazy",
|
||||||
|
@ -384,10 +384,12 @@ def recorded(result: TestResult, header: str = "Recorded", dir: str = "passed")
|
|||||||
|
|
||||||
with table(border=1):
|
with table(border=1):
|
||||||
with tr():
|
with tr():
|
||||||
|
th("id")
|
||||||
th(header)
|
th(header)
|
||||||
|
|
||||||
for screen in result.images:
|
for index, screen in enumerate(result.images):
|
||||||
with tr():
|
with tr():
|
||||||
html.image_column(screen, TESTREPORT_PATH / dir)
|
td(index)
|
||||||
|
html.image_column(screen, TESTREPORT_PATH / dir, img_id=str(index))
|
||||||
|
|
||||||
return html.write(TESTREPORT_PATH / dir, doc, result.test.id + ".html")
|
return html.write(TESTREPORT_PATH / dir, doc, result.test.id + ".html")
|
||||||
|
Loading…
Reference in New Issue
Block a user