From 39445afd89a837a04c83c6b1fd95c9079e05a8f7 Mon Sep 17 00:00:00 2001 From: Anastasiya Semenkevich Date: Wed, 6 Mar 2024 18:05:02 +0300 Subject: [PATCH] chore: screenshot on fail improved --- test/e2e/.gitignore | 2 +- test/e2e/configs/testpath.py | 2 +- test/e2e/conftest.py | 10 +++------- test/e2e/driver/aut.py | 2 +- 4 files changed, 6 insertions(+), 10 deletions(-) diff --git a/test/e2e/.gitignore b/test/e2e/.gitignore index 90693b46e5..ab26cc52aa 100644 --- a/test/e2e/.gitignore +++ b/test/e2e/.gitignore @@ -10,4 +10,4 @@ tmp/ *.DS_Store -/local run results/ +/local_run_results/ diff --git a/test/e2e/configs/testpath.py b/test/e2e/configs/testpath.py index 46bd79166b..92c4f9eab1 100644 --- a/test/e2e/configs/testpath.py +++ b/test/e2e/configs/testpath.py @@ -13,7 +13,7 @@ TEST_ARTIFACTS: typing.Optional[SystemPath] = None # Test Directories RUN_ID = os.getenv('RUN_DIR', f'run_{datetime.today().strftime("%Y-%m-%d %H:%M:%S")}') -RESULTS: SystemPath = ROOT / 'local run results' +RESULTS: SystemPath = ROOT / 'local_run_results' RUN: SystemPath = RESULTS / RUN_ID VP: SystemPath = ROOT / 'ext' / 'vp' TEST_FILES: SystemPath = ROOT / 'ext' / 'test_files' diff --git a/test/e2e/conftest.py b/test/e2e/conftest.py index 07268ef036..93c716dfe9 100644 --- a/test/e2e/conftest.py +++ b/test/e2e/conftest.py @@ -42,11 +42,10 @@ def setup_session_scope( def setup_function_scope( caplog, generate_test_data, - check_result, - application_logs + check_result ): # FIXME: broken due to KeyError: <_pytest.stash.StashKey object at 0x7fd1ba6d78c0> - #caplog.set_level(configs.LOG_LEVEL) + # caplog.set_level(configs.LOG_LEVEL) yield @@ -61,10 +60,7 @@ def pytest_exception_interact(node): test_path, test_name, test_params = generate_test_info(node) node_dir: SystemPath = configs.testpath.RUN / test_path / test_name / test_params node_dir.mkdir(parents=True, exist_ok=True) - - screenshot = node_dir / 'screenshot.png' - if screenshot.exists(): - screenshot = node_dir / f'screenshot_{datetime.now():%H%M%S}.png' + screenshot = node_dir / f'screenshot_{datetime.today().strftime("%Y-%m-%d %H:%M:%S")}.png' ImageGrab.grab(xdisplay=configs.system.DISPLAY if IS_LIN else None).save(screenshot) allure.attach( name='Screenshot on fail', diff --git a/test/e2e/driver/aut.py b/test/e2e/driver/aut.py index 4b59d836a1..df98d13359 100644 --- a/test/e2e/driver/aut.py +++ b/test/e2e/driver/aut.py @@ -64,7 +64,7 @@ class AUT: body=screenshot.read_bytes(), attachment_type=allure.attachment_type.PNG) except Exception as err: - LOG.info(err) + LOG.error(err) self.stop()