new-features (#5)

* refactoring and rework: runner now has setups / tests / cleanups as lists
* add nextcloud runner
* add email testing prototype with imap fixture
* add dependency resolution (sort env files in input so that test order is correct)

Reviewed-on: local-it-infrastructure/e2e_tests#5
Co-authored-by: Daniel <d.brummerloh@gmail.com>
Co-committed-by: Daniel <d.brummerloh@gmail.com>
This commit is contained in:
Daniel 2023-12-04 12:46:30 +01:00 committed by dan
parent 2e33f8f014
commit d3dc0f942a
32 changed files with 573 additions and 247 deletions

View file

@ -5,15 +5,28 @@
# sys.path. It is thus good practise for projects to either put conftest.py under
# a package scope or to never import anything from a conftest.py file.
import os
from imaplib import IMAP4_SSL
from pathlib import Path
import pytest
from dotenv import dotenv_values
from playwright.sync_api import BrowserContext, expect
from pytest import Parser
from src.dirmanager import DirManager
TIMEOUT = 5000
# global timeout and LOCALE
LOCALE = {"Accept-Language": "de_DE"}
TIMEOUT = 7_000
expect.set_options(timeout=TIMEOUT)
@pytest.fixture
def context(context: BrowserContext) -> BrowserContext:
context.set_default_timeout(TIMEOUT)
context.set_extra_http_headers(LOCALE)
return context
def pytest_addoption(parser: Parser):
@ -58,3 +71,18 @@ def dotenv_config(request) -> dict[str, str]:
dotenv_path = Path(dotenv_path)
assert dotenv_path.is_file()
return dotenv_values(dotenv_path) # type: ignore
@pytest.fixture(scope="session")
def imap_ssl_email_client() -> None:
assert os.environ["IMAP_HOST"]
assert os.environ["IMAP_PORT"]
assert os.environ["IMAP_USER"]
assert os.environ["IMAP_PASS"]
port = int(os.environ["IMAP_PORT"])
imap_client = IMAP4_SSL(host=os.environ["IMAP_HOST"], port=port)
imap_client.login(os.environ["IMAP_USER"], os.environ["IMAP_PASS"])
imap_client.select("INBOX")
yield imap_client
imap_client.close()
imap_client.logout()