installable package #9

Merged
dan merged 31 commits from installable into dev 2023-12-07 11:32:03 +01:00
2 changed files with 38 additions and 21 deletions
Showing only changes of commit 28b1af57a6 - Show all commits

27
main.py
View file

@ -12,10 +12,37 @@ with open(cred_file, "r") as f:
for key, value in CREDENTIALS.items():
os.environ[key] = value
# --------------------------------- 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.
ENV_FILES_ROOT = Path("../envfiles").resolve()
ENV_FILES = [
ENV_FILES_ROOT / "login.test.dev.local-it.cloud.env", # authentik
ENV_FILES_ROOT / "blog.test.dev.local-it.cloud.env", # wordpress
ENV_FILES_ROOT / "files.test.dev.local-it.cloud.env", # nextcloud
]
ENV_PATHS = ";".join([x.as_posix() for x in ENV_FILES])
# ----------------------------------- dirs ----------------------------------- #
RECIPES_DIR = Path("../recipes").resolve()
OUTPUT_DIR = Path("./test-output").resolve()
# exit()
subprocess.run(
[
"pytest-abra",
"--env_paths",
ENV_PATHS,
"--recipes_dir",
RECIPES_DIR,
"--output_dir",
OUTPUT_DIR,
# "--debug",
]
)

View file

@ -11,32 +11,22 @@ from pytest_abra.utils import get_datetime_string
def run():
parser = argparse.ArgumentParser()
parser.add_argument("--env_paths", type=str, help="List of loaded env files separated with ;")
parser.add_argument("--recipes_dir", type=str, help="List of loaded env files separated with ;")
parser.add_argument("--output_dir", type=str, help="List of loaded env files separated with ;")
parser.add_argument("--debug", action="store_true", help="Enable Playwright debug mode")
parser.add_argument("--repeat", action="store_true", help="Re-run the most recent test")
parser.add_argument(
"--resume", action="store_true", help="Re-run the most recent test, only running tests without status 'passed'"
)
args = parser.parse_args()
# ----------------------------- 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).
# At the moment, functionailty is only guaranteed if each env file use
# a unique TYPE var.
ENV_FILES_ROOT = Path("../envfiles").resolve()
ENV_FILES = [
ENV_FILES_ROOT / "login.test.dev.local-it.cloud.env", # authentik
ENV_FILES_ROOT / "blog.test.dev.local-it.cloud.env", # wordpress
ENV_FILES_ROOT / "files.test.dev.local-it.cloud.env", # nextcloud
]
ENV_FILES = [Path(s) for s in args.env_paths.split(";")]
# ----------------------------- define ouptut dir ---------------------------- #
OUTPUT_DIR = Path("./test-output").resolve()
RECIPES_DIR = Path("../recipes").resolve()
RECIPES_DIR = Path(args.recipes_dir)
OUTPUT_DIR = Path(args.output_dir)
# -------------------------- enable playwright debug ------------------------- #
@ -46,7 +36,7 @@ def run():
# ----------------------------- define session_id ---------------------------- #
session_id = "test-" + get_datetime_string()
if args.repeat:
if args.resume:
# look for previous session_id
pass
# session_id = "abc"