set correct work dir for docker image fix check_if_user_exists by adding wait time to is_visible implement the wait with playwright functions cleanup add locale for testing add WIP argument only_run_failed make progress output more fine grained improve docstring save tracebacks to records add check to look for already passed tests to skip those remove progress dir put the actual class in runner dependencies, fix _check_dependencies_finished cleanup work on wordpress test add loguru add logger and html report add test helper to skip tests if required remove old file add demo test with explanation make name and test_dir_name required cleanup add demo Runner with documentation improve doc fix arguments in _create_result_file use _run_test_if_required in run_tests add prevent skip set timeout save traces to RECORDS add doc include setup_demo wip rename authentic fixtures should work reomve remove localization stuff remove dummy test use config in condition put html reports in their own dir inside records add beautifulsoup4 initial commit add combine_html cleanup improve doc string more logging, cleanup cleanup fixup remove only_run_failed add comment move traces to their own dir and move them after test improve depenency check add parse_env_files enable all rename wrapper to coordinator remove Protocol create DIR in init make _parse_env_files private make coordinator instance available in runner handle env files via dict objects remove trace dir after collect_traces rename html report Revert "make coordinator instance available in runner" This reverts commit a17402ed319da98518f8bb8ed8eca462299657a1. add todo add _copy_env_files log tests finished collect_traces saves each trace with unique dir name via enumeration remove traceback hook as same information is available in html report improve logging
70 lines
2 KiB
Python
70 lines
2 KiB
Python
import json
|
|
import os
|
|
from pathlib import Path
|
|
|
|
from loguru import logger
|
|
|
|
from src.coordinator import Coordinator
|
|
from src.dirmanager import DirManager
|
|
from src.utils import get_session_id
|
|
|
|
# ----------------------------- lookup env files ----------------------------- #
|
|
|
|
|
|
# This list of env files is the input to testing framework. each env file
|
|
# triggers the execution of one test Runner and provides configuration to the
|
|
# tests inside the runner. There can be dependencies, for example wordpress
|
|
# requires that authentik ran first to create the admin session and the user
|
|
# session. At the moment, wrong ordering results in unsuccessful test
|
|
# (wrong ordering would be wordpress env file is before authentik env file).
|
|
|
|
ENV_FILES = [
|
|
Path("envfiles/login.test.dev.local-it.cloud.env"), # authentik
|
|
Path("envfiles/blog.test.dev.local-it.cloud.env"), # wordpress
|
|
]
|
|
|
|
|
|
# ----------------------------- define ouptut dir ---------------------------- #
|
|
|
|
|
|
OUTPUT_DIR = Path("./test-output").resolve()
|
|
|
|
|
|
# -------------------------- enable playwright debug ------------------------- #
|
|
|
|
|
|
# os.environ["PWDEBUG"] = "1"
|
|
|
|
|
|
# --------------------- load credentials to env variables -------------------- #
|
|
|
|
cred_file = Path("credentials.json")
|
|
with open(cred_file, "r") as f:
|
|
CREDENTIALS = json.load(f)
|
|
|
|
os.environ["ADMIN_USER"] = CREDENTIALS["admin_user"]
|
|
os.environ["ADMIN_PASS"] = CREDENTIALS["admin_pass"]
|
|
|
|
|
|
# ----------------------------- define session_id ---------------------------- #
|
|
|
|
|
|
session_id = get_session_id()
|
|
# session_id = "abc"
|
|
|
|
|
|
# ------------------------------- setup logging ------------------------------ #
|
|
|
|
DIR = DirManager(output_dir=OUTPUT_DIR, session_id=session_id)
|
|
log_file = DIR.RESULTS / "full.log"
|
|
logger.add(log_file)
|
|
|
|
|
|
# ---------------------------- initialize and run ---------------------------- #
|
|
|
|
|
|
coordinator = Coordinator(ENV_FILES, output_dir=OUTPUT_DIR, session_id=session_id)
|
|
coordinator.setup_test()
|
|
coordinator.run_test()
|
|
coordinator.combine_html()
|
|
coordinator.collect_traces()
|