rework-output-and-test-logic (#3)

* fix flakey tests in authentik / wordpress

* make it possible to rerun tests partially -> passed will be skipped, failed will be repeated

* improve organization of all outputs (moving, renaming, keeping multiple versions etc.)

* add html reports, replace .txt tracebacks

* combine all html reports into one

* add demo runner with comments for documentation purposes

Reviewed-on: local-it-infrastructure/e2e_tests#3
Co-authored-by: Daniel <d.brummerloh@gmail.com>
Co-committed-by: Daniel <d.brummerloh@gmail.com>
This commit is contained in:
Daniel 2023-11-29 14:14:46 +01:00 committed by dan
parent d2cd6ba47f
commit 8172f685de
24 changed files with 588 additions and 418 deletions

View file

@ -1,22 +1,15 @@
# WIP localization
from playwright.sync_api import Page, expect
from playwright.sync_api import BrowserContext, expect
from src.dirmanager import DirManager
def test_has_title(page: Page):
page.goto("https://playwright.dev/")
def test_welcome_message(user_context: BrowserContext, dotenv_config: dict[str, str], DIR: DirManager):
page = user_context.new_page()
url = "https://" + dotenv_config["DOMAIN"]
page.goto(url)
# Expect a title "to contain" a substring.
expect(page).to_have_title(re.compile("Playwright"))
def test_wordpress(admin_session):
context, page = admin_session
with page.expect_popup() as info:
page.get_by_role("link", name="Wordpress").click()
wordpress = info.value
check_for(wordpress.locator("#wpcontent"))
if CONFIG["locale"] == "de":
check_for(wordpress.get_by_role("heading", name="Willkommen bei WordPress!"))
context.tracing.stop(path=f"{RECORDS}/wordpress.zip")
expect(page.locator("#wpcontent")).to_be_visible()
if "locale" in dotenv_config and "de" in dotenv_config["locale"]:
expect(page.get_by_role("heading")).to_have_text("Willkommen bei WordPress!")