authentik setup and tracing #2

Merged
dan merged 69 commits from working-setup into dev 2023-11-27 17:01:47 +01:00
Showing only changes of commit 772bc1b94a - Show all commits

View file

@ -1,5 +1,6 @@
import json
import os
import re
from pathlib import Path
from playwright.sync_api import BrowserContext, expect
@ -7,6 +8,7 @@ from playwright.sync_api import BrowserContext, expect
ADMIN_USER = os.environ["ADMIN_USER"]
ADMIN_PASS = os.environ["ADMIN_PASS"]
TESTUSER = {"username": "testuser", "name": "Test User", "password": "test123", "email": "test@example.com"}
TIMEOUT = 5000
@ -24,7 +26,7 @@ def test_create_admin_login(context: BrowserContext, dotenv_config: dict[str, st
# login
page.locator('input[name="uidField"]').fill(ADMIN_USER)
page.locator('ak-stage-identification input[name="password"]').fill(ADMIN_USER)
page.locator('ak-stage-identification input[name="password"]').fill(ADMIN_PASS)
page.get_by_role("button", name="Log In").click()
expect(page.locator("ak-library")).to_be_visible(timeout=TIMEOUT)
@ -37,18 +39,41 @@ def create_invite_link(admin_context: BrowserContext, dotenv_config: dict[str, s
url = "https://" + dotenv_config["DOMAIN"]
page.goto(url)
page.get_by_role("link", name="Admin Interface").click()
page.get_by_text("Verzeichnis").click()
page.get_by_text("Benutzer").nth(2).click()
page.get_by_text("Einladungen").click()
page.get_by_role("button", name="Erstellen").first.click()
# regex approach (shorter)
page.get_by_role("button", name=re.compile(r"Directory|Verzeichnis")).click()
# the or approach
# button_dir_en = page.get_by_role("button", name="Directory")
# page.get_by_role("button").get_by_text(re.compile("Verzeichnis|Directory")).click()
# button_dir_de = page.get_by_text("Verzeichnis")
# button_dir_en.or_(button_dir_de).click()
nav = page.locator("ak-sidebar-item", has_text=re.compile(r"Directory|Verzeichnis"))
nav.get_by_role("link", name=re.compile(r"Users|Benutzer")).click()
nav = page.locator("ak-sidebar-item", has_text="Directory")
nav.get_by_role("link", name=re.compile(r"Invitations|Einladungen")).click()
# button_invitation_en = page.get_by_role("link", name="Invitations")
# button_invitation_de = page.get_by_text("Einladungen")
# button_invitation_en.or_(button_invitation_de).click()
page.get_by_role("cell", name=re.compile(r"Keine Objekte|objects")).get_by_role(
"button"
).click() # todo: confirm "objects" for en lang
page.locator('input[name="name"]').click()
linkname = "testlink9433"
linkname = "test_link_123"
page.locator('input[name="name"]').fill(linkname)
page.get_by_placeholder("Wählen Sie ein Objekt aus.").click()
page.get_by_role("option", name="invitation-enrollment-flow invitation-enrollment-flow").click()
page.get_by_text("Erstellen", exact=True).first.click()
page.get_by_role("option", name=re.compile(r"invitation-enrollment-flow")).click()
page.get_by_role("dialog").get_by_role("button", name=re.compile(r"Erstellen|create")).click() # confirm "create"
# page.get_by_text("Erstellen", exact=True).first.click()
linklocator = page.get_by_role("rowgroup").filter(has=page.get_by_text(linkname))
linklocator.locator(".fa-angle-down").click()
# page.get_by_text(linkname).click()
invitelink = linklocator.get_by_role("textbox").get_attribute(name="value")
return invitelink