From c4e3c5eb22c3f5f6c3d8e991a54aae3131d196b9 Mon Sep 17 00:00:00 2001 From: M1nd3r Date: Tue, 4 Feb 2025 15:06:41 +0100 Subject: [PATCH] test: update ui tests --- tests/ui_tests/__init__.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tests/ui_tests/__init__.py b/tests/ui_tests/__init__.py index 2213a03dab..093ba2cac1 100644 --- a/tests/ui_tests/__init__.py +++ b/tests/ui_tests/__init__.py @@ -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)