various (#16)
* add full integration test of cli / pytest_abra with all tests * save path of runner_*.py in runner subclass to improve test discovery -> allows for same test name in two different runners * reorganize output dir names * use URL fixture everywhere * rework coordinator interface * add --session_id to cli args * add log results table * plenty of refactoring * add assert messages * add plenty of tests * add /docs dir with plenty of documentation * fix authentik setup * add authentik cleanup, remove test user * add random test user credential generation and integrate into test routine. random creds are saved to STATES Reviewed-on: local-it-infrastructure/e2e_tests#16 Co-authored-by: Daniel <d.brummerloh@gmail.com> Co-committed-by: Daniel <d.brummerloh@gmail.com>
This commit is contained in:
parent
016b88a68d
commit
2dd765a974
36 changed files with 1145 additions and 432 deletions
|
|
@ -2,21 +2,29 @@ import argparse
|
|||
import os
|
||||
from pathlib import Path
|
||||
|
||||
import pkg_resources # type: ignore
|
||||
from loguru import logger
|
||||
|
||||
from pytest_abra import Coordinator
|
||||
from pytest_abra.dir_manager import DirManager
|
||||
from pytest_abra.utils import get_datetime_string
|
||||
from pytest_abra.utils import get_session_id
|
||||
|
||||
|
||||
def get_version():
|
||||
return pkg_resources.get_distribution("pytest_abra").version
|
||||
|
||||
|
||||
def run():
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("--version", "-V", action="version", version=get_version(), help="output the version number")
|
||||
parser.add_argument("--env_paths", type=str, help="List of loaded env files separated with ;", required=True)
|
||||
parser.add_argument("--recipes_dir", type=Path, help="List of loaded env files separated with ;", required=True)
|
||||
parser.add_argument("--output_dir", type=Path, help="List of loaded env files separated with ;", required=True)
|
||||
parser.add_argument("--recipes_dir", type=Path, help="Dir of abra recipes and respective runners", required=True)
|
||||
parser.add_argument("--output_dir", type=Path, help="Dir of test outputs", required=True)
|
||||
parser.add_argument("--timeout", type=int, help="Set Playwright timeout in ms", default=20_000)
|
||||
parser.add_argument("--debug", action="store_true", help="Enable Playwright debug mode")
|
||||
parser.add_argument("--resume", action="store_true", help="Re-run the most recent test, skipping passed tests")
|
||||
parser.add_argument("--session_id", help="Session dir name (inside output_dir). Overwrites --resume")
|
||||
|
||||
args = parser.parse_args()
|
||||
env_paths = [Path(s) for s in args.env_paths.split(";")]
|
||||
|
||||
|
|
@ -27,17 +35,13 @@ def run():
|
|||
|
||||
# ----------------------------- define session_id ---------------------------- #
|
||||
|
||||
session_id = "test-" + get_datetime_string()
|
||||
if args.resume:
|
||||
latest_session_id = DirManager.get_latest_session_id(args.output_dir)
|
||||
if latest_session_id:
|
||||
session_id = DirManager.get_latest_session_id(args.output_dir)
|
||||
session_id = get_session_id(args.output_dir, args.resume, args.session_id)
|
||||
|
||||
# ------------------------------- setup logging ------------------------------ #
|
||||
|
||||
# todo: move to Coordinator
|
||||
DIR = DirManager(output_dir=args.output_dir, session_id=session_id)
|
||||
log_file = DIR.RECORDS / "coordinator.log"
|
||||
log_file = DIR.RESULTS / "coordinator.log"
|
||||
logger.add(log_file)
|
||||
|
||||
# ---------------------------- initialize and run ---------------------------- #
|
||||
|
|
@ -49,7 +53,7 @@ def run():
|
|||
recipes_dir=args.recipes_dir,
|
||||
timeout=args.timeout,
|
||||
)
|
||||
coordinator.setup_test()
|
||||
coordinator.run_test()
|
||||
coordinator.prepare_tests()
|
||||
coordinator.run_tests()
|
||||
coordinator.combine_html()
|
||||
coordinator.collect_traces()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue