add wordpress setup
This commit is contained in:
parent
6cfca22168
commit
ab295d815a
3 changed files with 38 additions and 13 deletions
|
|
@ -20,6 +20,7 @@ def condition_has_locale(dotenv_config: dict[str, str]) -> bool:
|
|||
class RunnerWordpress(Runner):
|
||||
name = "wordpress"
|
||||
test_dir_name = "tests_wordpress"
|
||||
main_setup_name = "setup_wordpress.py"
|
||||
main_test_name = "test_wordpress.py"
|
||||
dependencies: list[type[Runner]] = [RunnerAuthentik]
|
||||
sub_tests = [
|
||||
|
|
|
|||
37
src/tests_wordpress/setup_wordpress.py
Normal file
37
src/tests_wordpress/setup_wordpress.py
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
import pytest
|
||||
from playwright.sync_api import BrowserContext, Page, expect
|
||||
|
||||
from src.dirmanager import DirManager
|
||||
|
||||
|
||||
@pytest.mark.xfail(reason="wordpress sso login has not been generated")
|
||||
def test_visit_from_domain(admin_context: BrowserContext, dotenv_config: dict[str, str]):
|
||||
# with authentik_admin_page.expect_popup() as event_context:
|
||||
# authentik_admin_page.get_by_role("link", name="Wordpress").click()
|
||||
# page_wordpress = event_context.value
|
||||
|
||||
page = admin_context.new_page()
|
||||
url = "https://" + dotenv_config["DOMAIN"]
|
||||
page.goto(url)
|
||||
|
||||
# look for content wrapper
|
||||
expect(page.locator("#wpcontent")).to_be_visible()
|
||||
|
||||
# look for admin bar
|
||||
expect(page.locator("#wpadminbar")).to_be_visible()
|
||||
|
||||
|
||||
def setup_visit_from_authentik(authentik_admin_page: Page, DIR: DirManager):
|
||||
with authentik_admin_page.expect_popup() as event_context:
|
||||
authentik_admin_page.get_by_role("link", name="Wordpress").click()
|
||||
page_wordpress = event_context.value
|
||||
|
||||
# look for content wrapper
|
||||
expect(page_wordpress.locator("#wpcontent")).to_be_visible()
|
||||
|
||||
# look for admin bar
|
||||
expect(page_wordpress.locator("#wpadminbar")).to_be_visible()
|
||||
|
||||
context = page_wordpress.context
|
||||
|
||||
context.storage_state(path=f"{DIR.STATES}/wordpress_admin_state.json")
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
from playwright.sync_api import Page, expect
|
||||
|
||||
|
||||
def test_visit_from_authentik(authentik_admin_page: Page):
|
||||
with authentik_admin_page.expect_popup() as event_context:
|
||||
authentik_admin_page.get_by_role("link", name="Wordpress").click()
|
||||
page_wordpress = event_context.value
|
||||
|
||||
# look for content wrapper
|
||||
expect(page_wordpress.locator("#wpcontent")).to_be_visible()
|
||||
|
||||
# look for admin bar
|
||||
expect(page_wordpress.locator("#wpadminbar")).to_be_visible()
|
||||
Loading…
Add table
Add a link
Reference in a new issue