new-features (#5)
* refactoring and rework: runner now has setups / tests / cleanups as lists * add nextcloud runner * add email testing prototype with imap fixture * add dependency resolution (sort env files in input so that test order is correct) Reviewed-on: local-it-infrastructure/e2e_tests#5 Co-authored-by: Daniel <d.brummerloh@gmail.com> Co-committed-by: Daniel <d.brummerloh@gmail.com>
This commit is contained in:
parent
2e33f8f014
commit
d3dc0f942a
32 changed files with 573 additions and 247 deletions
|
|
@ -6,33 +6,38 @@ from playwright.sync_api import BrowserContext, Page
|
|||
|
||||
from src.dirmanager import DirManager
|
||||
|
||||
TIMEOUT = 5000
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def admin_context(context: BrowserContext, DIR: DirManager) -> BrowserContext:
|
||||
state_file = DIR.STATES / "admin_state.json"
|
||||
def authentik_admin_context(context: BrowserContext, DIR: DirManager) -> BrowserContext:
|
||||
state_file = DIR.STATES / "authentik_admin_state.json"
|
||||
storage_state = json.loads(state_file.read_bytes())
|
||||
context.add_cookies(storage_state["cookies"])
|
||||
context.set_default_timeout(TIMEOUT)
|
||||
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"]
|
||||
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)
|
||||
return page
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def user_context(context: BrowserContext, DIR: DirManager) -> BrowserContext:
|
||||
state_file = DIR.STATES / "user_state.json"
|
||||
def authentik_user_context(context: BrowserContext, DIR: DirManager) -> BrowserContext:
|
||||
state_file = DIR.STATES / "authentik_user_state.json"
|
||||
storage_state = json.loads(state_file.read_bytes())
|
||||
context.add_cookies(storage_state["cookies"])
|
||||
context.set_default_timeout(TIMEOUT)
|
||||
return context
|
||||
|
||||
|
||||
@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)
|
||||
return page
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue