mirror of
https://github.com/status-im/status-desktop.git
synced 2025-01-12 07:14:37 +00:00
b09504be36
* test(pytest) The driver methods added. Wrappers for UI elements added. #67 * test(pytest) Squishserver added #68 * test(pytest) Attach/Detach AUT methods added #69 * test(pytest) Main window handler added #70 * test(pytest) Save screenshot on fail added #71 * test(pytest) Wait for squishserver added #71 * test(pytest) Setup Windows #71 * Generate new keys (#11804) * test(pytest) Image comparison methods added #76 * test(pytest) Tesseract methods added #77 * test(pytest) The Methods to search color on image added #80 * test(onboarding) Test on generation new keys added #75 * test(pytest) Handlers for OS Native File dialog added #81 * test(Onboarding) Test on Profile image added #83 * Allure and TestRail integration (#11806) * test(Allure) Steps descriptions added #72 * test(TestRail) Integration #72
46 lines
1.7 KiB
Python
46 lines
1.7 KiB
Python
import logging
|
|
import re
|
|
|
|
import pytest
|
|
|
|
import configs
|
|
from scripts.utils.system_path import SystemPath
|
|
|
|
_logger = logging.getLogger(__name__)
|
|
|
|
|
|
@pytest.fixture
|
|
def generate_test_data(request):
|
|
test_path, test_name, test_params = generate_test_info(request.node)
|
|
configs.testpath.TEST = configs.testpath.RUN / test_path / test_name
|
|
node_dir = configs.testpath.TEST / test_params
|
|
configs.testpath.TEST_ARTIFACTS = node_dir / 'artifacts'
|
|
configs.testpath.TEST_VP = configs.testpath.VP / test_path / test_name
|
|
_logger.info(
|
|
f'\nArtifacts directory:\t{configs.testpath.TEST_ARTIFACTS.relative_to(configs.testpath.ROOT)}'
|
|
f'\nVerification points directory:\t{configs.testpath.TEST_VP.relative_to(configs.testpath.ROOT)}'
|
|
)
|
|
_logger.info(f'Start test: {test_name}')
|
|
|
|
|
|
def generate_test_info(node):
|
|
pure_path = SystemPath(node.location[0]).parts[1:]
|
|
test_path = SystemPath(*pure_path).with_suffix('')
|
|
test_name = node.originalname
|
|
test_params = re.sub('[^a-zA-Z0-9\n\-_]', '', node.name.strip(test_name))
|
|
return test_path, test_name, test_params
|
|
|
|
|
|
@pytest.fixture(scope='session')
|
|
def prepare_test_directory():
|
|
keep_results = 5
|
|
run_name_pattern = 'run_????????_??????'
|
|
runs = list(sorted(configs.testpath.RESULTS.glob(run_name_pattern)))
|
|
if len(runs) > keep_results:
|
|
del_runs = runs[:len(runs) - keep_results]
|
|
for run in del_runs:
|
|
SystemPath(run).rmtree(ignore_errors=True)
|
|
_logger.info(f"Remove old test run directory: {run.relative_to(configs.testpath.ROOT)}")
|
|
configs.testpath.RUN.mkdir(parents=True, exist_ok=True)
|
|
_logger.info(f"Created new test run directory: {configs.testpath.RUN.relative_to(configs.testpath.ROOT)}")
|