1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-04-15 23:05:45 +00:00

test: update ui tests

This commit is contained in:
M1nd3r 2025-02-04 15:06:41 +01:00
parent 02a2bd86ff
commit c4e3c5eb22

View File

@ -37,7 +37,9 @@ def _process_tested(result: TestResult, item: Node) -> None:
@contextmanager
def screen_recording(
client: Client, request: pytest.FixtureRequest
client: Client,
request: pytest.FixtureRequest,
client_callback: Callable[[], Client] | None = None,
) -> Generator[None, None, None]:
test_ui = request.config.getoption("ui")
if not test_ui:
@ -55,12 +57,15 @@ def screen_recording(
client.debug.start_recording(str(testcase.actual_dir))
yield
finally:
client.ensure_open()
if client_callback:
client = client_callback()
client.sync_responses()
# Wait for response to Initialize, which gives the emulator time to catch up
# and redraw the homescreen. Otherwise there's a race condition between that
# and stopping recording.
client.init_device()
# Instead of client.init_device() we create a new management session
client.get_seedless_session()
client.debug.stop_recording()
result = testcase.build_result(request)