From 859bd57006a4c43add945cc96f59230ff79619c0 Mon Sep 17 00:00:00 2001 From: Moritz Date: Fri, 7 Jul 2023 03:38:10 +0200 Subject: [PATCH] test framework --- .gitignore | 1 + README.md | 2 +- authentik_test.py | 23 +++++ config.yaml | 6 +- conftest.py | 149 ++++++++++++++++++++++++++++ nextcloud_test.py | 90 +++++++++++++++++ pytest.ini | 8 +- test.py | 241 ---------------------------------------------- vikunja_test.py | 12 +++ wekan_test.py | 13 +++ wordpress_test.py | 14 +++ 11 files changed, 313 insertions(+), 246 deletions(-) create mode 100644 authentik_test.py create mode 100644 conftest.py create mode 100644 nextcloud_test.py delete mode 100644 test.py create mode 100644 vikunja_test.py create mode 100644 wekan_test.py create mode 100644 wordpress_test.py diff --git a/.gitignore b/.gitignore index 91f6161..47caf4d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ __pycache__/ *.json *.zip +TestResults/ diff --git a/README.md b/README.md index 64f675c..4d956f1 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,6 @@ playwright install # Run Tests: -pytest -k nextcloud test.py +pytest -k nextcloud playwright show-trace trace.zip diff --git a/authentik_test.py b/authentik_test.py new file mode 100644 index 0000000..0f31679 --- /dev/null +++ b/authentik_test.py @@ -0,0 +1,23 @@ +from conftest import check_for, testuser, RECORDS +# playwright = sync_playwright().start() +# browser = playwright.chromium.launch(headless=False) + +""" Test Changing Username in Authentik """ +def test_authentik_change_username(user_session): + context, page = user_session + page.get_by_role("banner").get_by_role("link").nth(1).click() + page.get_by_placeholder(testuser["username"]).click() + page.get_by_placeholder(testuser["username"]).fill("renameduser") + page.get_by_role("button", name="Speichern").click() + check_for(page.get_by_role("heading", name="Not allowed to change username.")) + context.tracing.stop(path=f"{RECORDS}/change_username.zip") + + +#""" Click all Apps """ +#def test_dashboard(user_session): +# context, page = user_session +# for link in page.locator("ak-library-app").get_by_role("link").all(): +# link.click() +# context.tracing.stop(path=f"{RECORDS}/test_dashboard.zip") +# context.close() +# diff --git a/config.yaml b/config.yaml index 1563b67..34a1018 100644 --- a/config.yaml +++ b/config.yaml @@ -1,7 +1,7 @@ -timeout: 200000 -domain: "https://example.com" +timeout: 1200000 +domain: "https://dev.local-it.cloud" admin: "akadmin" -admin_pw: "" +admin_pw: "grab-football-charting-cherisher-obtrusive-announcer" locale: de default_quota: 10 welcome_message: "Willkommen bei Local-IT" diff --git a/conftest.py b/conftest.py new file mode 100644 index 0000000..b9dfae8 --- /dev/null +++ b/conftest.py @@ -0,0 +1,149 @@ +import pytest +import yaml +from pathlib import Path +from playwright.sync_api import sync_playwright, expect, Browser, Locator +# playwright = sync_playwright().start() +# browser = playwright.chromium.launch(headless=False) + +with open("config.yaml") as file: + CONFIG = yaml.safe_load(file) + +testuser = {'username': 'testuser', + 'name': "Test User", + 'password': 'test123', + 'email': 'test@example.com'} + +RECORDS = Path("records") +RECORDS.mkdir(exist_ok=True) +STATES = Path("states") +STATES.mkdir(exist_ok=True) + +TIMEOUT = CONFIG['timeout'] + +def check_for(locator: Locator): + expect(locator).to_be_visible(timeout=TIMEOUT) + +def setup_context(browser, state_file=None): + if state_file: + context = browser.new_context(storage_state=state_file) + else: + context = browser.new_context() + context.tracing.start(screenshots=True, snapshots=True, sources=True) + context.set_default_timeout(TIMEOUT) + return context + +""" Test Authentik Login and DE Locale """ +@pytest.fixture(scope="session", autouse=True) +def admin_login(browser: Browser): + context = setup_context(browser) + page = context.new_page() + page.goto(CONFIG['domain']) + welcome_message = CONFIG.get('welcome_message') + if welcome_message: + check_for(page.get_by_text(welcome_message)) + if CONFIG['locale'] == 'de': + check_for(page.get_by_text("Benutzername oder Passwort vergessen?")) + check_for(page.get_by_text("E-Mail or Anmeldename")) + check_for(page.get_by_text("Passwort", exact=True)) + page.locator("input[name=\"uidField\"]").fill(CONFIG['admin']) + page.locator("ak-stage-identification input[name=\"password\"]").fill(CONFIG['admin_pw']) + page.get_by_role("button", name="Log In").click() + check_for(page.locator("ak-library")) + if CONFIG['locale'] == 'de': + check_for(page.get_by_text("Meine Anwendungen")) + context.storage_state(path=f"{STATES}/admin_state.json") + page.close() + context.tracing.stop(path=f"{RECORDS}/admin_login.zip") + context.close() + + +""" Create User """ +@pytest.fixture(scope="session", autouse=True) +def init_create_user(browser: Browser, admin_login): + admin_context = setup_context(browser, f"{STATES}/admin_state.json") + admin_page = admin_context.new_page() + invitelink = create_invite_link(admin_page) + admin_context.tracing.stop(path=f"{RECORDS}/create_invite_link.zip") + admin_context.close() + user_context = setup_context(browser) + create_user(user_context, invitelink) + user_context.tracing.stop(path=f"{RECORDS}/create_user.zip") + user_context.close() + +""" Delete User """ +@pytest.fixture(scope="session", autouse=True) +def post_delete_user(browser: Browser): + yield + context = browser.new_context(storage_state=f"{STATES}/admin_state.json") + context.tracing.start(screenshots=True, snapshots=True, sources=True) + context.set_default_timeout(TIMEOUT) + page = context.new_page() + # delete_nextcloud_user(page) + delete_authentik_user(page) + context.tracing.stop(path=f"{RECORDS}/delete_user.zip") + +""" Create Invite Link """ +def create_invite_link(page): + page.goto(CONFIG['domain']) + 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() + page.locator("input[name=\"name\"]").click() + linkname = "testlink9433" + 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() + linklocator = page.get_by_role("rowgroup").filter(has=page.get_by_text(linkname)) + linklocator.locator('.fa-angle-down').click() + invitelink = linklocator.get_by_role("textbox").get_attribute(name='value') + return invitelink + +""" Create User from invitelink """ +def create_user(context, invitelink): + page = context.new_page() + page.goto(invitelink) + page.get_by_placeholder("Benutzername").click() + page.get_by_placeholder("Benutzername").fill(testuser["username"]) + page.locator("input[name=\"name\"]").click() + page.locator("input[name=\"name\"]").fill(testuser["name"]) + page.locator("input[name=\"email\"]").click() + page.locator("input[name=\"email\"]").fill(testuser["email"]) + page.get_by_placeholder("Passwort", exact=True).click() + page.get_by_placeholder("Passwort", exact=True).fill(testuser["password"]) + page.get_by_placeholder("Passwort (wiederholen)").click() + page.get_by_placeholder("Passwort (wiederholen)").fill(testuser["password"]) + page.get_by_role("button", name="Weiter").click() + check_for(page.locator("ak-library")) + context.storage_state(path=f"{STATES}/user_state.json") + +""" Delete Authentik Account """ +def delete_authentik_user(page): + page.goto(CONFIG['domain']) + 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_role("row").filter(has=page.get_by_text(testuser["username"])).get_by_role('checkbox').click() + page.get_by_role("button", name="Löschen").click() + page.get_by_role("dialog").get_by_role("button", name="Löschen").click() + check_for(page.get_by_text('1 Benutzer erfolgreich gelöscht')) + +""" Reuse Authentik Admin Session """ +@pytest.fixture +def admin_session(browser: Browser): + context = setup_context(browser, f"{STATES}/admin_state.json") + page = context.new_page() + page.goto(CONFIG['domain']) + yield context, page + context.close() + +""" Reuse Authentik User Session """ +@pytest.fixture +def user_session(browser: Browser): + context = setup_context(browser, f"{STATES}/user_state.json") + page = context.new_page() + page.goto(CONFIG['domain']) + yield context, page + context.close() diff --git a/nextcloud_test.py b/nextcloud_test.py new file mode 100644 index 0000000..5ecabbf --- /dev/null +++ b/nextcloud_test.py @@ -0,0 +1,90 @@ +import pytest +from playwright.sync_api import Browser, expect +from conftest import CONFIG, RECORDS, check_for, testuser, setup_context, STATES +# playwright = sync_playwright().start() +# browser = playwright.chromium.launch(headless=False) + +""" Delete Nextcloud Account """ +@pytest.fixture(scope="session", autouse=True) +def delete_nextcloud_user(browser: Browser): + yield + context = setup_context(browser, f"{STATES}/admin_state.json") + page = context.new_page() + page.goto(CONFIG['domain']) + with page.expect_popup() as nextcloud_info: + page.get_by_role("link", name="Nextcloud").click() + nextcloud = nextcloud_info.value + nextcloud.get_by_role("link", name="Open settings menu").click() + nextcloud.get_by_role("link", name="Users").click() + nextcloud.locator("#app-content div").filter(has_text=testuser["username"]).get_by_role("button", name="Toggle user actions menu").click() + nextcloud.get_by_role("button", name="Delete user").click() + nextcloud.get_by_role("button", name=f"Delete authentik-{testuser['username']}'s account").click() + context.tracing.stop(path=f"{RECORDS}/nextcloud_delete_user.zip") + context.close() + + +""" Nextcloud Login """ +@pytest.fixture(scope="session", autouse=True) +def nc_login(browser: Browser): + context = setup_context(browser, f"{STATES}/user_state.json") + page = context.new_page() + page.goto(CONFIG['domain']) + with page.expect_popup() as nextcloud_info: + link = page.get_by_role("link", name="Nextcloud") + CONFIG['nc_domain'] = link.get_attribute("href") + link.click() + nextcloud = nextcloud_info.value + check_for(nextcloud.get_by_role("link", name="Name")) + if nextcloud.query_selector('.close-icon'): + close_button = nextcloud.get_by_role("button", name="Close modal") + close_button.click() + expect(close_button).to_be_hidden() + nextcloud.wait_for_timeout(2000) + context.storage_state(path=f"{STATES}/nc_user_state.json") + context.tracing.stop(path=f"{RECORDS}/nextcloud_login_user.zip") + context.close() + +""" Reuse Nextcloud User Session """ +@pytest.fixture +def nc_session(browser: Browser): + context = setup_context(browser, f"{STATES}/nc_user_state.json") + page = context.new_page() + page.goto(CONFIG['nc_domain']) + if page.query_selector('.close-icon'): + page.get_by_role("button", name="Close modal").click() + yield context, page + context.close() + +""" Test Nextcloud """ +def test_nextcloud(nc_session): + context, page = nc_session + #if page.query_selector('.close-icon'): + # page.get_by_role("button", name="Close modal").click() + if CONFIG.get('default_quota'): + quota = int(page.get_by_role("listitem", name="Storage informations").get_by_role("link").inner_text().split()[3]) + assert quota == CONFIG['default_quota'] + for app in CONFIG['nc_apps']: + check_for(page.get_by_role("link", name=app)) + context.tracing.stop(path=f"{RECORDS}/nextcloud.zip") + +""" Test Onlyoffice in Nextcloud """ +def test_onlyoffice(nc_session): + context, page = nc_session + #if page.query_selector('.close-icon'): + # page.get_by_role("button", name="Close modal").click() + page.get_by_role("link", name="New file/folder menu").click() + page.get_by_role("link", name="New document").click() + page.locator("#view9-input-file").fill("test.docx") + page.get_by_role("button", name="Submit").click() + outer_frame = page.frame_locator('#onlyofficeFrame') + check_for(outer_frame.locator('body')) + inner_frame = outer_frame.frame_locator('#app > iframe') + check_for(inner_frame.locator('body')) + onlyoffice = page.frame("frameEditor") + check_for(onlyoffice.locator('//*[@id="area_id"]')) + onlyoffice.locator("#btn-goback").click() + page.get_by_role("link", name="Not favorited test .docx Share Actions").get_by_role("link", name="Actions").click() + page.get_by_role("link", name="Delete file").click() + context.tracing.stop(path=f"{RECORDS}/onlyoffice.zip") + + diff --git a/pytest.ini b/pytest.ini index 11e82de..596079b 100644 --- a/pytest.ini +++ b/pytest.ini @@ -1,3 +1,9 @@ [pytest] -addopts=--headed --browser=firefox --tracing=on --screenshot=on --output=results +addopts=--headed -s --setup-show --browser=firefox --tracing=on --screenshot=on --output=results +# --setup-show + +log_cli = 1 +log_cli_level = INFO +log_file = ./TestResults/test_log.log +log_file_level = INFO diff --git a/test.py b/test.py deleted file mode 100644 index 43792e2..0000000 --- a/test.py +++ /dev/null @@ -1,241 +0,0 @@ -import pytest -import yaml -from random import random -from playwright.sync_api import Playwright, sync_playwright, BrowserContext, expect, Browser, Page, Locator -# playwright = sync_playwright().start() -# browser = playwright.chromium.launch(headless=False) - -with open("config.yaml") as file: - CONFIG = yaml.safe_load(file) - -TIMEOUT = CONFIG['timeout'] - -def check_for(locator: Locator): - expect(locator).to_be_visible(timeout=TIMEOUT) - -""" Test Authentik Login and DE Locale """ -@pytest.fixture(scope="module", autouse=False) -def admin_login(browser: Browser): - context = browser.new_context() - context.set_default_timeout(TIMEOUT) - context.tracing.start(screenshots=True, snapshots=True, sources=True) - page = context.new_page() - page.goto(CONFIG['domain']) - welcome_message = CONFIG.get('welcome_message') - if welcome_message: - check_for(page.get_by_text(welcome_message)) - if CONFIG['locale'] == 'de': - check_for(page.get_by_text("Benutzername oder Passwort vergessen?")) - check_for(page.get_by_text("E-Mail or Anmeldename")) - check_for(page.get_by_text("Passwort", exact=True)) - page.locator("input[name=\"uidField\"]").fill(CONFIG['admin']) - page.locator("ak-stage-identification input[name=\"password\"]").fill(CONFIG['admin_pw']) - page.get_by_role("button", name="Log In").click() - check_for(page.locator("ak-library")) - if CONFIG['locale'] == 'de': - check_for(page.get_by_text("Meine Anwendungen")) - context.storage_state(path="admin_state.json") - page.close() - context.tracing.stop(path="trace.zip") - context.close() - -""" Create User """ -@pytest.fixture(scope="module", autouse=False) -def init_create_user(browser: Browser): - admin_context = browser.new_context(storage_state="admin_state.json") - admin_context.tracing.start(screenshots=True, snapshots=True, sources=True) - admin_context.set_default_timeout(TIMEOUT) - admin_page = admin_context.new_page() - invitelink = create_invite_link(admin_page) - admin_context.tracing.stop(path="create_invite_link.zip") - admin_context.close() - user_context = browser.new_context() - user_context.tracing.start(screenshots=True, snapshots=True, sources=True) - user_context.set_default_timeout(TIMEOUT) - create_user(user_context, invitelink) - user_context.tracing.stop(path="create_user.zip") - user_context.close() - yield - -""" Delete User """ -@pytest.fixture(scope="module", autouse=True) -def post_delete_user(browser: Browser): - yield - context = browser.new_context(storage_state="admin_state.json") - context.tracing.start(screenshots=True, snapshots=True, sources=True) - context.set_default_timeout(TIMEOUT) - page = context.new_page() - delete_nextcloud_user(page) - delete_authentik_user(page) - context.tracing.stop(path="delete_user.zip") - -""" Create Invite Link """ -def create_invite_link(page): - page.goto(CONFIG['domain']) - 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() - page.locator("input[name=\"name\"]").click() - linkname = "testlink9433" - 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() - linklocator = page.get_by_role("rowgroup").filter(has=page.get_by_text(linkname)) - linklocator.locator('.fa-angle-down').click() - invitelink = linklocator.get_by_role("textbox").get_attribute(name='value') - return invitelink - -""" Create User from invitelink """ -def create_user(context, invitelink): - page = context.new_page() - page.goto(invitelink) - page.get_by_placeholder("Benutzername").click() - page.get_by_placeholder("Benutzername").fill("testuser") - page.locator("input[name=\"name\"]").click() - page.locator("input[name=\"name\"]").fill("Test User") - page.locator("input[name=\"email\"]").click() - page.locator("input[name=\"email\"]").fill("test@example.com") - page.get_by_placeholder("Passwort", exact=True).click() - page.get_by_placeholder("Passwort", exact=True).fill("test123") - page.get_by_placeholder("Passwort (wiederholen)").click() - page.get_by_placeholder("Passwort (wiederholen)").fill("test123") - page.get_by_role("button", name="Weiter").click() - check_for(page.locator("ak-library")) - context.storage_state(path="user_state.json") - -""" Delete Nextcloud Account """ -def delete_nextcloud_user(page): - page.goto(CONFIG['domain']) - with page.expect_popup() as nextcloud_info: - page.get_by_role("link", name="Nextcloud").click() - nextcloud = nextcloud_info.value - nextcloud.get_by_role("link", name="Open settings menu").click() - nextcloud.get_by_role("link", name="Users").click() - nextcloud.locator("#app-content div").filter(has_text="testuser").get_by_role("button", name="Toggle user actions menu").click() - nextcloud.get_by_role("button", name="Delete user").click() - nextcloud.get_by_role("button", name="Delete authentik-testuser's account").click() - -""" Delete Authentik Account """ -def delete_authentik_user(page): - page.goto(CONFIG['domain']) - 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_role("row").filter(has=page.get_by_text('testuser')).get_by_role('checkbox').click() - page.get_by_role("button", name="Löschen").click() - page.get_by_role("dialog").get_by_role("button", name="Löschen").click() - check_for(page.get_by_text('1 Benutzer erfolgreich gelöscht')) - - -""" Reuse Authentik Admin Session """ -@pytest.fixture(scope="function") -def admin_session(browser: Browser): - context = browser.new_context(storage_state="admin_state.json") - context.tracing.start(screenshots=True, snapshots=True, sources=True) - context.set_default_timeout(TIMEOUT) - page = context.new_page() - page.goto(CONFIG['domain']) - yield context, page - context.close() - -""" Reuse Authentik User Session """ -@pytest.fixture(scope="function") -def user_session(browser: Browser): - context = browser.new_context(storage_state="user_state.json") - context.tracing.start(screenshots=True, snapshots=True, sources=True) - context.set_default_timeout(TIMEOUT) - page = context.new_page() - page.goto(CONFIG['domain']) - yield context, page - context.close() - -def test_dummy(): - return - -""" Test Changing Username in Authentik """ -def test_authentik_change_username(user_session): - context, page = user_session - page.get_by_role("banner").get_by_role("link").nth(1).click() - page.get_by_placeholder("testuser").click() - page.get_by_placeholder("testuser").fill("renameduser") - page.get_by_role("button", name="Speichern").click() - check_for(page.get_by_role("heading", name="Not allowed to change username.")) - context.tracing.stop(path="change_username.zip") - -""" Test Wordpress """ -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="wordpress.zip") - - -""" Test Wekan """ -def test_wekan(admin_session): - context, page = admin_session - with page.expect_popup() as info: - page.get_by_role("link", name="Wekan").click() - - wekan = info.value - wekan.get_by_role("link", name="Member Settings").click() - check_for(wekan.get_by_role("link", name=" Admin Panel")) - context.tracing.stop(path="wekan.zip") - -""" Test Vikunja """ -def test_vikunja(admin_session): - context, page = admin_session - with page.expect_popup() as info: - page.get_by_role("link", name="Vikunja").click() - - vikunja = info.value - vikunja.get_by_text("Log in with").click() - check_for(vikunja.get_by_placeholder("Add a new task…")) - context.tracing.stop(path="vikunja.zip") - -""" Test Nextcloud """ -def test_nextcloud(user_session): - context, page = user_session - with page.expect_popup() as nextcloud_info: - page.get_by_role("link", name="Nextcloud").click() - nextcloud = nextcloud_info.value - if nextcloud.query_selector('.close-icon'): - nextcloud.get_by_role("button", name="Close modal").click() - if CONFIG.get('default_quota'): - quota = int(nextcloud.get_by_role("listitem", name="Storage informations").get_by_role("link").inner_text().split()[3]) - assert quota == CONFIG['default_quota'] - for app in CONFIG['nc_apps']: - check_for(nextcloud.get_by_role("link", name=app)) - context.tracing.stop(path="nextcloud.zip") - -""" Test Onlyoffice in Nextcloud """ -def test_onlyoffice(user_session): - context, page = user_session - with page.expect_popup() as nextcloud_info: - page.get_by_role("link", name="Nextcloud").click() - nextcloud = nextcloud_info.value - if nextcloud.query_selector('.close-icon'): - nextcloud.get_by_role("button", name="Close modal").click() - nextcloud.get_by_role("link", name="New file/folder menu").click() - nextcloud.get_by_role("link", name="New document").click() - nextcloud.locator("#view9-input-file").fill("test.docx") - nextcloud.get_by_role("button", name="Submit").click() - outer_frame = nextcloud.frame_locator('#onlyofficeFrame') - check_for(outer_frame.locator('body')) - inner_frame = outer_frame.frame_locator('#app > iframe') - check_for(inner_frame.locator('body')) - onlyoffice = nextcloud.frame("frameEditor") - check_for(onlyoffice.locator('//*[@id="area_id"]')) - onlyoffice.locator("#btn-goback").click() - nextcloud.get_by_role("link", name="Not favorited test .docx Share Actions").get_by_role("link", name="Actions").click() - nextcloud.get_by_role("link", name="Delete file").click() - context.tracing.stop(path="onlyoffice.zip") - - diff --git a/vikunja_test.py b/vikunja_test.py new file mode 100644 index 0000000..af06865 --- /dev/null +++ b/vikunja_test.py @@ -0,0 +1,12 @@ +from conftest import check_for, RECORDS + +""" Test Vikunja """ +def test_vikunja(admin_session): + context, page = admin_session + with page.expect_popup() as info: + page.get_by_role("link", name="Vikunja").click() + + vikunja = info.value + vikunja.get_by_text("Log in with").click() + check_for(vikunja.get_by_placeholder("Add a new task…")) + context.tracing.stop(path=f"{RECORDS}/vikunja.zip") diff --git a/wekan_test.py b/wekan_test.py new file mode 100644 index 0000000..331c67a --- /dev/null +++ b/wekan_test.py @@ -0,0 +1,13 @@ +from conftest import check_for, RECORDS + +""" Test Wekan """ +def test_wekan(admin_session): + context, page = admin_session + with page.expect_popup() as info: + page.get_by_role("link", name="Wekan").click() + + wekan = info.value + wekan.get_by_role("link", name="Member Settings").click() + check_for(wekan.get_by_role("link", name=" Admin Panel")) + context.tracing.stop(path=f"{RECORDS}/wekan.zip") + diff --git a/wordpress_test.py b/wordpress_test.py new file mode 100644 index 0000000..c58e4af --- /dev/null +++ b/wordpress_test.py @@ -0,0 +1,14 @@ +from conftest import CONFIG, check_for, RECORDS + +""" Test Wordpress """ +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") +