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

test: update ui tests

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

View File

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