various (#16)
* add full integration test of cli / pytest_abra with all tests * save path of runner_*.py in runner subclass to improve test discovery -> allows for same test name in two different runners * reorganize output dir names * use URL fixture everywhere * rework coordinator interface * add --session_id to cli args * add log results table * plenty of refactoring * add assert messages * add plenty of tests * add /docs dir with plenty of documentation * fix authentik setup * add authentik cleanup, remove test user * add random test user credential generation and integrate into test routine. random creds are saved to STATES Reviewed-on: local-it-infrastructure/e2e_tests#16 Co-authored-by: Daniel <d.brummerloh@gmail.com> Co-committed-by: Daniel <d.brummerloh@gmail.com>
This commit is contained in:
parent
016b88a68d
commit
2dd765a974
36 changed files with 1145 additions and 432 deletions
|
|
@ -1,11 +1,12 @@
|
|||
from pytest_abra import ConditionArgs, Runner, Test
|
||||
|
||||
|
||||
def condition_has_locale(args: ConditionArgs) -> bool:
|
||||
def env_config_has_locale(args: ConditionArgs) -> bool:
|
||||
env_config = args.env_config
|
||||
if "de" in env_config.get("LOCALE", ""):
|
||||
if "LOCALE" in env_config:
|
||||
return True
|
||||
return False
|
||||
else:
|
||||
return False
|
||||
|
||||
|
||||
class RunnerWordpress(Runner):
|
||||
|
|
@ -16,6 +17,6 @@ class RunnerWordpress(Runner):
|
|||
Test(test_file="setup_wordpress_trigger_email.py"),
|
||||
]
|
||||
tests = [
|
||||
Test(test_file="test_wordpress_receive_email.py", prevent_skip=True),
|
||||
# Test(condition=condition_has_locale, test_file="test_wordpress_localization.py"),
|
||||
# Test(test_file="test_wordpress_receive_email.py", prevent_skip=True),
|
||||
Test(condition=env_config_has_locale, test_file="test_wordpress_localization.py"),
|
||||
]
|
||||
|
|
|
|||
|
|
@ -1,14 +1,13 @@
|
|||
import pytest
|
||||
from playwright.sync_api import BrowserContext, Page, expect
|
||||
|
||||
from pytest_abra.dir_manager import DirManager
|
||||
from pytest_abra import BaseUrl, DirManager
|
||||
|
||||
|
||||
def test_visit_from_domain(authentik_admin_context: BrowserContext, env_config: dict[str, str]):
|
||||
def test_visit_from_domain(authentik_admin_context: BrowserContext, URL: BaseUrl):
|
||||
"""visit wordpress directly with admin_session, expect not to be logged in"""
|
||||
page = authentik_admin_context.new_page()
|
||||
url = "https://" + env_config["DOMAIN"]
|
||||
page.goto(url)
|
||||
page.goto(URL.get())
|
||||
with pytest.raises(AssertionError):
|
||||
# look for admin bar
|
||||
expect(page.locator("#wpadminbar")).to_be_visible(timeout=3_000)
|
||||
|
|
|
|||
|
|
@ -2,14 +2,13 @@
|
|||
|
||||
from playwright.sync_api import BrowserContext, expect
|
||||
|
||||
from pytest_abra.dir_manager import DirManager
|
||||
from pytest_abra import BaseUrl
|
||||
|
||||
|
||||
def test_welcome_message(context: BrowserContext, env_config: dict[str, str], DIR: DirManager):
|
||||
def test_de_welcome_message(context: BrowserContext, env_config: dict[str, str], URL: BaseUrl):
|
||||
page = context.new_page()
|
||||
url = "https://" + env_config["DOMAIN"]
|
||||
page.goto(url)
|
||||
page.goto(URL.get())
|
||||
|
||||
expect(page.locator(".wp-block-heading")).to_be_visible()
|
||||
if "locale" in env_config and "de" in env_config["locale"]:
|
||||
if "de" in env_config.get("locale", ""):
|
||||
expect(page.get_by_role("heading")).to_have_text("Willkommen bei WordPress!")
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
import pytest
|
||||
from icecream import ic
|
||||
|
||||
from pytest_abra.custom_fixtures import Message
|
||||
|
||||
|
||||
@pytest.mark.skip
|
||||
def test_demo(imap_recent_messages: list[Message]):
|
||||
for message in imap_recent_messages:
|
||||
print(dir(message))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue