refactor so that coordinator instance is available in runner instance (#8)

-> all program states available

Reviewed-on: local-it-infrastructure/e2e_tests#8
Co-authored-by: Daniel <d.brummerloh@gmail.com>
Co-committed-by: Daniel <d.brummerloh@gmail.com>
This commit is contained in:
Daniel 2023-12-06 12:05:13 +01:00 committed by dan
parent f9c21c6e6b
commit 4c5a470a70
15 changed files with 74 additions and 53 deletions

View file

@ -1,10 +1,10 @@
import json
import pytest
from dotenv import dotenv_values
from playwright.sync_api import BrowserContext, Page
from abratest.dir_manager import DirManager
from abratest.utils import BaseUrl
@pytest.fixture
@ -18,10 +18,9 @@ def authentik_admin_context(context: BrowserContext, DIR: DirManager) -> Browser
@pytest.fixture
def authentik_admin_page(authentik_admin_context: BrowserContext, DIR: DirManager) -> Page:
page = authentik_admin_context.new_page()
env_file = DIR.ENV_FILES / "authentik"
config: dict[str, str] = dotenv_values(env_file) # type: ignore
url = "https://" + config["DOMAIN"]
page.goto(url)
config = DIR.get_config("authentik")
base_url = BaseUrl(config["DOMAIN"])
page.goto(base_url.get())
return page
@ -36,8 +35,7 @@ def authentik_user_context(context: BrowserContext, DIR: DirManager) -> BrowserC
@pytest.fixture
def authentik_user_page(authentik_user_context: BrowserContext, DIR: DirManager) -> Page:
page = authentik_user_context.new_page()
env_file = DIR.ENV_FILES / "authentik"
config: dict[str, str] = dotenv_values(env_file) # type: ignore
url = "https://" + config["DOMAIN"]
page.goto(url)
config = DIR.get_config("authentik")
base_url = BaseUrl(config["DOMAIN"])
page.goto(base_url.get())
return page

View file

@ -10,7 +10,6 @@ def condition_always_false(dotenv_config: dict[str, str]) -> bool:
class RunnerAuthentik(Runner):
name = "authentik"
test_dir_name = "tests_authentik"
env_type = "authentik"
setups = [Test(test_file="setup_authentik.py")]
# tests = [Test(test_file="test_authentik_dummy.py")]

View file

@ -4,8 +4,7 @@ from abratest.runner import Runner, Test
class RunnerDemo(Runner):
"""Every env file has a corresponding runner class"""
name: str = "demo" # name of the test, used for logging / output naming
test_dir_name: str = "tests_demo" # dir name holding all tests related to RunnerDemo
env_type = "demo" # name of the test, used for logging / output naming
# this indicates that tests from RunnerDemo depend on the setup from RunnerAuthentik.
# RunnerDemo will only execute, when setup_authentik.py has finished successfully.

View file

@ -7,7 +7,7 @@ from playwright.sync_api import BrowserContext, Page
from abratest.dir_manager import DirManager
from abratest.utils import BaseUrl
pytest_plugins = "tests_authentik.fixtures_authentik"
pytest_plugins = "authentik.tests_authentik.fixtures_authentik"
NEXTCLOUD_DEMO_USER = {
"NEXTCLOUD_USER": "next_demo_user",

View file

@ -6,8 +6,7 @@ def condition_always_false(dotenv_config: dict[str, str]) -> bool:
class RunnerNextcloud(Runner):
name: str = "nextcloud"
test_dir_name: str = "tests_nextcloud"
env_type = "nextcloud"
dependencies = ["authentik"]
setups = [Test(test_file="setup_nextcloud.py", prevent_skip=False)]
tests = [

View file

@ -6,7 +6,7 @@ from playwright.sync_api import BrowserContext, Page
from abratest.dir_manager import DirManager
pytest_plugins = "tests_authentik.fixtures_authentik"
pytest_plugins = "authentik.tests_authentik.fixtures_authentik"
@pytest.fixture

View file

@ -17,8 +17,7 @@ def condition_has_locale(dotenv_config: dict[str, str]) -> bool:
class RunnerWordpress(Runner):
name = "wordpress"
test_dir_name = "tests_wordpress"
env_type = "wordpress"
dependencies = ["authentik"]
setups = [Test(test_file="setup_wordpress.py")]
tests = [