From ba7f7ac8c86c2a24a27c9285ff261708a1daca85 Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 4 Dec 2023 17:19:20 +0100 Subject: [PATCH 01/48] add nextcloud to ENV_FILES --- main.py | 1 + 1 file changed, 1 insertion(+) diff --git a/main.py b/main.py index 5821bdf..e870d7f 100644 --- a/main.py +++ b/main.py @@ -23,6 +23,7 @@ from src.utils import get_session_id ENV_FILES = [ Path("envfiles/login.test.dev.local-it.cloud.env"), # authentik Path("envfiles/blog.test.dev.local-it.cloud.env"), # wordpress + Path("envfiles/files.test.dev.local-it.cloud.env"), # nextcloud ] -- 2.47.2 From 8118aac5a8d0ee8bd3277c866047a4338c2bd625 Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 4 Dec 2023 19:04:21 +0100 Subject: [PATCH 02/48] implement nextcloud fixtures --- src/tests_nextcloud/conftest.py | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/src/tests_nextcloud/conftest.py b/src/tests_nextcloud/conftest.py index 0805ce5..e84d84d 100644 --- a/src/tests_nextcloud/conftest.py +++ b/src/tests_nextcloud/conftest.py @@ -1,11 +1,13 @@ +import json import os -from src.tests_authentik.fixtures_authentik import ( - authentik_admin_context, - authentik_admin_page, - authentik_user_context, - authentik_user_page, -) +import pytest +from dotenv import dotenv_values +from playwright.sync_api import BrowserContext, Page + +from src.dir_manager import DirManager + +pytest_plugins = "src.tests_authentik.fixtures_authentik" NEXTCLOUD_DEMO_USER = { "NEXTCLOUD_USER": "next_demo_user", @@ -14,3 +16,21 @@ NEXTCLOUD_DEMO_USER = { for key, value in NEXTCLOUD_DEMO_USER.items(): os.environ[key] = value + + +@pytest.fixture +def nextcloud_admin_context(context: BrowserContext, DIR: DirManager) -> BrowserContext: + state_file = DIR.STATES / "nextcloud_admin_state.json" + storage_state = json.loads(state_file.read_bytes()) + context.add_cookies(storage_state["cookies"]) + return context + + +@pytest.fixture +def nextcloud_admin_page(nextcloud_admin_context: BrowserContext, DIR: DirManager) -> Page: + page = nextcloud_admin_context.new_page() + env_file = DIR.ENV_FILES / "nextcloud" + config: dict[str, str] = dotenv_values(env_file) # type: ignore + url = "https://" + config["DOMAIN"] + page.goto(url) + return page -- 2.47.2 From c02af669fed259d913c6fbe6f856d08ef30e2139 Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 4 Dec 2023 19:04:30 +0100 Subject: [PATCH 03/48] fix nextcloud setup --- src/tests_nextcloud/setup_nextcloud.py | 81 ++++++++++++++++---------- 1 file changed, 50 insertions(+), 31 deletions(-) diff --git a/src/tests_nextcloud/setup_nextcloud.py b/src/tests_nextcloud/setup_nextcloud.py index eb53182..cb01c9b 100644 --- a/src/tests_nextcloud/setup_nextcloud.py +++ b/src/tests_nextcloud/setup_nextcloud.py @@ -1,35 +1,54 @@ -import pytest +from playwright.sync_api import Page, expect + +from src.dir_manager import DirManager + +# url dashboard +# https://files.test.dev.local-it.cloud/apps/dashboard/ +# url files +# https://files.test.dev.local-it.cloud/apps/files/ -@pytest.fixture(scope="session", autouse=True) -def nc_login(browser: Browser): - """Nextcloud Login""" - 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() +def setup_nextcloud_admin_session(authentik_admin_page: Page, DIR: DirManager): + """visit nextcloud from authentik with admin_session to create wordpress_admin_session""" + with authentik_admin_page.expect_popup() as event_context: + authentik_admin_page.get_by_role("link", name="Nextcloud").click() + page_nextcloud = event_context.value + context = page_nextcloud.context + + context.storage_state(path=f"{DIR.STATES}/nextcloud_admin_state.json") + page_nextcloud.goto("/apps/files") + expect(page_nextcloud.get_by_role("link", name="Name")).to_be_visible() -@pytest.fixture -def nc_session(browser: Browser): - """Reuse Nextcloud User Session""" - 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() +# @pytest.fixture(scope="session", autouse=True) +# def nc_login(browser: Browser): +# """Nextcloud Login""" +# 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() + + +# @pytest.fixture +# def nc_session(browser: Browser): +# """Reuse Nextcloud User Session""" +# 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() -- 2.47.2 From e33dc956329639b32dec69f1fa17879bbfec10c2 Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 4 Dec 2023 19:07:58 +0100 Subject: [PATCH 04/48] use Path directly in storage_state --- src/tests_authentik/setup_authentik.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tests_authentik/setup_authentik.py b/src/tests_authentik/setup_authentik.py index 18a4e3f..f348f65 100644 --- a/src/tests_authentik/setup_authentik.py +++ b/src/tests_authentik/setup_authentik.py @@ -31,7 +31,7 @@ def setup_admin_state(context: BrowserContext, dotenv_config: dict[str, str], DI expect(page.locator("ak-library")).to_be_visible() # save state - context.storage_state(path=f"{DIR.STATES}/authentik_admin_state.json") + context.storage_state(path=DIR.STATES / "authentik_admin_state.json") def check_if_user_exists(admin_context: BrowserContext, dotenv_config: dict[str, str]): @@ -116,4 +116,4 @@ def setup_user_state(context: BrowserContext, dotenv_config: dict[str, str], DIR context.clear_cookies() create_user(context, invite_link) - context.storage_state(path=f"{DIR.STATES}/authentik_user_state.json") + context.storage_state(path=DIR.STATES / "authentik_user_state.json") -- 2.47.2 From 6f51dc6766b17e515f0de9c56121b1a4b5009e3f Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 4 Dec 2023 19:08:36 +0100 Subject: [PATCH 05/48] use Path directly in storage_state --- src/tests_nextcloud/setup_nextcloud.py | 2 +- src/tests_wordpress/setup_wordpress.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tests_nextcloud/setup_nextcloud.py b/src/tests_nextcloud/setup_nextcloud.py index cb01c9b..e88a6a6 100644 --- a/src/tests_nextcloud/setup_nextcloud.py +++ b/src/tests_nextcloud/setup_nextcloud.py @@ -15,7 +15,7 @@ def setup_nextcloud_admin_session(authentik_admin_page: Page, DIR: DirManager): page_nextcloud = event_context.value context = page_nextcloud.context - context.storage_state(path=f"{DIR.STATES}/nextcloud_admin_state.json") + context.storage_state(path=DIR.STATES / "nextcloud_admin_state.json") page_nextcloud.goto("/apps/files") expect(page_nextcloud.get_by_role("link", name="Name")).to_be_visible() diff --git a/src/tests_wordpress/setup_wordpress.py b/src/tests_wordpress/setup_wordpress.py index 4feca93..0f3e602 100644 --- a/src/tests_wordpress/setup_wordpress.py +++ b/src/tests_wordpress/setup_wordpress.py @@ -25,4 +25,4 @@ def setup_wordpress_admin_session(authentik_admin_page: Page, DIR: DirManager): expect(page_wordpress.locator("#wpadminbar")).to_be_visible() # save session context = page_wordpress.context - context.storage_state(path=f"{DIR.STATES}/wordpress_admin_state.json") + context.storage_state(path=DIR.STATES / "wordpress_admin_state.json") -- 2.47.2 From ae0c90cb8a517c37598499c6210d257b8c551656 Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 4 Dec 2023 19:34:25 +0100 Subject: [PATCH 06/48] remove prototype --- prototyping/test_urllib.py | 10 ---------- 1 file changed, 10 deletions(-) delete mode 100644 prototyping/test_urllib.py diff --git a/prototyping/test_urllib.py b/prototyping/test_urllib.py deleted file mode 100644 index 074b0a5..0000000 --- a/prototyping/test_urllib.py +++ /dev/null @@ -1,10 +0,0 @@ -# %% -from urllib.parse import parse_qs, urlencode, urlparse, urlunparse - -string = "blog.dev.local-it.cloud" - - -parsed_url = urlparse(string, scheme="https") -print(parsed_url) - -print(urlunparse(parsed_url)) -- 2.47.2 From fb864659d8fc50f251d7aac8ca768d32b14d8c9a Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 4 Dec 2023 19:35:54 +0100 Subject: [PATCH 07/48] add BaseUrl --- src/utils.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/utils.py b/src/utils.py index dcf66f5..e98fa9b 100644 --- a/src/utils.py +++ b/src/utils.py @@ -1,5 +1,20 @@ +from dataclasses import dataclass from datetime import datetime from pathlib import Path +from urllib.parse import urlunparse + + +@dataclass +class BaseUrl: + netloc: str + scheme: str = "https" + path: str = "" + params: str = "" + query: str = "" + fragment: str = "" + + def get(self, path: str = ""): + return urlunparse((self.scheme, self.netloc, path, self.params, self.query, self.fragment)) def get_session_id() -> str: -- 2.47.2 From 164503f4081ae3e3fd93a4571186eef164437833 Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 4 Dec 2023 19:36:06 +0100 Subject: [PATCH 08/48] add BaseUrl test cases --- tests/test_url.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 tests/test_url.py diff --git a/tests/test_url.py b/tests/test_url.py new file mode 100644 index 0000000..796c6f0 --- /dev/null +++ b/tests/test_url.py @@ -0,0 +1,28 @@ +from src.utils import BaseUrl + +url_input = { + "netloc": "blog.dev.local-it.cloud", + "scheme": "https", +} + +url_obj = BaseUrl(**url_input) + + +def test_urllib_domain_only(): + assert url_obj.get() == "https://blog.dev.local-it.cloud" + + +def test_urllib_path_single(): + assert url_obj.get(path="something") == "https://blog.dev.local-it.cloud/something" + + +def test_urllib_path_double(): + assert url_obj.get(path="something/else") == "https://blog.dev.local-it.cloud/something/else" + + +def test_urllib_path_signle_suc_slash(): + assert url_obj.get(path="something/else/") == "https://blog.dev.local-it.cloud/something/else/" + + +def test_urllib_path_signle_pre_slash(): + assert url_obj.get(path="/something/else") == "https://blog.dev.local-it.cloud/something/else" -- 2.47.2 From 5220336effbc913e36e7cd1a1f45fc0498e4a2f7 Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 4 Dec 2023 19:54:02 +0100 Subject: [PATCH 09/48] add global URL fixture --- src/conftest.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/conftest.py b/src/conftest.py index 6098f4e..ddc5122 100644 --- a/src/conftest.py +++ b/src/conftest.py @@ -15,6 +15,7 @@ from playwright.sync_api import BrowserContext, expect from pytest import Parser from src.dir_manager import DirManager +from src.utils import BaseUrl # global timeout and LOCALE LOCALE = {"Accept-Language": "de_DE"} @@ -73,6 +74,11 @@ def dotenv_config(request) -> dict[str, str]: return dotenv_values(dotenv_path) # type: ignore +@pytest.fixture(scope="session", autouse=True) +def URL(dotenv_config: dict[str, str]) -> BaseUrl: + return BaseUrl(netloc=dotenv_config["DOMAIN"]) + + @pytest.fixture(scope="session") def imap_ssl_email_client() -> None: assert os.environ["IMAP_HOST"] -- 2.47.2 From 2958b95c65122fab71721a4c699a9a4c6fe6e279 Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 4 Dec 2023 19:57:01 +0100 Subject: [PATCH 10/48] use url fixture in setup_nextcloud_admin_session, cleanup --- src/tests_nextcloud/setup_nextcloud.py | 41 +++----------------------- 1 file changed, 4 insertions(+), 37 deletions(-) diff --git a/src/tests_nextcloud/setup_nextcloud.py b/src/tests_nextcloud/setup_nextcloud.py index e88a6a6..e816227 100644 --- a/src/tests_nextcloud/setup_nextcloud.py +++ b/src/tests_nextcloud/setup_nextcloud.py @@ -1,6 +1,7 @@ from playwright.sync_api import Page, expect from src.dir_manager import DirManager +from src.utils import BaseUrl # url dashboard # https://files.test.dev.local-it.cloud/apps/dashboard/ @@ -8,47 +9,13 @@ from src.dir_manager import DirManager # https://files.test.dev.local-it.cloud/apps/files/ -def setup_nextcloud_admin_session(authentik_admin_page: Page, DIR: DirManager): +def setup_nextcloud_admin_session(authentik_admin_page: Page, DIR: DirManager, URL: BaseUrl): """visit nextcloud from authentik with admin_session to create wordpress_admin_session""" with authentik_admin_page.expect_popup() as event_context: authentik_admin_page.get_by_role("link", name="Nextcloud").click() page_nextcloud = event_context.value context = page_nextcloud.context - context.storage_state(path=DIR.STATES / "nextcloud_admin_state.json") - page_nextcloud.goto("/apps/files") + page_nextcloud.goto(URL.get("/apps/files")) expect(page_nextcloud.get_by_role("link", name="Name")).to_be_visible() - - -# @pytest.fixture(scope="session", autouse=True) -# def nc_login(browser: Browser): -# """Nextcloud Login""" -# 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() - - -# @pytest.fixture -# def nc_session(browser: Browser): -# """Reuse Nextcloud User Session""" -# 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() + context.storage_state(path=DIR.STATES / "nextcloud_admin_state.json") -- 2.47.2 From 7f37b1a8b098074560cdac9f3391a98bde5c2859 Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 4 Dec 2023 21:48:06 +0100 Subject: [PATCH 11/48] implement test_nextcloud_quota --- src/tests_nextcloud/tests_nextcloud.py | 43 +++++++++++++++++++------- 1 file changed, 31 insertions(+), 12 deletions(-) diff --git a/src/tests_nextcloud/tests_nextcloud.py b/src/tests_nextcloud/tests_nextcloud.py index c9bc5be..b79150f 100644 --- a/src/tests_nextcloud/tests_nextcloud.py +++ b/src/tests_nextcloud/tests_nextcloud.py @@ -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""" - 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") + if dotenv_config.get("DEFAULT_QUOTA"): + # get quota from website + quota_string = nextcloud_admin_page.get_by_text( + re.compile(r"\d*,\d .* \d*,\d") + ).inner_text() # "37,7 MB von 104,9 MB verwendet" + out = re.search(r"\d*,\d .* (\d*,\d).", quota_string) + out_number = out[1] # 104,9 + out_number = out_number.replace(",", ".") + quota_website = float(out_number) + + # 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() -- 2.47.2 From a4391ad9859cde5d0d1de07990bab9bfcb6087fb Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 4 Dec 2023 21:48:22 +0100 Subject: [PATCH 12/48] simplify fixture with baseurl --- src/tests_nextcloud/conftest.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/tests_nextcloud/conftest.py b/src/tests_nextcloud/conftest.py index e84d84d..1a62357 100644 --- a/src/tests_nextcloud/conftest.py +++ b/src/tests_nextcloud/conftest.py @@ -2,10 +2,10 @@ import json import os import pytest -from dotenv import dotenv_values from playwright.sync_api import BrowserContext, Page from src.dir_manager import DirManager +from src.utils import BaseUrl pytest_plugins = "src.tests_authentik.fixtures_authentik" @@ -27,10 +27,7 @@ def nextcloud_admin_context(context: BrowserContext, DIR: DirManager) -> Browser @pytest.fixture -def nextcloud_admin_page(nextcloud_admin_context: BrowserContext, DIR: DirManager) -> Page: +def nextcloud_admin_page(nextcloud_admin_context: BrowserContext, DIR: DirManager, URL: BaseUrl) -> Page: page = nextcloud_admin_context.new_page() - env_file = DIR.ENV_FILES / "nextcloud" - config: dict[str, str] = dotenv_values(env_file) # type: ignore - url = "https://" + config["DOMAIN"] - page.goto(url) + page.goto(URL.get("/apps/files")) return page -- 2.47.2 From e94be119d5e2e057c63b7a775eba3ba0cc0d2d68 Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 4 Dec 2023 21:48:34 +0100 Subject: [PATCH 13/48] use nextcloud setup and tests --- src/tests_nextcloud/runner_nextcloud.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/tests_nextcloud/runner_nextcloud.py b/src/tests_nextcloud/runner_nextcloud.py index 8468815..b866592 100644 --- a/src/tests_nextcloud/runner_nextcloud.py +++ b/src/tests_nextcloud/runner_nextcloud.py @@ -10,9 +10,9 @@ class RunnerNextcloud(Runner): name: str = "nextcloud" test_dir_name: str = "tests_nextcloud" dependencies = [RunnerAuthentik] - setups = [Test(test_file="setup_nextcloud.py")] + setups = [Test(test_file="setup_nextcloud.py", prevent_skip=False)] tests = [ - Test(test_file="tests_nextcloud.py"), - Test(condition=condition_always_false, test_file="tests_nextcloud_onlyoffice.py"), + Test(test_file="tests_nextcloud.py", prevent_skip=True), + # Test(condition=condition_always_false, test_file="tests_nextcloud_onlyoffice.py"), ] # cleanups = [Test(test_file="cleanup_nextcloud.py")] -- 2.47.2 From e98f93557b906a085d6a4d94a67f2b972a0977c3 Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 4 Dec 2023 22:03:45 +0100 Subject: [PATCH 14/48] increase timeout to 15s --- src/conftest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/conftest.py b/src/conftest.py index ddc5122..65adc62 100644 --- a/src/conftest.py +++ b/src/conftest.py @@ -19,7 +19,7 @@ from src.utils import BaseUrl # global timeout and LOCALE LOCALE = {"Accept-Language": "de_DE"} -TIMEOUT = 7_000 +TIMEOUT = 15_000 expect.set_options(timeout=TIMEOUT) -- 2.47.2 From 8b1b30d9078029b201e031d8ab8b4de7e641b02b Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 4 Dec 2023 22:04:37 +0100 Subject: [PATCH 15/48] use URL fixture --- src/tests_authentik/setup_authentik.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/tests_authentik/setup_authentik.py b/src/tests_authentik/setup_authentik.py index f348f65..65d1ac7 100644 --- a/src/tests_authentik/setup_authentik.py +++ b/src/tests_authentik/setup_authentik.py @@ -5,6 +5,7 @@ import re from playwright.sync_api import BrowserContext, expect from src.dir_manager import DirManager +from src.utils import BaseUrl ADMIN_USER = os.environ["ADMIN_USER"] ADMIN_PASS = os.environ["ADMIN_PASS"] @@ -34,11 +35,10 @@ def setup_admin_state(context: BrowserContext, dotenv_config: dict[str, str], DI context.storage_state(path=DIR.STATES / "authentik_admin_state.json") -def check_if_user_exists(admin_context: BrowserContext, dotenv_config: dict[str, str]): +def check_if_user_exists(admin_context: BrowserContext, dotenv_config: dict[str, str], URL: BaseUrl): # go to admin page page = admin_context.new_page() - url = "https://" + dotenv_config["DOMAIN"] - page.goto(url) + page.goto(URL.get()) page.get_by_role("link", name="Admin Interface").click() nav = page.locator("ak-sidebar-item", has_text=re.compile(r"Directory|Verzeichnis")) nav.click() @@ -49,11 +49,10 @@ def check_if_user_exists(admin_context: BrowserContext, dotenv_config: dict[str, return user.is_visible() -def create_invite_link(admin_context: BrowserContext, dotenv_config: dict[str, str]): +def create_invite_link(admin_context: BrowserContext, dotenv_config: dict[str, str], URL: BaseUrl): # go to admin page page = admin_context.new_page() - url = "https://" + dotenv_config["DOMAIN"] - page.goto(url) + page.goto(URL.get()) page.get_by_role("link", name="Admin Interface").click() nav = page.locator("ak-sidebar-item", has_text=re.compile(r"Directory|Verzeichnis")) @@ -99,19 +98,19 @@ def create_user(user_context: BrowserContext, invitelink): expect(page.locator("ak-library")).to_be_visible() -def setup_user_state(context: BrowserContext, dotenv_config: dict[str, str], DIR: DirManager): - # load admin cookies +def setup_user_state(context: BrowserContext, dotenv_config: dict[str, str], DIR: DirManager, URL: BaseUrl): + # load admin cookies to context state_file = DIR.STATES / "authentik_admin_state.json" storage_state = json.loads(state_file.read_bytes()) context.add_cookies(storage_state["cookies"]) - if check_if_user_exists(context, dotenv_config): + if check_if_user_exists(context, dotenv_config, URL): # just login with user pass context.clear_cookies() else: # get invite_link - invite_link = create_invite_link(context, dotenv_config) + invite_link = create_invite_link(context, dotenv_config, URL) # create user context.clear_cookies() create_user(context, invite_link) -- 2.47.2 From f911e8aacd8b8cd1d86c3076bfa139e095ec5f42 Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 4 Dec 2023 23:31:47 +0100 Subject: [PATCH 16/48] add imbox --- requirements.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index a17d5a2..88b903b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,4 +4,5 @@ pytest-playwright python-dotenv icecream loguru -beautifulsoup4 \ No newline at end of file +beautifulsoup4 +imbox -- 2.47.2 From 6da13d1120bec486a743b15fdd9c29ed8f68e29b Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 4 Dec 2023 23:34:19 +0100 Subject: [PATCH 17/48] fix credentials --- prototyping/email_stuff.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/prototyping/email_stuff.py b/prototyping/email_stuff.py index a8896f8..ce0d850 100644 --- a/prototyping/email_stuff.py +++ b/prototyping/email_stuff.py @@ -1,6 +1,7 @@ # %% import email import json +import os from email.header import decode_header from imaplib import IMAP4, IMAP4_SSL from pathlib import Path @@ -11,19 +12,20 @@ cred_file = Path("../credentials.json") with open(cred_file, "r") as f: CREDENTIALS = json.load(f) -username = CREDENTIALS["imap_user"] -password = CREDENTIALS["imap_pass"] +for key, value in CREDENTIALS.items(): + os.environ[key] = value + +IMAP_HOST = os.environ["IMAP_HOST"] +IMAP_PORT = os.environ["IMAP_PORT"] +IMAP_USER = os.environ["IMAP_USER"] +IMAP_PASS = os.environ["IMAP_PASS"] # ----------------------------------- imap ----------------------------------- # -host = "mail.local-it.org" -imap_port = 143 -imap_ssl_port = 993 - -with IMAP4_SSL(host=host) as imap_server: - imap_server.login(username, password) +with IMAP4_SSL(host=IMAP_HOST) as imap_server: + imap_server.login(IMAP_USER, IMAP_PASS) imap_server.select("INBOX") # Search for all emails in the folder -- 2.47.2 From 8f720f889b60f37f23d6f2f0b5093e197584941f Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 4 Dec 2023 23:42:12 +0100 Subject: [PATCH 18/48] initial commit --- prototyping/email_stuff_2.py | 53 ++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 prototyping/email_stuff_2.py diff --git a/prototyping/email_stuff_2.py b/prototyping/email_stuff_2.py new file mode 100644 index 0000000..15cf562 --- /dev/null +++ b/prototyping/email_stuff_2.py @@ -0,0 +1,53 @@ +# %% +import datetime +import json +import os +from pathlib import Path + +from imbox import Imbox + +cred_file = Path("../credentials.json") +with open(cred_file, "r") as f: + CREDENTIALS = json.load(f) + +for key, value in CREDENTIALS.items(): + os.environ[key] = value + +IMAP_HOST = os.environ["IMAP_HOST"] +IMAP_PORT = os.environ["IMAP_PORT"] +IMAP_USER = os.environ["IMAP_USER"] +IMAP_PASS = os.environ["IMAP_PASS"] + + +with Imbox( + hostname=os.environ["IMAP_HOST"], + port=os.environ["IMAP_PORT"], + username=os.environ["IMAP_USER"], + password=os.environ["IMAP_PASS"], + ssl=True, + ssl_context=None, + starttls=False, +) as imbox: + # Get all folders + status, folders_with_additional_info = imbox.folders() + + # Gets all messages from the inbox + all_inbox_messages = imbox.messages() + + # Messages received after specific date + inbox_messages_received_after = imbox.messages(date__gt=datetime.date(2018, 7, 30)) + + # Messages whose subjects contain a string + inbox_messages_subject_christmas = imbox.messages(subject="Christmas") + + for uid, message in all_inbox_messages: + print(uid, message.subject, message.date) + # # Every message is an object with the following keys + + # message.sent_from + # message.sent_to + # message.subject + # message.headers + # message.message_id + # message.date + # message.body.plain -- 2.47.2 From 97fb896c4316c6843cd06a9b8b80ffea09c3b50a Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 5 Dec 2023 16:42:01 +0100 Subject: [PATCH 19/48] turn each test dir into a package --- src/tests_authentik/__init__.py | 0 src/tests_demo/__init__.py | 0 src/tests_nextcloud/__init__.py | 0 src/tests_wordpress/__init__.py | 0 4 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 src/tests_authentik/__init__.py create mode 100644 src/tests_demo/__init__.py create mode 100644 src/tests_nextcloud/__init__.py create mode 100644 src/tests_wordpress/__init__.py diff --git a/src/tests_authentik/__init__.py b/src/tests_authentik/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/tests_demo/__init__.py b/src/tests_demo/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/tests_nextcloud/__init__.py b/src/tests_nextcloud/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/tests_wordpress/__init__.py b/src/tests_wordpress/__init__.py new file mode 100644 index 0000000..e69de29 -- 2.47.2 From 24dae132a12c6fd0b73b991439107c322a2bdb2c Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 5 Dec 2023 16:50:17 +0100 Subject: [PATCH 20/48] turn dependencies into strings --- src/runner.py | 2 +- src/tests_demo/runner_demo.py | 2 +- src/tests_nextcloud/runner_nextcloud.py | 3 +-- src/tests_wordpress/runner_wordpress.py | 3 +-- 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/runner.py b/src/runner.py index 8ef444a..f73b88b 100644 --- a/src/runner.py +++ b/src/runner.py @@ -22,7 +22,7 @@ class Runner: setups: list[Test] = [] tests: list[Test] = [] cleanups: list[Test] = [] - dependencies: list[type["Runner"]] = [] + dependencies: list[str] = [] prevent_skip = False def __init__(self, dotenv_path: Path, output_dir: Path, session_id: str): diff --git a/src/tests_demo/runner_demo.py b/src/tests_demo/runner_demo.py index 2957ad5..67292c2 100644 --- a/src/tests_demo/runner_demo.py +++ b/src/tests_demo/runner_demo.py @@ -12,7 +12,7 @@ class RunnerDemo(Runner): # RunnerDemo will only execute, when setup_authentik.py has finished successfully. # For example, setup_authentik.py generates session states, that can be used as fixtures # that can be loaded from fixtures_authentik.py - dependencies: list[type["Runner"]] = [RunnerAuthentik] + dependencies: list[str] = ["authentik"] # todo: update these comments # Filename of Demo setup. If defined, it will run 1st by executing pytest diff --git a/src/tests_nextcloud/runner_nextcloud.py b/src/tests_nextcloud/runner_nextcloud.py index b866592..e3f4ed4 100644 --- a/src/tests_nextcloud/runner_nextcloud.py +++ b/src/tests_nextcloud/runner_nextcloud.py @@ -1,5 +1,4 @@ from src.runner import Runner, Test -from src.tests_authentik.runner_authentik import RunnerAuthentik def condition_always_false(dotenv_config: dict[str, str]) -> bool: @@ -9,7 +8,7 @@ def condition_always_false(dotenv_config: dict[str, str]) -> bool: class RunnerNextcloud(Runner): name: str = "nextcloud" test_dir_name: str = "tests_nextcloud" - dependencies = [RunnerAuthentik] + dependencies = ["authentik"] setups = [Test(test_file="setup_nextcloud.py", prevent_skip=False)] tests = [ Test(test_file="tests_nextcloud.py", prevent_skip=True), diff --git a/src/tests_wordpress/runner_wordpress.py b/src/tests_wordpress/runner_wordpress.py index 097a66a..9b9ffa1 100644 --- a/src/tests_wordpress/runner_wordpress.py +++ b/src/tests_wordpress/runner_wordpress.py @@ -1,5 +1,4 @@ from src.runner import Runner, Test -from src.tests_authentik.runner_authentik import RunnerAuthentik def condition_always_true(dotenv_config: dict[str, str]) -> bool: @@ -20,7 +19,7 @@ def condition_has_locale(dotenv_config: dict[str, str]) -> bool: class RunnerWordpress(Runner): name = "wordpress" test_dir_name = "tests_wordpress" - dependencies: list[type[Runner]] = [RunnerAuthentik] + dependencies = ["authentik"] setups = [Test(test_file="setup_wordpress.py")] tests = [ Test(test_file="test_wordpress.py"), -- 2.47.2 From d38808ac65d04b523c9caf857ea8083287bc7177 Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 5 Dec 2023 16:50:30 +0100 Subject: [PATCH 21/48] fixup --- src/tests_demo/runner_demo.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/tests_demo/runner_demo.py b/src/tests_demo/runner_demo.py index 67292c2..83ffe42 100644 --- a/src/tests_demo/runner_demo.py +++ b/src/tests_demo/runner_demo.py @@ -1,5 +1,4 @@ from src.runner import Runner, Test -from src.tests_authentik.runner_authentik import RunnerAuthentik class RunnerDemo(Runner): -- 2.47.2 From ce76e143580e9a4a78b16b3de47549eb585d12f5 Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 5 Dec 2023 16:52:23 +0100 Subject: [PATCH 22/48] move all tests to their own dir --- {src => src-tests}/tests_authentik/__init__.py | 0 {src => src-tests}/tests_authentik/fixtures_authentik.py | 0 {src => src-tests}/tests_authentik/runner_authentik.py | 0 {src => src-tests}/tests_authentik/setup_authentik.py | 0 {src => src-tests}/tests_authentik/test_authentik_dummy.py | 0 {src => src-tests}/tests_demo/__init__.py | 0 {src => src-tests}/tests_demo/fixtures_demo.py | 0 {src => src-tests}/tests_demo/runner_demo.py | 0 {src => src-tests}/tests_demo/setup_demo.py | 0 {src => src-tests}/tests_nextcloud/__init__.py | 0 {src => src-tests}/tests_nextcloud/cleanup_nextcloud.py | 0 {src => src-tests}/tests_nextcloud/conftest.py | 0 {src => src-tests}/tests_nextcloud/runner_nextcloud.py | 0 {src => src-tests}/tests_nextcloud/setup_nextcloud.py | 0 {src => src-tests}/tests_nextcloud/tests_nextcloud.py | 0 {src => src-tests}/tests_nextcloud/tests_nextcloud_onlyoffice.py | 0 {src => src-tests}/tests_wordpress/__init__.py | 0 {src => src-tests}/tests_wordpress/conftest.py | 0 {src => src-tests}/tests_wordpress/runner_wordpress.py | 0 {src => src-tests}/tests_wordpress/setup_wordpress.py | 0 {src => src-tests}/tests_wordpress/test_wordpress.py | 0 {src => src-tests}/tests_wordpress/test_wordpress_localization.py | 0 22 files changed, 0 insertions(+), 0 deletions(-) rename {src => src-tests}/tests_authentik/__init__.py (100%) rename {src => src-tests}/tests_authentik/fixtures_authentik.py (100%) rename {src => src-tests}/tests_authentik/runner_authentik.py (100%) rename {src => src-tests}/tests_authentik/setup_authentik.py (100%) rename {src => src-tests}/tests_authentik/test_authentik_dummy.py (100%) rename {src => src-tests}/tests_demo/__init__.py (100%) rename {src => src-tests}/tests_demo/fixtures_demo.py (100%) rename {src => src-tests}/tests_demo/runner_demo.py (100%) rename {src => src-tests}/tests_demo/setup_demo.py (100%) rename {src => src-tests}/tests_nextcloud/__init__.py (100%) rename {src => src-tests}/tests_nextcloud/cleanup_nextcloud.py (100%) rename {src => src-tests}/tests_nextcloud/conftest.py (100%) rename {src => src-tests}/tests_nextcloud/runner_nextcloud.py (100%) rename {src => src-tests}/tests_nextcloud/setup_nextcloud.py (100%) rename {src => src-tests}/tests_nextcloud/tests_nextcloud.py (100%) rename {src => src-tests}/tests_nextcloud/tests_nextcloud_onlyoffice.py (100%) rename {src => src-tests}/tests_wordpress/__init__.py (100%) rename {src => src-tests}/tests_wordpress/conftest.py (100%) rename {src => src-tests}/tests_wordpress/runner_wordpress.py (100%) rename {src => src-tests}/tests_wordpress/setup_wordpress.py (100%) rename {src => src-tests}/tests_wordpress/test_wordpress.py (100%) rename {src => src-tests}/tests_wordpress/test_wordpress_localization.py (100%) diff --git a/src/tests_authentik/__init__.py b/src-tests/tests_authentik/__init__.py similarity index 100% rename from src/tests_authentik/__init__.py rename to src-tests/tests_authentik/__init__.py diff --git a/src/tests_authentik/fixtures_authentik.py b/src-tests/tests_authentik/fixtures_authentik.py similarity index 100% rename from src/tests_authentik/fixtures_authentik.py rename to src-tests/tests_authentik/fixtures_authentik.py diff --git a/src/tests_authentik/runner_authentik.py b/src-tests/tests_authentik/runner_authentik.py similarity index 100% rename from src/tests_authentik/runner_authentik.py rename to src-tests/tests_authentik/runner_authentik.py diff --git a/src/tests_authentik/setup_authentik.py b/src-tests/tests_authentik/setup_authentik.py similarity index 100% rename from src/tests_authentik/setup_authentik.py rename to src-tests/tests_authentik/setup_authentik.py diff --git a/src/tests_authentik/test_authentik_dummy.py b/src-tests/tests_authentik/test_authentik_dummy.py similarity index 100% rename from src/tests_authentik/test_authentik_dummy.py rename to src-tests/tests_authentik/test_authentik_dummy.py diff --git a/src/tests_demo/__init__.py b/src-tests/tests_demo/__init__.py similarity index 100% rename from src/tests_demo/__init__.py rename to src-tests/tests_demo/__init__.py diff --git a/src/tests_demo/fixtures_demo.py b/src-tests/tests_demo/fixtures_demo.py similarity index 100% rename from src/tests_demo/fixtures_demo.py rename to src-tests/tests_demo/fixtures_demo.py diff --git a/src/tests_demo/runner_demo.py b/src-tests/tests_demo/runner_demo.py similarity index 100% rename from src/tests_demo/runner_demo.py rename to src-tests/tests_demo/runner_demo.py diff --git a/src/tests_demo/setup_demo.py b/src-tests/tests_demo/setup_demo.py similarity index 100% rename from src/tests_demo/setup_demo.py rename to src-tests/tests_demo/setup_demo.py diff --git a/src/tests_nextcloud/__init__.py b/src-tests/tests_nextcloud/__init__.py similarity index 100% rename from src/tests_nextcloud/__init__.py rename to src-tests/tests_nextcloud/__init__.py diff --git a/src/tests_nextcloud/cleanup_nextcloud.py b/src-tests/tests_nextcloud/cleanup_nextcloud.py similarity index 100% rename from src/tests_nextcloud/cleanup_nextcloud.py rename to src-tests/tests_nextcloud/cleanup_nextcloud.py diff --git a/src/tests_nextcloud/conftest.py b/src-tests/tests_nextcloud/conftest.py similarity index 100% rename from src/tests_nextcloud/conftest.py rename to src-tests/tests_nextcloud/conftest.py diff --git a/src/tests_nextcloud/runner_nextcloud.py b/src-tests/tests_nextcloud/runner_nextcloud.py similarity index 100% rename from src/tests_nextcloud/runner_nextcloud.py rename to src-tests/tests_nextcloud/runner_nextcloud.py diff --git a/src/tests_nextcloud/setup_nextcloud.py b/src-tests/tests_nextcloud/setup_nextcloud.py similarity index 100% rename from src/tests_nextcloud/setup_nextcloud.py rename to src-tests/tests_nextcloud/setup_nextcloud.py diff --git a/src/tests_nextcloud/tests_nextcloud.py b/src-tests/tests_nextcloud/tests_nextcloud.py similarity index 100% rename from src/tests_nextcloud/tests_nextcloud.py rename to src-tests/tests_nextcloud/tests_nextcloud.py diff --git a/src/tests_nextcloud/tests_nextcloud_onlyoffice.py b/src-tests/tests_nextcloud/tests_nextcloud_onlyoffice.py similarity index 100% rename from src/tests_nextcloud/tests_nextcloud_onlyoffice.py rename to src-tests/tests_nextcloud/tests_nextcloud_onlyoffice.py diff --git a/src/tests_wordpress/__init__.py b/src-tests/tests_wordpress/__init__.py similarity index 100% rename from src/tests_wordpress/__init__.py rename to src-tests/tests_wordpress/__init__.py diff --git a/src/tests_wordpress/conftest.py b/src-tests/tests_wordpress/conftest.py similarity index 100% rename from src/tests_wordpress/conftest.py rename to src-tests/tests_wordpress/conftest.py diff --git a/src/tests_wordpress/runner_wordpress.py b/src-tests/tests_wordpress/runner_wordpress.py similarity index 100% rename from src/tests_wordpress/runner_wordpress.py rename to src-tests/tests_wordpress/runner_wordpress.py diff --git a/src/tests_wordpress/setup_wordpress.py b/src-tests/tests_wordpress/setup_wordpress.py similarity index 100% rename from src/tests_wordpress/setup_wordpress.py rename to src-tests/tests_wordpress/setup_wordpress.py diff --git a/src/tests_wordpress/test_wordpress.py b/src-tests/tests_wordpress/test_wordpress.py similarity index 100% rename from src/tests_wordpress/test_wordpress.py rename to src-tests/tests_wordpress/test_wordpress.py diff --git a/src/tests_wordpress/test_wordpress_localization.py b/src-tests/tests_wordpress/test_wordpress_localization.py similarity index 100% rename from src/tests_wordpress/test_wordpress_localization.py rename to src-tests/tests_wordpress/test_wordpress_localization.py -- 2.47.2 From db8d9f6298be46b2a080e8458bfbe8a097f31d68 Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 5 Dec 2023 16:57:38 +0100 Subject: [PATCH 23/48] remove prevent_skip --- src/runner.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/runner.py b/src/runner.py index f73b88b..a2b3f82 100644 --- a/src/runner.py +++ b/src/runner.py @@ -23,7 +23,6 @@ class Runner: tests: list[Test] = [] cleanups: list[Test] = [] dependencies: list[str] = [] - prevent_skip = False def __init__(self, dotenv_path: Path, output_dir: Path, session_id: str): self.dotenv_path = dotenv_path -- 2.47.2 From f0bf98f61389a516ad5f256367c43b0c8858846d Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 5 Dec 2023 17:04:24 +0100 Subject: [PATCH 24/48] WIP --- src/runner_manager.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 src/runner_manager.py diff --git a/src/runner_manager.py b/src/runner_manager.py new file mode 100644 index 0000000..25a890f --- /dev/null +++ b/src/runner_manager.py @@ -0,0 +1,28 @@ +# should replace static RUNNER_DICT +# WIP + +import importlib +from pathlib import Path +from typing import TYPE_CHECKING + +from icecream import ic + +if TYPE_CHECKING: + from src.env_manager import EnvFile, EnvManager + + +class RunnerManager: + def __init__(self, env_files: list["EnvFile"]): + pass + + root = Path("src") + ic(root.resolve()) + for module_path in root.rglob("*/runner*.py"): + module_path = module_path.as_posix().replace("/", ".").replace(".py", "") + ic(module_path) + module = importlib.import_module(module_path) + ic(dir(module)) + # exit() + + +# ic(RUNNER_DICT) -- 2.47.2 From eee64f454261850ef877d664b8ee25a154574c09 Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 5 Dec 2023 17:04:58 +0100 Subject: [PATCH 25/48] fix dependency types --- src/coordinator.py | 13 ++++++++----- src/env_manager.py | 4 +++- src/runner.py | 7 ++++--- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/coordinator.py b/src/coordinator.py index 509aa3e..676c490 100644 --- a/src/coordinator.py +++ b/src/coordinator.py @@ -39,14 +39,17 @@ class Coordinator: def _load_runners(self, env_files: list[EnvFile]) -> list[Runner]: """Creates an instance of the correct Runner class for each given env file""" - runners = [] + runners: list[Runner] = [] for env_file in env_files: RunnerClass = RUNNER_DICT[env_file.config["TYPE"]] - runners.append( - RunnerClass( - dotenv_path=env_file.env_path, output_dir=self.DIR.output_dir, session_id=self.DIR.session_id - ) + dependency_classes: list[type[Runner]] = [] + for dependency in RunnerClass.dependencies: + dependency_classes.append(RUNNER_DICT[dependency]) + runner_instance = RunnerClass( + dotenv_path=env_file.env_path, output_dir=self.DIR.output_dir, session_id=self.DIR.session_id ) + runner_instance._dependency_runners = dependency_classes + runners.append(runner_instance) return runners def combine_html(self) -> None: diff --git a/src/env_manager.py b/src/env_manager.py index cfc81fb..d53f742 100644 --- a/src/env_manager.py +++ b/src/env_manager.py @@ -6,6 +6,7 @@ from dotenv import dotenv_values from src.dir_manager import DirManager from src.runner_dict import RUNNER_DICT +from src.runner_manager import RunnerManager class EnvFile(NamedTuple): @@ -25,6 +26,7 @@ class DependencyRule(NamedTuple): class EnvManager: def __init__(self, env_paths_list: list[Path]): self.env_files: list[EnvFile] = self._get_env_files(env_paths_list) + self.runner_manager = RunnerManager(self.env_files) self.dependency_rules: list[DependencyRule] = self._get_dependency_rules(self.env_files) self.env_files = self.sort_env_files_by_rule(self.env_files, self.dependency_rules) @@ -46,7 +48,7 @@ class EnvManager: for env_file in env_files: child_runner_class = RUNNER_DICT[env_file.env_type] for dependency in child_runner_class.dependencies: - dependency_rule = DependencyRule(child=child_runner_class.name, dependency=dependency.name) + dependency_rule = DependencyRule(child=child_runner_class.name, dependency=dependency) dependency_rules.append(dependency_rule) return dependency_rules diff --git a/src/runner.py b/src/runner.py index a2b3f82..3bdd085 100644 --- a/src/runner.py +++ b/src/runner.py @@ -23,6 +23,7 @@ class Runner: tests: list[Test] = [] cleanups: list[Test] = [] dependencies: list[str] = [] + _dependency_runners: list[type["Runner"]] = [] def __init__(self, dotenv_path: Path, output_dir: Path, session_id: str): self.dotenv_path = dotenv_path @@ -167,9 +168,9 @@ class Runner: passed_tests = [r.name for r in self.DIRS.RESULTS.glob("*") if "passed" in r.name] results = [] - for dependencie_runner in self.dependencies: - for setup_name in dependencie_runner.setups: - dependencie_identifier = self.combine_names(dependencie_runner.name, setup_name.test_file) + for dependency_runner in self._dependency_runners: + for setup_name in dependency_runner.setups: + dependencie_identifier = self.combine_names(dependency_runner.name, setup_name.test_file) results.append(any(dependencie_identifier in f for f in passed_tests)) return all(results) -- 2.47.2 From b09d7813215619f9136aa558b857aba1b9d21ff0 Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 5 Dec 2023 18:07:54 +0100 Subject: [PATCH 26/48] fix plugin --- src-tests/tests_wordpress/conftest.py | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src-tests/tests_wordpress/conftest.py b/src-tests/tests_wordpress/conftest.py index ac095dc..c844cbf 100644 --- a/src-tests/tests_wordpress/conftest.py +++ b/src-tests/tests_wordpress/conftest.py @@ -6,14 +6,7 @@ from playwright.sync_api import BrowserContext, Page from src.dir_manager import DirManager -# from src.tests_authentik.fixtures_authentik import ( -# authentik_admin_context, -# authentik_admin_page, -# authentik_user_context, -# authentik_user_page, -# ) - -pytest_plugins = "src.tests_authentik.fixtures_authentik" +pytest_plugins = "tests_authentik.fixtures_authentik" @pytest.fixture -- 2.47.2 From 15190508ec91a4a73fcb94d85cf5618b67ad8d4f Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 5 Dec 2023 18:08:02 +0100 Subject: [PATCH 27/48] remove norecursedirs --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 6912f0b..b86261d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -20,4 +20,4 @@ target-version = "py311" [tool.pytest.ini_options] python_functions = "test_* setup_*" -norecursedirs = "previous-work src" \ No newline at end of file +# norecursedirs = "previous-work src" \ No newline at end of file -- 2.47.2 From 52c5e24f7a2c3fe76ada6ba7b48ff87ab438d7ab Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 5 Dec 2023 18:08:34 +0100 Subject: [PATCH 28/48] fix plugins dir --- src-tests/tests_nextcloud/conftest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src-tests/tests_nextcloud/conftest.py b/src-tests/tests_nextcloud/conftest.py index 1a62357..7b8ca2d 100644 --- a/src-tests/tests_nextcloud/conftest.py +++ b/src-tests/tests_nextcloud/conftest.py @@ -7,7 +7,7 @@ from playwright.sync_api import BrowserContext, Page from src.dir_manager import DirManager from src.utils import BaseUrl -pytest_plugins = "src.tests_authentik.fixtures_authentik" +pytest_plugins = "tests_authentik.fixtures_authentik" NEXTCLOUD_DEMO_USER = { "NEXTCLOUD_USER": "next_demo_user", -- 2.47.2 From 71c38e0a509d71baaa6cd8a5eb5b687de29d2c6d Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 5 Dec 2023 18:10:01 +0100 Subject: [PATCH 29/48] rename conftest so it can be imported as plugin --- src/{conftest.py => plugin.py} | 3 +++ 1 file changed, 3 insertions(+) rename src/{conftest.py => plugin.py} (97%) diff --git a/src/conftest.py b/src/plugin.py similarity index 97% rename from src/conftest.py rename to src/plugin.py index 65adc62..d667399 100644 --- a/src/conftest.py +++ b/src/plugin.py @@ -23,6 +23,9 @@ TIMEOUT = 15_000 expect.set_options(timeout=TIMEOUT) +print("heeeeeeeeeeeeeeeeeeeloooooooooooooooooooooooo") + + @pytest.fixture def context(context: BrowserContext) -> BrowserContext: context.set_default_timeout(TIMEOUT) -- 2.47.2 From 8ec64db3df6f6c53d5205ce5a161c91819c5c61b Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 5 Dec 2023 18:10:26 +0100 Subject: [PATCH 30/48] rename again --- src/{plugin.py => plugin-abra.py} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/{plugin.py => plugin-abra.py} (100%) diff --git a/src/plugin.py b/src/plugin-abra.py similarity index 100% rename from src/plugin.py rename to src/plugin-abra.py -- 2.47.2 From 177c2228a19e6b4b726125b684cc9e77d4f6feff Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 5 Dec 2023 18:36:33 +0100 Subject: [PATCH 31/48] remove dir in import --- src/runner_dict.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/runner_dict.py b/src/runner_dict.py index 5b000db..b6955e1 100644 --- a/src/runner_dict.py +++ b/src/runner_dict.py @@ -1,8 +1,8 @@ from typing import TYPE_CHECKING -from src.tests_authentik.runner_authentik import RunnerAuthentik -from src.tests_nextcloud.runner_nextcloud import RunnerNextcloud -from src.tests_wordpress.runner_wordpress import RunnerWordpress +from tests_authentik.runner_authentik import RunnerAuthentik +from tests_nextcloud.runner_nextcloud import RunnerNextcloud +from tests_wordpress.runner_wordpress import RunnerWordpress if TYPE_CHECKING: from src.runner import Runner -- 2.47.2 From c05f79e36c8eb704f32355bdf6209a29704dcdb6 Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 5 Dec 2023 18:56:01 +0100 Subject: [PATCH 32/48] make test more robust --- src-tests/tests_nextcloud/setup_nextcloud.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src-tests/tests_nextcloud/setup_nextcloud.py b/src-tests/tests_nextcloud/setup_nextcloud.py index e816227..650f951 100644 --- a/src-tests/tests_nextcloud/setup_nextcloud.py +++ b/src-tests/tests_nextcloud/setup_nextcloud.py @@ -17,5 +17,5 @@ def setup_nextcloud_admin_session(authentik_admin_page: Page, DIR: DirManager, U context = page_nextcloud.context page_nextcloud.goto(URL.get("/apps/files")) - expect(page_nextcloud.get_by_role("link", name="Name")).to_be_visible() + expect(page_nextcloud.get_by_role("link", name="Name").first).to_be_visible() context.storage_state(path=DIR.STATES / "nextcloud_admin_state.json") -- 2.47.2 From 52922a5be349b4c7361c31fdc8c9d4cf2a648ef9 Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 5 Dec 2023 18:58:51 +0100 Subject: [PATCH 33/48] add recipes dir to dir manager --- main.py | 12 +++++++++++- src/coordinator.py | 8 +++----- src/dir_manager.py | 10 ++++++++-- src/runner.py | 26 +++++++++++++------------- 4 files changed, 35 insertions(+), 21 deletions(-) diff --git a/main.py b/main.py index e870d7f..1a2f9bb 100644 --- a/main.py +++ b/main.py @@ -8,6 +8,13 @@ from src.coordinator import Coordinator from src.dir_manager import DirManager from src.utils import get_session_id +# --------------------------- set all env variables -------------------------- # + + +# add abra-testing dir +os.environ["PYTEST_PLUGINS"] = "src.plugin-abra" # "src.plugin,src.other" + + # ----------------------------- lookup env files ----------------------------- # @@ -31,6 +38,7 @@ ENV_FILES = [ OUTPUT_DIR = Path("./test-output").resolve() +RECIPES_DIR = Path("./src-tests").resolve() # -------------------------- enable playwright debug ------------------------- # @@ -67,7 +75,9 @@ logger.add(log_file) # ---------------------------- initialize and run ---------------------------- # -coordinator = Coordinator(ENV_FILES, output_dir=OUTPUT_DIR, session_id=session_id) +coordinator = Coordinator( + env_paths_list=ENV_FILES, output_dir=OUTPUT_DIR, session_id=session_id, recipes_dir=RECIPES_DIR +) coordinator.setup_test() coordinator.run_test() coordinator.combine_html() diff --git a/src/coordinator.py b/src/coordinator.py index 676c490..6f7d11c 100644 --- a/src/coordinator.py +++ b/src/coordinator.py @@ -11,14 +11,14 @@ from src.utils import rmtree class Coordinator: - def __init__(self, env_paths_list: list[Path], output_dir: Path, session_id: str) -> None: + def __init__(self, env_paths_list: list[Path], output_dir: Path, session_id: str, recipes_dir: Path) -> None: # logging out_string = "".join([e.name + "\n" for e in env_paths_list]) out_string += f"output_dir = {output_dir}\n" out_string += f"session_id = {session_id}" logger.info(f"initialize Coordinator instance with\nenv_paths_list =\n{out_string}") - self.DIR = DirManager(output_dir=output_dir, session_id=session_id) + self.DIR = DirManager(output_dir=output_dir, session_id=session_id, recipes_dir=recipes_dir) self.ENV = EnvManager(env_paths_list) def setup_test(self) -> None: @@ -45,9 +45,7 @@ class Coordinator: dependency_classes: list[type[Runner]] = [] for dependency in RunnerClass.dependencies: dependency_classes.append(RUNNER_DICT[dependency]) - runner_instance = RunnerClass( - dotenv_path=env_file.env_path, output_dir=self.DIR.output_dir, session_id=self.DIR.session_id - ) + runner_instance = RunnerClass(dotenv_path=env_file.env_path, DIR=self.DIR) runner_instance._dependency_runners = dependency_classes runners.append(runner_instance) return runners diff --git a/src/dir_manager.py b/src/dir_manager.py index 10cb867..e172ef5 100644 --- a/src/dir_manager.py +++ b/src/dir_manager.py @@ -16,12 +16,14 @@ class DirManager: ... """ - def __init__(self, output_dir: Path | str, session_id: str): - # root test dir + def __init__(self, output_dir: Path | str, session_id: str, recipes_dir: Path | str = ""): if isinstance(output_dir, str): output_dir = Path(output_dir) self.output_dir = output_dir.resolve() self.session_id = session_id + if isinstance(recipes_dir, str): + recipes_dir = Path(recipes_dir) + self.recipes_dir = recipes_dir def create_all_dirs(self) -> None: dirs: list[Path] = [ @@ -63,3 +65,7 @@ class DirManager: @property def RESULTS(self): return self.SESSION / "results" + + @property + def RECIPES(self): + return self.recipes_dir diff --git a/src/runner.py b/src/runner.py index 3bdd085..1cccb1e 100644 --- a/src/runner.py +++ b/src/runner.py @@ -25,12 +25,10 @@ class Runner: dependencies: list[str] = [] _dependency_runners: list[type["Runner"]] = [] - def __init__(self, dotenv_path: Path, output_dir: Path, session_id: str): + def __init__(self, dotenv_path: Path, DIR: DirManager): self.dotenv_path = dotenv_path self.config: dict[str, str] = dotenv_values(dotenv_path) # type: ignore - self.output_dir = output_dir - self.session_id = session_id - self.DIRS = DirManager(output_dir, session_id) + self.DIR = DIR logger.info(f"creating instance of {self.__class__.__name__}") assert self.test_dir_name @@ -66,7 +64,7 @@ class Runner: # condition_met: true / false identifier_string = self.combine_names(self.name, test.test_file) - test_path = self.root_dir / self.test_dir_name / test.test_file + full_test_path = self.DIR.RECIPES / self.test_dir_name / test.test_file # check if test aleady passed if self._is_test_passed(identifier_string, remove_existing=True): @@ -83,7 +81,7 @@ class Runner: # test condition is undefined or not met logger.info(f"running {identifier_string}") - result = self._call_pytest(test_path) + result = self._call_pytest(full_test_path) self._create_result_file(result=result, identifier_string=identifier_string) def _is_test_passed(self, identifier_string: str, remove_existing: bool = False) -> bool: @@ -96,7 +94,7 @@ class Runner: other than 'passed' will be deleted""" already_passed = False - for result in self.DIRS.RESULTS.glob("*"): + for result in self.DIR.RESULTS.glob("*"): if identifier_string in result.name: # process any result file (passed / failed / skipped) if it exists if "passed" in result.name: @@ -112,6 +110,8 @@ class Runner: command_arguments = [] + # command_arguments.append("--traceconfig") + command_arguments.append("-v") # command_arguments.append("-rx") command_arguments.append(str(full_test_path)) @@ -121,17 +121,17 @@ class Runner: # set root dir for tests output (used in DirManager). this is our custom argument command_arguments.append("--output_dir") - command_arguments.append(str(self.DIRS.OUTPUT_DIR)) + command_arguments.append(str(self.DIR.OUTPUT_DIR)) command_arguments.append("--session_id") - command_arguments.append(self.session_id) + command_arguments.append(self.DIR.session_id) # artifacts dir from pytest # warning: https://github.com/microsoft/playwright-pytest/issues/111 # --output only works with the given context and page fixture # folder needs to be unique! traces will not appear, if every pytest run has same output dir command_arguments.append("--output") - command_arguments.append(str(self.DIRS.RECORDS / "traces" / full_test_path.stem)) + command_arguments.append(str(self.DIR.RECORDS / "traces" / full_test_path.stem)) # tracing command_arguments.append("--tracing") @@ -145,7 +145,7 @@ class Runner: # command_arguments.append("--headed") # html report. Will be combined into one file later. - command_arguments.append(f"--html={self.DIRS.RECORDS / 'html' / full_test_path.with_suffix('.html').name}") + command_arguments.append(f"--html={self.DIR.RECORDS / 'html' / full_test_path.with_suffix('.html').name}") return pytest.main(command_arguments) @@ -157,7 +157,7 @@ class Runner: """create result file to indicated passed/failed or skipped test""" full_name = self.combine_names(self.result_int_to_str(result), identifier_string) - file_path = self.DIRS.RESULTS / full_name + file_path = self.DIR.RESULTS / full_name with open(file_path, "w") as _: pass # create empty file @@ -166,7 +166,7 @@ class Runner: # todo: what about conditional setups? - passed_tests = [r.name for r in self.DIRS.RESULTS.glob("*") if "passed" in r.name] + passed_tests = [r.name for r in self.DIR.RESULTS.glob("*") if "passed" in r.name] results = [] for dependency_runner in self._dependency_runners: for setup_name in dependency_runner.setups: -- 2.47.2 From 659093f6aa839d882eb3edfee2bd485f738909eb Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 5 Dec 2023 19:01:10 +0100 Subject: [PATCH 34/48] reorganize --- main.py | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/main.py b/main.py index 1a2f9bb..c1f3d0c 100644 --- a/main.py +++ b/main.py @@ -8,13 +8,6 @@ from src.coordinator import Coordinator from src.dir_manager import DirManager from src.utils import get_session_id -# --------------------------- set all env variables -------------------------- # - - -# add abra-testing dir -os.environ["PYTEST_PLUGINS"] = "src.plugin-abra" # "src.plugin,src.other" - - # ----------------------------- lookup env files ----------------------------- # @@ -41,12 +34,6 @@ OUTPUT_DIR = Path("./test-output").resolve() RECIPES_DIR = Path("./src-tests").resolve() -# -------------------------- enable playwright debug ------------------------- # - - -# os.environ["PWDEBUG"] = "1" - - # --------------------- load credentials to env variables -------------------- # @@ -58,6 +45,14 @@ for key, value in CREDENTIALS.items(): os.environ[key] = value +# -------------------------- enable playwright debug ------------------------- # + + +# add abra-testing dir +os.environ["PYTEST_PLUGINS"] = "src.plugin-abra" # "src.plugin,src.other" +# os.environ["PWDEBUG"] = "1" + + # ----------------------------- define session_id ---------------------------- # @@ -67,6 +62,7 @@ session_id = get_session_id() # ------------------------------- setup logging ------------------------------ # + DIR = DirManager(output_dir=OUTPUT_DIR, session_id=session_id) log_file = DIR.RECORDS / "coordinator.log" logger.add(log_file) -- 2.47.2 From 3841658e4e5ff5707d475386fbd4d3c5c8945f99 Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 5 Dec 2023 19:02:24 +0100 Subject: [PATCH 35/48] rename testing dir to recipes --- {src-tests => recipes}/tests_authentik/__init__.py | 0 {src-tests => recipes}/tests_authentik/fixtures_authentik.py | 0 {src-tests => recipes}/tests_authentik/runner_authentik.py | 0 {src-tests => recipes}/tests_authentik/setup_authentik.py | 0 {src-tests => recipes}/tests_authentik/test_authentik_dummy.py | 0 {src-tests => recipes}/tests_demo/__init__.py | 0 {src-tests => recipes}/tests_demo/fixtures_demo.py | 0 {src-tests => recipes}/tests_demo/runner_demo.py | 0 {src-tests => recipes}/tests_demo/setup_demo.py | 0 {src-tests => recipes}/tests_nextcloud/__init__.py | 0 {src-tests => recipes}/tests_nextcloud/cleanup_nextcloud.py | 0 {src-tests => recipes}/tests_nextcloud/conftest.py | 0 {src-tests => recipes}/tests_nextcloud/runner_nextcloud.py | 0 {src-tests => recipes}/tests_nextcloud/setup_nextcloud.py | 0 {src-tests => recipes}/tests_nextcloud/tests_nextcloud.py | 0 .../tests_nextcloud/tests_nextcloud_onlyoffice.py | 0 {src-tests => recipes}/tests_wordpress/__init__.py | 0 {src-tests => recipes}/tests_wordpress/conftest.py | 0 {src-tests => recipes}/tests_wordpress/runner_wordpress.py | 0 {src-tests => recipes}/tests_wordpress/setup_wordpress.py | 0 {src-tests => recipes}/tests_wordpress/test_wordpress.py | 0 .../tests_wordpress/test_wordpress_localization.py | 0 22 files changed, 0 insertions(+), 0 deletions(-) rename {src-tests => recipes}/tests_authentik/__init__.py (100%) rename {src-tests => recipes}/tests_authentik/fixtures_authentik.py (100%) rename {src-tests => recipes}/tests_authentik/runner_authentik.py (100%) rename {src-tests => recipes}/tests_authentik/setup_authentik.py (100%) rename {src-tests => recipes}/tests_authentik/test_authentik_dummy.py (100%) rename {src-tests => recipes}/tests_demo/__init__.py (100%) rename {src-tests => recipes}/tests_demo/fixtures_demo.py (100%) rename {src-tests => recipes}/tests_demo/runner_demo.py (100%) rename {src-tests => recipes}/tests_demo/setup_demo.py (100%) rename {src-tests => recipes}/tests_nextcloud/__init__.py (100%) rename {src-tests => recipes}/tests_nextcloud/cleanup_nextcloud.py (100%) rename {src-tests => recipes}/tests_nextcloud/conftest.py (100%) rename {src-tests => recipes}/tests_nextcloud/runner_nextcloud.py (100%) rename {src-tests => recipes}/tests_nextcloud/setup_nextcloud.py (100%) rename {src-tests => recipes}/tests_nextcloud/tests_nextcloud.py (100%) rename {src-tests => recipes}/tests_nextcloud/tests_nextcloud_onlyoffice.py (100%) rename {src-tests => recipes}/tests_wordpress/__init__.py (100%) rename {src-tests => recipes}/tests_wordpress/conftest.py (100%) rename {src-tests => recipes}/tests_wordpress/runner_wordpress.py (100%) rename {src-tests => recipes}/tests_wordpress/setup_wordpress.py (100%) rename {src-tests => recipes}/tests_wordpress/test_wordpress.py (100%) rename {src-tests => recipes}/tests_wordpress/test_wordpress_localization.py (100%) diff --git a/src-tests/tests_authentik/__init__.py b/recipes/tests_authentik/__init__.py similarity index 100% rename from src-tests/tests_authentik/__init__.py rename to recipes/tests_authentik/__init__.py diff --git a/src-tests/tests_authentik/fixtures_authentik.py b/recipes/tests_authentik/fixtures_authentik.py similarity index 100% rename from src-tests/tests_authentik/fixtures_authentik.py rename to recipes/tests_authentik/fixtures_authentik.py diff --git a/src-tests/tests_authentik/runner_authentik.py b/recipes/tests_authentik/runner_authentik.py similarity index 100% rename from src-tests/tests_authentik/runner_authentik.py rename to recipes/tests_authentik/runner_authentik.py diff --git a/src-tests/tests_authentik/setup_authentik.py b/recipes/tests_authentik/setup_authentik.py similarity index 100% rename from src-tests/tests_authentik/setup_authentik.py rename to recipes/tests_authentik/setup_authentik.py diff --git a/src-tests/tests_authentik/test_authentik_dummy.py b/recipes/tests_authentik/test_authentik_dummy.py similarity index 100% rename from src-tests/tests_authentik/test_authentik_dummy.py rename to recipes/tests_authentik/test_authentik_dummy.py diff --git a/src-tests/tests_demo/__init__.py b/recipes/tests_demo/__init__.py similarity index 100% rename from src-tests/tests_demo/__init__.py rename to recipes/tests_demo/__init__.py diff --git a/src-tests/tests_demo/fixtures_demo.py b/recipes/tests_demo/fixtures_demo.py similarity index 100% rename from src-tests/tests_demo/fixtures_demo.py rename to recipes/tests_demo/fixtures_demo.py diff --git a/src-tests/tests_demo/runner_demo.py b/recipes/tests_demo/runner_demo.py similarity index 100% rename from src-tests/tests_demo/runner_demo.py rename to recipes/tests_demo/runner_demo.py diff --git a/src-tests/tests_demo/setup_demo.py b/recipes/tests_demo/setup_demo.py similarity index 100% rename from src-tests/tests_demo/setup_demo.py rename to recipes/tests_demo/setup_demo.py diff --git a/src-tests/tests_nextcloud/__init__.py b/recipes/tests_nextcloud/__init__.py similarity index 100% rename from src-tests/tests_nextcloud/__init__.py rename to recipes/tests_nextcloud/__init__.py diff --git a/src-tests/tests_nextcloud/cleanup_nextcloud.py b/recipes/tests_nextcloud/cleanup_nextcloud.py similarity index 100% rename from src-tests/tests_nextcloud/cleanup_nextcloud.py rename to recipes/tests_nextcloud/cleanup_nextcloud.py diff --git a/src-tests/tests_nextcloud/conftest.py b/recipes/tests_nextcloud/conftest.py similarity index 100% rename from src-tests/tests_nextcloud/conftest.py rename to recipes/tests_nextcloud/conftest.py diff --git a/src-tests/tests_nextcloud/runner_nextcloud.py b/recipes/tests_nextcloud/runner_nextcloud.py similarity index 100% rename from src-tests/tests_nextcloud/runner_nextcloud.py rename to recipes/tests_nextcloud/runner_nextcloud.py diff --git a/src-tests/tests_nextcloud/setup_nextcloud.py b/recipes/tests_nextcloud/setup_nextcloud.py similarity index 100% rename from src-tests/tests_nextcloud/setup_nextcloud.py rename to recipes/tests_nextcloud/setup_nextcloud.py diff --git a/src-tests/tests_nextcloud/tests_nextcloud.py b/recipes/tests_nextcloud/tests_nextcloud.py similarity index 100% rename from src-tests/tests_nextcloud/tests_nextcloud.py rename to recipes/tests_nextcloud/tests_nextcloud.py diff --git a/src-tests/tests_nextcloud/tests_nextcloud_onlyoffice.py b/recipes/tests_nextcloud/tests_nextcloud_onlyoffice.py similarity index 100% rename from src-tests/tests_nextcloud/tests_nextcloud_onlyoffice.py rename to recipes/tests_nextcloud/tests_nextcloud_onlyoffice.py diff --git a/src-tests/tests_wordpress/__init__.py b/recipes/tests_wordpress/__init__.py similarity index 100% rename from src-tests/tests_wordpress/__init__.py rename to recipes/tests_wordpress/__init__.py diff --git a/src-tests/tests_wordpress/conftest.py b/recipes/tests_wordpress/conftest.py similarity index 100% rename from src-tests/tests_wordpress/conftest.py rename to recipes/tests_wordpress/conftest.py diff --git a/src-tests/tests_wordpress/runner_wordpress.py b/recipes/tests_wordpress/runner_wordpress.py similarity index 100% rename from src-tests/tests_wordpress/runner_wordpress.py rename to recipes/tests_wordpress/runner_wordpress.py diff --git a/src-tests/tests_wordpress/setup_wordpress.py b/recipes/tests_wordpress/setup_wordpress.py similarity index 100% rename from src-tests/tests_wordpress/setup_wordpress.py rename to recipes/tests_wordpress/setup_wordpress.py diff --git a/src-tests/tests_wordpress/test_wordpress.py b/recipes/tests_wordpress/test_wordpress.py similarity index 100% rename from src-tests/tests_wordpress/test_wordpress.py rename to recipes/tests_wordpress/test_wordpress.py diff --git a/src-tests/tests_wordpress/test_wordpress_localization.py b/recipes/tests_wordpress/test_wordpress_localization.py similarity index 100% rename from src-tests/tests_wordpress/test_wordpress_localization.py rename to recipes/tests_wordpress/test_wordpress_localization.py -- 2.47.2 From d2f50fb791ebed03ffc8dccf810338c331324c83 Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 5 Dec 2023 19:03:28 +0100 Subject: [PATCH 36/48] move all test files into their own folder, as if this were an authentik recipe repo --- recipes/{ => authentik}/tests_authentik/__init__.py | 0 recipes/{ => authentik}/tests_authentik/fixtures_authentik.py | 0 recipes/{ => authentik}/tests_authentik/runner_authentik.py | 0 recipes/{ => authentik}/tests_authentik/setup_authentik.py | 0 recipes/{ => authentik}/tests_authentik/test_authentik_dummy.py | 0 recipes/{ => demo}/tests_demo/__init__.py | 0 recipes/{ => demo}/tests_demo/fixtures_demo.py | 0 recipes/{ => demo}/tests_demo/runner_demo.py | 0 recipes/{ => demo}/tests_demo/setup_demo.py | 0 recipes/{ => nextcloud}/tests_nextcloud/__init__.py | 0 recipes/{ => nextcloud}/tests_nextcloud/cleanup_nextcloud.py | 0 recipes/{ => nextcloud}/tests_nextcloud/conftest.py | 0 recipes/{ => nextcloud}/tests_nextcloud/runner_nextcloud.py | 0 recipes/{ => nextcloud}/tests_nextcloud/setup_nextcloud.py | 0 recipes/{ => nextcloud}/tests_nextcloud/tests_nextcloud.py | 0 .../{ => nextcloud}/tests_nextcloud/tests_nextcloud_onlyoffice.py | 0 recipes/{ => wordpress}/tests_wordpress/__init__.py | 0 recipes/{ => wordpress}/tests_wordpress/conftest.py | 0 recipes/{ => wordpress}/tests_wordpress/runner_wordpress.py | 0 recipes/{ => wordpress}/tests_wordpress/setup_wordpress.py | 0 recipes/{ => wordpress}/tests_wordpress/test_wordpress.py | 0 .../tests_wordpress/test_wordpress_localization.py | 0 22 files changed, 0 insertions(+), 0 deletions(-) rename recipes/{ => authentik}/tests_authentik/__init__.py (100%) rename recipes/{ => authentik}/tests_authentik/fixtures_authentik.py (100%) rename recipes/{ => authentik}/tests_authentik/runner_authentik.py (100%) rename recipes/{ => authentik}/tests_authentik/setup_authentik.py (100%) rename recipes/{ => authentik}/tests_authentik/test_authentik_dummy.py (100%) rename recipes/{ => demo}/tests_demo/__init__.py (100%) rename recipes/{ => demo}/tests_demo/fixtures_demo.py (100%) rename recipes/{ => demo}/tests_demo/runner_demo.py (100%) rename recipes/{ => demo}/tests_demo/setup_demo.py (100%) rename recipes/{ => nextcloud}/tests_nextcloud/__init__.py (100%) rename recipes/{ => nextcloud}/tests_nextcloud/cleanup_nextcloud.py (100%) rename recipes/{ => nextcloud}/tests_nextcloud/conftest.py (100%) rename recipes/{ => nextcloud}/tests_nextcloud/runner_nextcloud.py (100%) rename recipes/{ => nextcloud}/tests_nextcloud/setup_nextcloud.py (100%) rename recipes/{ => nextcloud}/tests_nextcloud/tests_nextcloud.py (100%) rename recipes/{ => nextcloud}/tests_nextcloud/tests_nextcloud_onlyoffice.py (100%) rename recipes/{ => wordpress}/tests_wordpress/__init__.py (100%) rename recipes/{ => wordpress}/tests_wordpress/conftest.py (100%) rename recipes/{ => wordpress}/tests_wordpress/runner_wordpress.py (100%) rename recipes/{ => wordpress}/tests_wordpress/setup_wordpress.py (100%) rename recipes/{ => wordpress}/tests_wordpress/test_wordpress.py (100%) rename recipes/{ => wordpress}/tests_wordpress/test_wordpress_localization.py (100%) diff --git a/recipes/tests_authentik/__init__.py b/recipes/authentik/tests_authentik/__init__.py similarity index 100% rename from recipes/tests_authentik/__init__.py rename to recipes/authentik/tests_authentik/__init__.py diff --git a/recipes/tests_authentik/fixtures_authentik.py b/recipes/authentik/tests_authentik/fixtures_authentik.py similarity index 100% rename from recipes/tests_authentik/fixtures_authentik.py rename to recipes/authentik/tests_authentik/fixtures_authentik.py diff --git a/recipes/tests_authentik/runner_authentik.py b/recipes/authentik/tests_authentik/runner_authentik.py similarity index 100% rename from recipes/tests_authentik/runner_authentik.py rename to recipes/authentik/tests_authentik/runner_authentik.py diff --git a/recipes/tests_authentik/setup_authentik.py b/recipes/authentik/tests_authentik/setup_authentik.py similarity index 100% rename from recipes/tests_authentik/setup_authentik.py rename to recipes/authentik/tests_authentik/setup_authentik.py diff --git a/recipes/tests_authentik/test_authentik_dummy.py b/recipes/authentik/tests_authentik/test_authentik_dummy.py similarity index 100% rename from recipes/tests_authentik/test_authentik_dummy.py rename to recipes/authentik/tests_authentik/test_authentik_dummy.py diff --git a/recipes/tests_demo/__init__.py b/recipes/demo/tests_demo/__init__.py similarity index 100% rename from recipes/tests_demo/__init__.py rename to recipes/demo/tests_demo/__init__.py diff --git a/recipes/tests_demo/fixtures_demo.py b/recipes/demo/tests_demo/fixtures_demo.py similarity index 100% rename from recipes/tests_demo/fixtures_demo.py rename to recipes/demo/tests_demo/fixtures_demo.py diff --git a/recipes/tests_demo/runner_demo.py b/recipes/demo/tests_demo/runner_demo.py similarity index 100% rename from recipes/tests_demo/runner_demo.py rename to recipes/demo/tests_demo/runner_demo.py diff --git a/recipes/tests_demo/setup_demo.py b/recipes/demo/tests_demo/setup_demo.py similarity index 100% rename from recipes/tests_demo/setup_demo.py rename to recipes/demo/tests_demo/setup_demo.py diff --git a/recipes/tests_nextcloud/__init__.py b/recipes/nextcloud/tests_nextcloud/__init__.py similarity index 100% rename from recipes/tests_nextcloud/__init__.py rename to recipes/nextcloud/tests_nextcloud/__init__.py diff --git a/recipes/tests_nextcloud/cleanup_nextcloud.py b/recipes/nextcloud/tests_nextcloud/cleanup_nextcloud.py similarity index 100% rename from recipes/tests_nextcloud/cleanup_nextcloud.py rename to recipes/nextcloud/tests_nextcloud/cleanup_nextcloud.py diff --git a/recipes/tests_nextcloud/conftest.py b/recipes/nextcloud/tests_nextcloud/conftest.py similarity index 100% rename from recipes/tests_nextcloud/conftest.py rename to recipes/nextcloud/tests_nextcloud/conftest.py diff --git a/recipes/tests_nextcloud/runner_nextcloud.py b/recipes/nextcloud/tests_nextcloud/runner_nextcloud.py similarity index 100% rename from recipes/tests_nextcloud/runner_nextcloud.py rename to recipes/nextcloud/tests_nextcloud/runner_nextcloud.py diff --git a/recipes/tests_nextcloud/setup_nextcloud.py b/recipes/nextcloud/tests_nextcloud/setup_nextcloud.py similarity index 100% rename from recipes/tests_nextcloud/setup_nextcloud.py rename to recipes/nextcloud/tests_nextcloud/setup_nextcloud.py diff --git a/recipes/tests_nextcloud/tests_nextcloud.py b/recipes/nextcloud/tests_nextcloud/tests_nextcloud.py similarity index 100% rename from recipes/tests_nextcloud/tests_nextcloud.py rename to recipes/nextcloud/tests_nextcloud/tests_nextcloud.py diff --git a/recipes/tests_nextcloud/tests_nextcloud_onlyoffice.py b/recipes/nextcloud/tests_nextcloud/tests_nextcloud_onlyoffice.py similarity index 100% rename from recipes/tests_nextcloud/tests_nextcloud_onlyoffice.py rename to recipes/nextcloud/tests_nextcloud/tests_nextcloud_onlyoffice.py diff --git a/recipes/tests_wordpress/__init__.py b/recipes/wordpress/tests_wordpress/__init__.py similarity index 100% rename from recipes/tests_wordpress/__init__.py rename to recipes/wordpress/tests_wordpress/__init__.py diff --git a/recipes/tests_wordpress/conftest.py b/recipes/wordpress/tests_wordpress/conftest.py similarity index 100% rename from recipes/tests_wordpress/conftest.py rename to recipes/wordpress/tests_wordpress/conftest.py diff --git a/recipes/tests_wordpress/runner_wordpress.py b/recipes/wordpress/tests_wordpress/runner_wordpress.py similarity index 100% rename from recipes/tests_wordpress/runner_wordpress.py rename to recipes/wordpress/tests_wordpress/runner_wordpress.py diff --git a/recipes/tests_wordpress/setup_wordpress.py b/recipes/wordpress/tests_wordpress/setup_wordpress.py similarity index 100% rename from recipes/tests_wordpress/setup_wordpress.py rename to recipes/wordpress/tests_wordpress/setup_wordpress.py diff --git a/recipes/tests_wordpress/test_wordpress.py b/recipes/wordpress/tests_wordpress/test_wordpress.py similarity index 100% rename from recipes/tests_wordpress/test_wordpress.py rename to recipes/wordpress/tests_wordpress/test_wordpress.py diff --git a/recipes/tests_wordpress/test_wordpress_localization.py b/recipes/wordpress/tests_wordpress/test_wordpress_localization.py similarity index 100% rename from recipes/tests_wordpress/test_wordpress_localization.py rename to recipes/wordpress/tests_wordpress/test_wordpress_localization.py -- 2.47.2 From 01c294d44b231c93651946ad7c5092140d5437e6 Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 5 Dec 2023 19:18:17 +0100 Subject: [PATCH 37/48] rename src to abratest --- {src => abratest}/__init__.py | 0 {src => abratest}/coordinator.py | 12 ++++++------ {src => abratest}/dir_manager.py | 0 {src => abratest}/env_manager.py | 6 +++--- {src => abratest}/html_helper.py | 0 {src => abratest}/plugin-abra.py | 4 ++-- {src => abratest}/runner.py | 4 ++-- {src => abratest}/runner_dict.py | 8 ++++---- {src => abratest}/runner_manager.py | 2 +- {src => abratest}/utils.py | 0 main.py | 10 +++++----- previous-work/wordpress_test.py | 2 +- .../authentik/tests_authentik/fixtures_authentik.py | 2 +- .../authentik/tests_authentik/runner_authentik.py | 2 +- recipes/authentik/tests_authentik/setup_authentik.py | 4 ++-- recipes/demo/tests_demo/fixtures_demo.py | 4 ++-- recipes/demo/tests_demo/runner_demo.py | 2 +- recipes/nextcloud/tests_nextcloud/conftest.py | 4 ++-- .../nextcloud/tests_nextcloud/runner_nextcloud.py | 2 +- recipes/nextcloud/tests_nextcloud/setup_nextcloud.py | 4 ++-- recipes/wordpress/tests_wordpress/conftest.py | 2 +- .../wordpress/tests_wordpress/runner_wordpress.py | 2 +- recipes/wordpress/tests_wordpress/setup_wordpress.py | 2 +- .../tests_wordpress/test_wordpress_localization.py | 2 +- tests/test_env_resolution.py | 4 ++-- tests/test_url.py | 2 +- 26 files changed, 43 insertions(+), 43 deletions(-) rename {src => abratest}/__init__.py (100%) rename {src => abratest}/coordinator.py (92%) rename {src => abratest}/dir_manager.py (100%) rename {src => abratest}/env_manager.py (96%) rename {src => abratest}/html_helper.py (100%) rename {src => abratest}/plugin-abra.py (97%) rename {src => abratest}/runner.py (98%) rename {src => abratest}/runner_dict.py (54%) rename {src => abratest}/runner_manager.py (91%) rename {src => abratest}/utils.py (100%) diff --git a/src/__init__.py b/abratest/__init__.py similarity index 100% rename from src/__init__.py rename to abratest/__init__.py diff --git a/src/coordinator.py b/abratest/coordinator.py similarity index 92% rename from src/coordinator.py rename to abratest/coordinator.py index 6f7d11c..69593ec 100644 --- a/src/coordinator.py +++ b/abratest/coordinator.py @@ -2,12 +2,12 @@ from pathlib import Path from loguru import logger -from src.dir_manager import DirManager -from src.env_manager import EnvFile, EnvManager -from src.html_helper import merge_html_files -from src.runner import Runner -from src.runner_dict import RUNNER_DICT -from src.utils import rmtree +from abratest.dir_manager import DirManager +from abratest.env_manager import EnvFile, EnvManager +from abratest.html_helper import merge_html_files +from abratest.runner import Runner +from abratest.runner_dict import RUNNER_DICT +from abratest.utils import rmtree class Coordinator: diff --git a/src/dir_manager.py b/abratest/dir_manager.py similarity index 100% rename from src/dir_manager.py rename to abratest/dir_manager.py diff --git a/src/env_manager.py b/abratest/env_manager.py similarity index 96% rename from src/env_manager.py rename to abratest/env_manager.py index d53f742..9eb2232 100644 --- a/src/env_manager.py +++ b/abratest/env_manager.py @@ -4,9 +4,9 @@ from typing import NamedTuple from dotenv import dotenv_values -from src.dir_manager import DirManager -from src.runner_dict import RUNNER_DICT -from src.runner_manager import RunnerManager +from abratest.dir_manager import DirManager +from abratest.runner_dict import RUNNER_DICT +from abratest.runner_manager import RunnerManager class EnvFile(NamedTuple): diff --git a/src/html_helper.py b/abratest/html_helper.py similarity index 100% rename from src/html_helper.py rename to abratest/html_helper.py diff --git a/src/plugin-abra.py b/abratest/plugin-abra.py similarity index 97% rename from src/plugin-abra.py rename to abratest/plugin-abra.py index d667399..62f5480 100644 --- a/src/plugin-abra.py +++ b/abratest/plugin-abra.py @@ -14,8 +14,8 @@ from dotenv import dotenv_values from playwright.sync_api import BrowserContext, expect from pytest import Parser -from src.dir_manager import DirManager -from src.utils import BaseUrl +from abratest.dir_manager import DirManager +from abratest.utils import BaseUrl # global timeout and LOCALE LOCALE = {"Accept-Language": "de_DE"} diff --git a/src/runner.py b/abratest/runner.py similarity index 98% rename from src/runner.py rename to abratest/runner.py index 1cccb1e..8ea95a4 100644 --- a/src/runner.py +++ b/abratest/runner.py @@ -6,7 +6,7 @@ import pytest from dotenv import dotenv_values from loguru import logger -from src.dir_manager import DirManager +from abratest.dir_manager import DirManager @dataclass @@ -64,7 +64,7 @@ class Runner: # condition_met: true / false identifier_string = self.combine_names(self.name, test.test_file) - full_test_path = self.DIR.RECIPES / self.test_dir_name / test.test_file + full_test_path = self.DIR.RECIPES / self.name / self.test_dir_name / test.test_file # check if test aleady passed if self._is_test_passed(identifier_string, remove_existing=True): diff --git a/src/runner_dict.py b/abratest/runner_dict.py similarity index 54% rename from src/runner_dict.py rename to abratest/runner_dict.py index b6955e1..e4b694d 100644 --- a/src/runner_dict.py +++ b/abratest/runner_dict.py @@ -1,11 +1,11 @@ from typing import TYPE_CHECKING -from tests_authentik.runner_authentik import RunnerAuthentik -from tests_nextcloud.runner_nextcloud import RunnerNextcloud -from tests_wordpress.runner_wordpress import RunnerWordpress +from authentik.tests_authentik.runner_authentik import RunnerAuthentik +from nextcloud.tests_nextcloud.runner_nextcloud import RunnerNextcloud +from wordpress.tests_wordpress.runner_wordpress import RunnerWordpress if TYPE_CHECKING: - from src.runner import Runner + from abratest.runner import Runner # Register all runners here. Each .env file with TYPE=authentik will be run with RunnerAuthentik diff --git a/src/runner_manager.py b/abratest/runner_manager.py similarity index 91% rename from src/runner_manager.py rename to abratest/runner_manager.py index 25a890f..c6fd6b3 100644 --- a/src/runner_manager.py +++ b/abratest/runner_manager.py @@ -8,7 +8,7 @@ from typing import TYPE_CHECKING from icecream import ic if TYPE_CHECKING: - from src.env_manager import EnvFile, EnvManager + from abratest.env_manager import EnvFile, EnvManager class RunnerManager: diff --git a/src/utils.py b/abratest/utils.py similarity index 100% rename from src/utils.py rename to abratest/utils.py diff --git a/main.py b/main.py index c1f3d0c..60321ef 100644 --- a/main.py +++ b/main.py @@ -4,9 +4,9 @@ from pathlib import Path from loguru import logger -from src.coordinator import Coordinator -from src.dir_manager import DirManager -from src.utils import get_session_id +from abratest.coordinator import Coordinator +from abratest.dir_manager import DirManager +from abratest.utils import get_session_id # ----------------------------- lookup env files ----------------------------- # @@ -31,7 +31,7 @@ ENV_FILES = [ OUTPUT_DIR = Path("./test-output").resolve() -RECIPES_DIR = Path("./src-tests").resolve() +RECIPES_DIR = Path("./recipes").resolve() # --------------------- load credentials to env variables -------------------- # @@ -49,7 +49,7 @@ for key, value in CREDENTIALS.items(): # add abra-testing dir -os.environ["PYTEST_PLUGINS"] = "src.plugin-abra" # "src.plugin,src.other" +os.environ["PYTEST_PLUGINS"] = "abratest.plugin-abra" # "abratest.plugin,abratest.other" # os.environ["PWDEBUG"] = "1" diff --git a/previous-work/wordpress_test.py b/previous-work/wordpress_test.py index 0e84a46..bf61351 100644 --- a/previous-work/wordpress_test.py +++ b/previous-work/wordpress_test.py @@ -1,6 +1,6 @@ from playwright.sync_api import BrowserContext, expect -from src.dir_manager import DirManager +from abratest.dir_manager import DirManager def test_wordpress(admin_session: BrowserContext, dotenv_config: dict[str, str], DIR: DirManager): diff --git a/recipes/authentik/tests_authentik/fixtures_authentik.py b/recipes/authentik/tests_authentik/fixtures_authentik.py index 6b24538..3f27b43 100644 --- a/recipes/authentik/tests_authentik/fixtures_authentik.py +++ b/recipes/authentik/tests_authentik/fixtures_authentik.py @@ -4,7 +4,7 @@ import pytest from dotenv import dotenv_values from playwright.sync_api import BrowserContext, Page -from src.dir_manager import DirManager +from abratest.dir_manager import DirManager @pytest.fixture diff --git a/recipes/authentik/tests_authentik/runner_authentik.py b/recipes/authentik/tests_authentik/runner_authentik.py index 5b19788..a3bba32 100644 --- a/recipes/authentik/tests_authentik/runner_authentik.py +++ b/recipes/authentik/tests_authentik/runner_authentik.py @@ -1,4 +1,4 @@ -from src.runner import Runner, Test +from abratest.runner import Runner, Test def condition_always_true(dotenv_config: dict[str, str]) -> bool: diff --git a/recipes/authentik/tests_authentik/setup_authentik.py b/recipes/authentik/tests_authentik/setup_authentik.py index 65d1ac7..b7f7f37 100644 --- a/recipes/authentik/tests_authentik/setup_authentik.py +++ b/recipes/authentik/tests_authentik/setup_authentik.py @@ -4,8 +4,8 @@ import re from playwright.sync_api import BrowserContext, expect -from src.dir_manager import DirManager -from src.utils import BaseUrl +from abratest.dir_manager import DirManager +from abratest.utils import BaseUrl ADMIN_USER = os.environ["ADMIN_USER"] ADMIN_PASS = os.environ["ADMIN_PASS"] diff --git a/recipes/demo/tests_demo/fixtures_demo.py b/recipes/demo/tests_demo/fixtures_demo.py index f4a3919..b271e60 100644 --- a/recipes/demo/tests_demo/fixtures_demo.py +++ b/recipes/demo/tests_demo/fixtures_demo.py @@ -5,7 +5,7 @@ depend on [demo]. For this to work 1. the Runner class of the other test needs to define the depencency as seen by referencing RunnerDemo in the dependencies list: -from src.tests_demo.runner_demo import RunnerDemo +from abratest.tests_demo.runner_demo import RunnerDemo class RunnerOther(Runner): dependencies = [RunnerDemo] @@ -15,7 +15,7 @@ class RunnerOther(Runner): To globally import for all tests in 'other', the import should be done in conftest: in 'conftest.py' in 'test_other' dir: -from src.tests_demo.fixtures_demo import demo_fixture +from abratest.tests_demo.fixtures_demo import demo_fixture """ import pytest diff --git a/recipes/demo/tests_demo/runner_demo.py b/recipes/demo/tests_demo/runner_demo.py index 83ffe42..ab2618c 100644 --- a/recipes/demo/tests_demo/runner_demo.py +++ b/recipes/demo/tests_demo/runner_demo.py @@ -1,4 +1,4 @@ -from src.runner import Runner, Test +from abratest.runner import Runner, Test class RunnerDemo(Runner): diff --git a/recipes/nextcloud/tests_nextcloud/conftest.py b/recipes/nextcloud/tests_nextcloud/conftest.py index 7b8ca2d..88f5b09 100644 --- a/recipes/nextcloud/tests_nextcloud/conftest.py +++ b/recipes/nextcloud/tests_nextcloud/conftest.py @@ -4,8 +4,8 @@ import os import pytest from playwright.sync_api import BrowserContext, Page -from src.dir_manager import DirManager -from src.utils import BaseUrl +from abratest.dir_manager import DirManager +from abratest.utils import BaseUrl pytest_plugins = "tests_authentik.fixtures_authentik" diff --git a/recipes/nextcloud/tests_nextcloud/runner_nextcloud.py b/recipes/nextcloud/tests_nextcloud/runner_nextcloud.py index e3f4ed4..8ea7063 100644 --- a/recipes/nextcloud/tests_nextcloud/runner_nextcloud.py +++ b/recipes/nextcloud/tests_nextcloud/runner_nextcloud.py @@ -1,4 +1,4 @@ -from src.runner import Runner, Test +from abratest.runner import Runner, Test def condition_always_false(dotenv_config: dict[str, str]) -> bool: diff --git a/recipes/nextcloud/tests_nextcloud/setup_nextcloud.py b/recipes/nextcloud/tests_nextcloud/setup_nextcloud.py index 650f951..7c041dd 100644 --- a/recipes/nextcloud/tests_nextcloud/setup_nextcloud.py +++ b/recipes/nextcloud/tests_nextcloud/setup_nextcloud.py @@ -1,7 +1,7 @@ from playwright.sync_api import Page, expect -from src.dir_manager import DirManager -from src.utils import BaseUrl +from abratest.dir_manager import DirManager +from abratest.utils import BaseUrl # url dashboard # https://files.test.dev.local-it.cloud/apps/dashboard/ diff --git a/recipes/wordpress/tests_wordpress/conftest.py b/recipes/wordpress/tests_wordpress/conftest.py index c844cbf..db4e529 100644 --- a/recipes/wordpress/tests_wordpress/conftest.py +++ b/recipes/wordpress/tests_wordpress/conftest.py @@ -4,7 +4,7 @@ import pytest from dotenv import dotenv_values from playwright.sync_api import BrowserContext, Page -from src.dir_manager import DirManager +from abratest.dir_manager import DirManager pytest_plugins = "tests_authentik.fixtures_authentik" diff --git a/recipes/wordpress/tests_wordpress/runner_wordpress.py b/recipes/wordpress/tests_wordpress/runner_wordpress.py index 9b9ffa1..7167ce8 100644 --- a/recipes/wordpress/tests_wordpress/runner_wordpress.py +++ b/recipes/wordpress/tests_wordpress/runner_wordpress.py @@ -1,4 +1,4 @@ -from src.runner import Runner, Test +from abratest.runner import Runner, Test def condition_always_true(dotenv_config: dict[str, str]) -> bool: diff --git a/recipes/wordpress/tests_wordpress/setup_wordpress.py b/recipes/wordpress/tests_wordpress/setup_wordpress.py index 0f3e602..0d8243a 100644 --- a/recipes/wordpress/tests_wordpress/setup_wordpress.py +++ b/recipes/wordpress/tests_wordpress/setup_wordpress.py @@ -1,7 +1,7 @@ import pytest from playwright.sync_api import BrowserContext, Page, expect -from src.dir_manager import DirManager +from abratest.dir_manager import DirManager def test_visit_from_domain(authentik_admin_context: BrowserContext, dotenv_config: dict[str, str]): diff --git a/recipes/wordpress/tests_wordpress/test_wordpress_localization.py b/recipes/wordpress/tests_wordpress/test_wordpress_localization.py index 8c9ffa4..1583a9f 100644 --- a/recipes/wordpress/tests_wordpress/test_wordpress_localization.py +++ b/recipes/wordpress/tests_wordpress/test_wordpress_localization.py @@ -2,7 +2,7 @@ from playwright.sync_api import BrowserContext, expect -from src.dir_manager import DirManager +from abratest.dir_manager import DirManager def test_welcome_message(context: BrowserContext, dotenv_config: dict[str, str], DIR: DirManager): diff --git a/tests/test_env_resolution.py b/tests/test_env_resolution.py index 2c1bc97..b6ba802 100644 --- a/tests/test_env_resolution.py +++ b/tests/test_env_resolution.py @@ -2,8 +2,8 @@ from pathlib import Path import pytest -# from src.env_file_helper import DependencyRule, EnvFile, sort_env_files_by_rule -from src.env_manager import DependencyRule, EnvFile, EnvManager +# from abratest.env_file_helper import DependencyRule, EnvFile, sort_env_files_by_rule +from abratest.env_manager import DependencyRule, EnvFile, EnvManager def test_complex_sorting() -> None: diff --git a/tests/test_url.py b/tests/test_url.py index 796c6f0..680023f 100644 --- a/tests/test_url.py +++ b/tests/test_url.py @@ -1,4 +1,4 @@ -from src.utils import BaseUrl +from abratest.utils import BaseUrl url_input = { "netloc": "blog.dev.local-it.cloud", -- 2.47.2 From ed1ac0b088d0be9eec06f3e0a0603cb865f41045 Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 5 Dec 2023 19:18:54 +0100 Subject: [PATCH 38/48] update --- pyproject.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index b86261d..887fa6c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] -name = "locit-testing" -version = "0.1.0" +name = "abratest" +version = "0.2.0" requires-python = "~=3.11" dependencies = [ "pytest == 7.4.3", @@ -12,7 +12,7 @@ dev = [ ] [tool.setuptools] -package-dir = {"" = "src"} +package-dir = {"" = "abratest"} [tool.ruff] line-length = 120 -- 2.47.2 From 0ecc5a0787851cbbfdf8a4d6d88e87aaf3ebf70d Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 5 Dec 2023 19:21:39 +0100 Subject: [PATCH 39/48] update norecursedirs so everything works again --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 887fa6c..b472bc9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -20,4 +20,4 @@ target-version = "py311" [tool.pytest.ini_options] python_functions = "test_* setup_*" -# norecursedirs = "previous-work src" \ No newline at end of file +norecursedirs = "previous-work recipes" \ No newline at end of file -- 2.47.2 From ba060b7b8b7742b2e37d8082ce0f965df7eacc26 Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 5 Dec 2023 19:27:24 +0100 Subject: [PATCH 40/48] update readme --- README.md | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index a046244..54547be 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,11 @@ -# GIT Clone +# AbraTest +...description... + +# Usage + +To use AbraTest, follow these steps: + +## 1. GIT Clone To clone with submodules, use these git commands: @@ -8,7 +15,11 @@ git submodule update --init // add submodule after normal cloning git submodule update --remote // update submodules ``` -# Run without Docker +## Run + +You can run AbraTest with and without Docker. Choose now and follow the steps accordingly: + +## 2.1 Run without Docker ### Installation @@ -22,16 +33,16 @@ playwright install Run the script with ```bash -python main.py +python main.py # run abratest +pytest # test abratest ``` -# Run with Docker +# 2.2 Run with Docker ```bash -docker compose build -docker compose run --rm app python ./main.py -docker compose run --rm app pytest -# docker-compose up +docker compose build # build the image +docker compose run --rm app python ./main.py # run AbraTest +docker compose run --rm app pytest # test AbraTest ``` Force rebuild with cache @@ -46,7 +57,7 @@ Force rebuild wtihtout cache docker-compose build --no-cache ``` -# Codegen +## Codegen Use playwright codegen to create code for new testes easily https://playwright.dev/python/docs/codegen -- 2.47.2 From 3e829366167435f1f2f73beef9c8e1645a6b901a Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 5 Dec 2023 19:32:57 +0100 Subject: [PATCH 41/48] increase timeout --- abratest/plugin-abra.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/abratest/plugin-abra.py b/abratest/plugin-abra.py index 62f5480..d65b445 100644 --- a/abratest/plugin-abra.py +++ b/abratest/plugin-abra.py @@ -19,7 +19,7 @@ from abratest.utils import BaseUrl # global timeout and LOCALE LOCALE = {"Accept-Language": "de_DE"} -TIMEOUT = 15_000 +TIMEOUT = 20_000 expect.set_options(timeout=TIMEOUT) -- 2.47.2 From cf3672ef4b6d938dc59ece481a3f6b135655b7d2 Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 5 Dec 2023 19:34:21 +0100 Subject: [PATCH 42/48] fix setup_nextcloud_admin_session --- recipes/nextcloud/tests_nextcloud/setup_nextcloud.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/nextcloud/tests_nextcloud/setup_nextcloud.py b/recipes/nextcloud/tests_nextcloud/setup_nextcloud.py index 7c041dd..020d56d 100644 --- a/recipes/nextcloud/tests_nextcloud/setup_nextcloud.py +++ b/recipes/nextcloud/tests_nextcloud/setup_nextcloud.py @@ -17,5 +17,5 @@ def setup_nextcloud_admin_session(authentik_admin_page: Page, DIR: DirManager, U context = page_nextcloud.context page_nextcloud.goto(URL.get("/apps/files")) - expect(page_nextcloud.get_by_role("link", name="Name").first).to_be_visible() + expect(page_nextcloud.get_by_role("link", name="Name")).to_be_visible() context.storage_state(path=DIR.STATES / "nextcloud_admin_state.json") -- 2.47.2 From 7ac62a6e80588765143afc8181e9115ee6a7d072 Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 5 Dec 2023 20:39:05 +0100 Subject: [PATCH 43/48] RunnerManager working (dynamic creation of RUNNER_DICT) --- abratest/coordinator.py | 2 ++ abratest/env_manager.py | 2 -- abratest/runner_manager.py | 34 +++++++++++++++++----------------- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/abratest/coordinator.py b/abratest/coordinator.py index 69593ec..9699a09 100644 --- a/abratest/coordinator.py +++ b/abratest/coordinator.py @@ -7,6 +7,7 @@ from abratest.env_manager import EnvFile, EnvManager from abratest.html_helper import merge_html_files from abratest.runner import Runner from abratest.runner_dict import RUNNER_DICT +from abratest.runner_manager import RunnerManager from abratest.utils import rmtree @@ -20,6 +21,7 @@ class Coordinator: self.DIR = DirManager(output_dir=output_dir, session_id=session_id, recipes_dir=recipes_dir) self.ENV = EnvManager(env_paths_list) + runner_manager = RunnerManager(recipes_dir) def setup_test(self) -> None: logger.info("calling setup_test()") diff --git a/abratest/env_manager.py b/abratest/env_manager.py index 9eb2232..31a0634 100644 --- a/abratest/env_manager.py +++ b/abratest/env_manager.py @@ -6,7 +6,6 @@ from dotenv import dotenv_values from abratest.dir_manager import DirManager from abratest.runner_dict import RUNNER_DICT -from abratest.runner_manager import RunnerManager class EnvFile(NamedTuple): @@ -26,7 +25,6 @@ class DependencyRule(NamedTuple): class EnvManager: def __init__(self, env_paths_list: list[Path]): self.env_files: list[EnvFile] = self._get_env_files(env_paths_list) - self.runner_manager = RunnerManager(self.env_files) self.dependency_rules: list[DependencyRule] = self._get_dependency_rules(self.env_files) self.env_files = self.sort_env_files_by_rule(self.env_files, self.dependency_rules) diff --git a/abratest/runner_manager.py b/abratest/runner_manager.py index c6fd6b3..4e87735 100644 --- a/abratest/runner_manager.py +++ b/abratest/runner_manager.py @@ -1,28 +1,28 @@ # should replace static RUNNER_DICT -# WIP import importlib +import re from pathlib import Path -from typing import TYPE_CHECKING from icecream import ic -if TYPE_CHECKING: - from abratest.env_manager import EnvFile, EnvManager +from abratest.runner import Runner + +PATTERN = re.compile("Runner.+") class RunnerManager: - def __init__(self, env_files: list["EnvFile"]): - pass + def __init__(self, recipes_dir: Path): + RUNNER_DICT_NEW = dict() - root = Path("src") - ic(root.resolve()) - for module_path in root.rglob("*/runner*.py"): - module_path = module_path.as_posix().replace("/", ".").replace(".py", "") - ic(module_path) - module = importlib.import_module(module_path) - ic(dir(module)) - # exit() - - -# ic(RUNNER_DICT) + for module_path in recipes_dir.rglob("*/runner*.py"): + rel_path = module_path.relative_to(recipes_dir).as_posix().replace("/", ".").replace(".py", "") + ic(rel_path) + module = importlib.import_module(rel_path) + runner_class_names = [name for name in dir(module) if PATTERN.match(name)] + assert len(runner_class_names) == 1 + runner_class_name = runner_class_names[0] + RunnerClass: type[Runner] = getattr(module, runner_class_name) + RUNNER_DICT_NEW[RunnerClass.name] = RunnerClass + print(RUNNER_DICT_NEW) + exit() -- 2.47.2 From be25b7e849f811174729b6b54ecdfc3ceb6af61c Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 5 Dec 2023 21:04:32 +0100 Subject: [PATCH 44/48] use dynamically created RUNNER_DICT --- abratest/coordinator.py | 37 +++++++++++++++++++++++++++++++------ abratest/env_manager.py | 8 ++++---- abratest/runner_dict.py | 16 ---------------- abratest/runner_manager.py | 28 ---------------------------- 4 files changed, 35 insertions(+), 54 deletions(-) delete mode 100644 abratest/runner_dict.py delete mode 100644 abratest/runner_manager.py diff --git a/abratest/coordinator.py b/abratest/coordinator.py index 9699a09..11e4b7f 100644 --- a/abratest/coordinator.py +++ b/abratest/coordinator.py @@ -1,3 +1,5 @@ +import importlib +import re from pathlib import Path from loguru import logger @@ -6,8 +8,6 @@ from abratest.dir_manager import DirManager from abratest.env_manager import EnvFile, EnvManager from abratest.html_helper import merge_html_files from abratest.runner import Runner -from abratest.runner_dict import RUNNER_DICT -from abratest.runner_manager import RunnerManager from abratest.utils import rmtree @@ -19,9 +19,9 @@ class Coordinator: out_string += f"session_id = {session_id}" logger.info(f"initialize Coordinator instance with\nenv_paths_list =\n{out_string}") + self.RUNNER_DICT = self.create_runner_dict(recipes_dir) self.DIR = DirManager(output_dir=output_dir, session_id=session_id, recipes_dir=recipes_dir) - self.ENV = EnvManager(env_paths_list) - runner_manager = RunnerManager(recipes_dir) + self.ENV = EnvManager(env_paths_list, self.RUNNER_DICT) def setup_test(self) -> None: logger.info("calling setup_test()") @@ -43,10 +43,10 @@ class Coordinator: """Creates an instance of the correct Runner class for each given env file""" runners: list[Runner] = [] for env_file in env_files: - RunnerClass = RUNNER_DICT[env_file.config["TYPE"]] + RunnerClass = self.RUNNER_DICT[env_file.config["TYPE"]] dependency_classes: list[type[Runner]] = [] for dependency in RunnerClass.dependencies: - dependency_classes.append(RUNNER_DICT[dependency]) + dependency_classes.append(self.RUNNER_DICT[dependency]) runner_instance = RunnerClass(dotenv_path=env_file.env_path, DIR=self.DIR) runner_instance._dependency_runners = dependency_classes runners.append(runner_instance) @@ -81,3 +81,28 @@ class Coordinator: new_path = get_new_path(self.DIR.RECORDS, f.parent.name) f.parent.rename(new_path) rmtree(trace_root_dir) + + @staticmethod + def create_runner_dict(recipes_dir: Path) -> dict[str, type["Runner"]]: + """Creates a dictionary holding all the RunnerClasses that can be discovered in recipes_dir + + example: + RUNNER_DICT: dict[str, type["Runner"]] = { + "authentik": RunnerAuthentik, + "wordpress": RunnerWordpress, + "nextcloud": RunnerNextcloud, + } + """ + + RUNNER_DICT: dict[str, type["Runner"]] = dict() + runner_discovery_pattern = re.compile("Runner.+") + + for module_path in recipes_dir.rglob("*/runner*.py"): + rel_path = module_path.relative_to(recipes_dir).as_posix().replace("/", ".").replace(".py", "") + module = importlib.import_module(rel_path) + runner_class_names = [name for name in dir(module) if runner_discovery_pattern.match(name)] + assert len(runner_class_names) == 1 + runner_class_name = runner_class_names[0] + RunnerClass: type[Runner] = getattr(module, runner_class_name) + RUNNER_DICT[RunnerClass.name] = RunnerClass + return RUNNER_DICT diff --git a/abratest/env_manager.py b/abratest/env_manager.py index 31a0634..18086e2 100644 --- a/abratest/env_manager.py +++ b/abratest/env_manager.py @@ -5,7 +5,7 @@ from typing import NamedTuple from dotenv import dotenv_values from abratest.dir_manager import DirManager -from abratest.runner_dict import RUNNER_DICT +from abratest.runner import Runner class EnvFile(NamedTuple): @@ -23,9 +23,9 @@ class DependencyRule(NamedTuple): class EnvManager: - def __init__(self, env_paths_list: list[Path]): + def __init__(self, env_paths_list: list[Path], RUNNER_DICT: dict[str, type["Runner"]]): self.env_files: list[EnvFile] = self._get_env_files(env_paths_list) - self.dependency_rules: list[DependencyRule] = self._get_dependency_rules(self.env_files) + self.dependency_rules: list[DependencyRule] = self._get_dependency_rules(self.env_files, RUNNER_DICT) self.env_files = self.sort_env_files_by_rule(self.env_files, self.dependency_rules) @staticmethod @@ -41,7 +41,7 @@ class EnvManager: return env_files @staticmethod - def _get_dependency_rules(env_files: list[EnvFile]) -> list[DependencyRule]: + def _get_dependency_rules(env_files: list[EnvFile], RUNNER_DICT: dict[str, type["Runner"]]) -> list[DependencyRule]: dependency_rules: list[DependencyRule] = [] for env_file in env_files: child_runner_class = RUNNER_DICT[env_file.env_type] diff --git a/abratest/runner_dict.py b/abratest/runner_dict.py deleted file mode 100644 index e4b694d..0000000 --- a/abratest/runner_dict.py +++ /dev/null @@ -1,16 +0,0 @@ -from typing import TYPE_CHECKING - -from authentik.tests_authentik.runner_authentik import RunnerAuthentik -from nextcloud.tests_nextcloud.runner_nextcloud import RunnerNextcloud -from wordpress.tests_wordpress.runner_wordpress import RunnerWordpress - -if TYPE_CHECKING: - from abratest.runner import Runner - -# Register all runners here. Each .env file with TYPE=authentik will be run with RunnerAuthentik - -RUNNER_DICT: dict[str, type["Runner"]] = { - "authentik": RunnerAuthentik, - "wordpress": RunnerWordpress, - "nextcloud": RunnerNextcloud, -} diff --git a/abratest/runner_manager.py b/abratest/runner_manager.py deleted file mode 100644 index 4e87735..0000000 --- a/abratest/runner_manager.py +++ /dev/null @@ -1,28 +0,0 @@ -# should replace static RUNNER_DICT - -import importlib -import re -from pathlib import Path - -from icecream import ic - -from abratest.runner import Runner - -PATTERN = re.compile("Runner.+") - - -class RunnerManager: - def __init__(self, recipes_dir: Path): - RUNNER_DICT_NEW = dict() - - for module_path in recipes_dir.rglob("*/runner*.py"): - rel_path = module_path.relative_to(recipes_dir).as_posix().replace("/", ".").replace(".py", "") - ic(rel_path) - module = importlib.import_module(rel_path) - runner_class_names = [name for name in dir(module) if PATTERN.match(name)] - assert len(runner_class_names) == 1 - runner_class_name = runner_class_names[0] - RunnerClass: type[Runner] = getattr(module, runner_class_name) - RUNNER_DICT_NEW[RunnerClass.name] = RunnerClass - print(RUNNER_DICT_NEW) - exit() -- 2.47.2 From b0844aba8f3accd42d2229563b56732d589884de Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 5 Dec 2023 21:06:52 +0100 Subject: [PATCH 45/48] fix tests with new RUNNER_DICT --- tests/test_env_resolution.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/tests/test_env_resolution.py b/tests/test_env_resolution.py index b6ba802..87f6f7c 100644 --- a/tests/test_env_resolution.py +++ b/tests/test_env_resolution.py @@ -2,9 +2,12 @@ from pathlib import Path import pytest -# from abratest.env_file_helper import DependencyRule, EnvFile, sort_env_files_by_rule +from abratest.coordinator import Coordinator from abratest.env_manager import DependencyRule, EnvFile, EnvManager +RECIPES_DIR = Path("./recipes").resolve() +RUNNER_DICT = Coordinator.create_runner_dict(RECIPES_DIR) + def test_complex_sorting() -> None: demo_rules = [ # X depends on Y @@ -46,7 +49,7 @@ def test_real_env_files() -> None: Path("envfiles/login.test.dev.local-it.cloud.env"), # authentik ] env_files: list[EnvFile] = EnvManager._get_env_files(ENV_FILES) - dependency_rules: list[DependencyRule] = EnvManager._get_dependency_rules(env_files) + dependency_rules: list[DependencyRule] = EnvManager._get_dependency_rules(env_files, RUNNER_DICT) sorted_env_files = EnvManager.sort_env_files_by_rule(env_files, dependency_rules) assert sorted_env_files[0].env_type == "authentik" @@ -60,7 +63,7 @@ def test_real_env_files_duplicate() -> None: Path("envfiles/login.test.dev.local-it.cloud.env"), # authentik ] env_files: list[EnvFile] = EnvManager._get_env_files(ENV_FILES) - dependency_rules: list[DependencyRule] = EnvManager._get_dependency_rules(env_files) + dependency_rules: list[DependencyRule] = EnvManager._get_dependency_rules(env_files, RUNNER_DICT) sorted_env_files = EnvManager.sort_env_files_by_rule(env_files, dependency_rules) assert sorted_env_files[0].env_type == "authentik" assert sorted_env_files[1].env_type == "authentik" @@ -79,7 +82,7 @@ def test_real_env_files_duplicate_six() -> None: Path("envfiles/blog.test.dev.local-it.cloud.env"), # wordpress ] env_files: list[EnvFile] = EnvManager._get_env_files(ENV_FILES) - dependency_rules: list[DependencyRule] = EnvManager._get_dependency_rules(env_files) + dependency_rules: list[DependencyRule] = EnvManager._get_dependency_rules(env_files, RUNNER_DICT) sorted_env_files = EnvManager.sort_env_files_by_rule(env_files, dependency_rules) assert sorted_env_files[0].env_type == "authentik" assert sorted_env_files[1].env_type == "authentik" @@ -95,7 +98,7 @@ def test_env_manager() -> None: Path("envfiles/login.test.dev.local-it.cloud.env"), # authentik Path("envfiles/login.test.dev.local-it.cloud.env"), # authentik ] - ENV = EnvManager(env_paths_list) + ENV = EnvManager(env_paths_list, RUNNER_DICT) assert ENV.env_files[0].env_type == "authentik" assert ENV.env_files[1].env_type == "authentik" assert ENV.env_files[2].env_type == "wordpress" -- 2.47.2 From 3d17a4ec6393084516158ff9cb27ffe513669a14 Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 5 Dec 2023 21:08:41 +0100 Subject: [PATCH 46/48] disable nextcloud --- main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.py b/main.py index 60321ef..8c2d739 100644 --- a/main.py +++ b/main.py @@ -23,7 +23,7 @@ from abratest.utils import get_session_id ENV_FILES = [ Path("envfiles/login.test.dev.local-it.cloud.env"), # authentik Path("envfiles/blog.test.dev.local-it.cloud.env"), # wordpress - Path("envfiles/files.test.dev.local-it.cloud.env"), # nextcloud + # Path("envfiles/files.test.dev.local-it.cloud.env"), # nextcloud ] -- 2.47.2 From 764ffda1f72092cbe1964d94a39baa361470dec5 Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 5 Dec 2023 21:36:16 +0100 Subject: [PATCH 47/48] remove print --- abratest/plugin-abra.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/abratest/plugin-abra.py b/abratest/plugin-abra.py index d65b445..c72b21b 100644 --- a/abratest/plugin-abra.py +++ b/abratest/plugin-abra.py @@ -23,9 +23,6 @@ TIMEOUT = 20_000 expect.set_options(timeout=TIMEOUT) -print("heeeeeeeeeeeeeeeeeeeloooooooooooooooooooooooo") - - @pytest.fixture def context(context: BrowserContext) -> BrowserContext: context.set_default_timeout(TIMEOUT) -- 2.47.2 From 0ba4d090cba6e4da09cda7fc05b1802961714a01 Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 5 Dec 2023 21:37:12 +0100 Subject: [PATCH 48/48] update ruff version --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index b472bc9..24f1aa4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,7 +8,7 @@ dependencies = [ [project.optional-dependencies] dev = [ - "ruff >= 0.1.3", + "ruff >= 0.1.7", ] [tool.setuptools] -- 2.47.2