refactor for independent test dirs #7

Merged
dan merged 49 commits from independent-test-dirs into dev 2023-12-05 21:41:46 +01:00
Showing only changes of commit 7f37b1a8b0 - Show all commits

View file

@ -1,13 +1,32 @@
def test_nextcloud(nc_session): import re
import pytest
from playwright.sync_api import Page, expect
def test_nextcloud_quota(nextcloud_admin_page: Page, dotenv_config: dict[str, str]):
"""Test Nextcloud""" """Test Nextcloud"""
context, page = nc_session if dotenv_config.get("DEFAULT_QUOTA"):
# if page.query_selector('.close-icon'): # get quota from website
# page.get_by_role("button", name="Close modal").click() quota_string = nextcloud_admin_page.get_by_text(
if CONFIG.get("default_quota"): re.compile(r"\d*,\d .* \d*,\d")
quota = int( ).inner_text() # "37,7 MB von 104,9 MB verwendet"
page.get_by_role("listitem", name="Storage informations").get_by_role("link").inner_text().split()[3] out = re.search(r"\d*,\d .* (\d*,\d).", quota_string)
) out_number = out[1] # 104,9
assert quota == CONFIG["default_quota"] out_number = out_number.replace(",", ".")
for app in CONFIG["nc_apps"]: quota_website = float(out_number)
check_for(page.get_by_role("link", name=app))
context.tracing.stop(path=f"{RECORDS}/nextcloud.zip") # get quota from env
quota_config_string = dotenv_config["DEFAULT_QUOTA"] # "100 MB"
assert "MB" in quota_config_string
quota_config = float(quota_config_string.strip("MB"))
assert quota_website == pytest.approx(quota_config, rel=0.1) # within 10%
else:
pytest.skip("DEFAULT_QUOTA not defined in env file")
@pytest.mark.skip
def test_nextcloud_apps(nextcloud_admin_page: Page, dotenv_config: dict[str, str]):
for app in dotenv_config["nc_apps"]:
expect(nextcloud_admin_page.get_by_role("link", name=app)).to_be_visible()