create authentik_admin_page fixture

This commit is contained in:
Daniel 2023-11-29 21:08:55 +01:00
parent e709264d44
commit 0b6243ca93

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"