make-all-env-files-available (#4)

Before, a test had only access to it's own env file / configuration (wordpress could see wordpress env file). Now, all env files are available. Wordpress test can also read authentik env file, for example to get the authentik domain.

Reviewed-on: local-it-infrastructure/e2e_tests#4
Co-authored-by: Daniel <d.brummerloh@gmail.com>
Co-committed-by: Daniel <d.brummerloh@gmail.com>
This commit is contained in:
Daniel 2023-11-30 10:53:20 +01:00 committed by dan
parent 8172f685de
commit 2e33f8f014
5 changed files with 68 additions and 44 deletions

View file

@ -1,7 +1,8 @@
import json
import pytest
from playwright.sync_api import BrowserContext
from dotenv import dotenv_values
from playwright.sync_api import BrowserContext, Page
from src.dirmanager import DirManager
@ -17,6 +18,17 @@ def admin_context(context: BrowserContext, DIR: DirManager) -> BrowserContext:
return context
@pytest.fixture
def authentik_admin_page(admin_context: BrowserContext, DIR: DirManager) -> Page:
page = admin_context.new_page()
page.pause()
authentik_env_file = DIR.ENV_FILES / "authentik"
authentik_config: dict[str, str] = dotenv_values(authentik_env_file) # type: ignore
url = "https://" + authentik_config["DOMAIN"]
page.goto(url)
return page
@pytest.fixture
def user_context(context: BrowserContext, DIR: DirManager) -> BrowserContext:
state_file = DIR.STATES / "user_state.json"