Easier setup by executing main from root working directory
This commit is contained in:
parent
a4bdb2e868
commit
2cb4a9d526
9 changed files with 23 additions and 21 deletions
6
main.py
Normal file
6
main.py
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
from src.wrapper import ENV_FILES, Wrapper
|
||||
|
||||
session_id = Wrapper.get_session_id()
|
||||
wrapper = Wrapper(ENV_FILES, session_id=session_id)
|
||||
wrapper.setup_test()
|
||||
wrapper.run_test()
|
||||
|
|
@ -8,11 +8,12 @@
|
|||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
from dirmanager import DirManager
|
||||
from dotenv import dotenv_values
|
||||
from icecream import ic
|
||||
from playwright.sync_api import BrowserContext
|
||||
|
||||
from src.dirmanager import DirManager
|
||||
|
||||
pytest_plugins = [
|
||||
# "setup.setup_authentik",
|
||||
"tests_authentik.authentik_plugin"
|
||||
|
|
|
|||
|
|
@ -2,10 +2,11 @@ from pathlib import Path
|
|||
from typing import Callable, Optional, TypedDict
|
||||
|
||||
import pytest
|
||||
from dirmanager import DirManager
|
||||
from dotenv import dotenv_values
|
||||
from icecream import ic
|
||||
|
||||
from src.dirmanager import DirManager
|
||||
|
||||
|
||||
class SubTest(TypedDict):
|
||||
condition: Callable[[Path], bool]
|
||||
|
|
@ -13,7 +14,7 @@ class SubTest(TypedDict):
|
|||
|
||||
|
||||
class Runner:
|
||||
test_dir_name: Optional[Path] = None
|
||||
test_dir_name: Optional[str] = None
|
||||
main_test_name: Optional[str] = None
|
||||
sub_tests: list[SubTest] = []
|
||||
dependencies: list[str] = []
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import pytest
|
|||
from icecream import ic
|
||||
from playwright.sync_api import Browser, Locator, expect
|
||||
|
||||
cred_file = Path("../credentials.json")
|
||||
cred_file = Path("credentials.json")
|
||||
with open(cred_file, "r") as f:
|
||||
CREDENTIALS = json.load(f)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
from pathlib import Path
|
||||
|
||||
from runner import Runner, SubTest
|
||||
from tests_authentik.setup_authentik import setup_authentik
|
||||
from src.runner import Runner, SubTest
|
||||
from src.tests_authentik.setup_authentik import setup_authentik
|
||||
|
||||
|
||||
def condition_always_true(dotenv_path: Path) -> bool:
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ from pathlib import Path
|
|||
from icecream import ic
|
||||
from playwright.sync_api import Browser, BrowserContext, Locator, Page, expect, sync_playwright
|
||||
|
||||
cred_file = Path("../credentials.json")
|
||||
cred_file = Path("credentials.json")
|
||||
with open(cred_file, "r") as f:
|
||||
CREDENTIALS = json.load(f)
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ from playwright.sync_api import Browser, Locator, expect, sync_playwright
|
|||
# browser = playwright.chromium.launch(headless=False)
|
||||
|
||||
|
||||
cred_file = Path("../credentials.json")
|
||||
cred_file = Path("credentials.json")
|
||||
with open(cred_file, "r") as f:
|
||||
CREDENTIALS = json.load(f)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
from pathlib import Path
|
||||
|
||||
from runner import Runner, SubTest
|
||||
from src.runner import Runner, SubTest
|
||||
|
||||
|
||||
def condition_always_true(dotenv_path: Path) -> bool:
|
||||
|
|
|
|||
|
|
@ -2,17 +2,18 @@ from datetime import datetime
|
|||
from pathlib import Path
|
||||
from typing import Protocol
|
||||
|
||||
from dirmanager import DirManager
|
||||
from dotenv import dotenv_values
|
||||
from icecream import ic
|
||||
from tests_authentik.runner_authentik import RunnerAuthentik
|
||||
from tests_wordpress.runner_wordpress import RunnerWordpress
|
||||
|
||||
from src.dirmanager import DirManager
|
||||
from src.tests_authentik.runner_authentik import RunnerAuthentik
|
||||
from src.tests_wordpress.runner_wordpress import RunnerWordpress
|
||||
|
||||
TESTS_DIR = Path("../tests")
|
||||
|
||||
ENV_FILES = [
|
||||
Path("../envfiles/login.test.dev.local-it.cloud.env"), # authentik
|
||||
# Path("../envfiles/blog.test.dev.local-it.cloud.env"), # wordpress
|
||||
Path("envfiles/login.test.dev.local-it.cloud.env"), # authentik
|
||||
# Path("envfiles/blog.test.dev.local-it.cloud.env"), # wordpress
|
||||
]
|
||||
|
||||
|
||||
|
|
@ -69,10 +70,3 @@ class Wrapper:
|
|||
def get_session_id() -> str:
|
||||
current_datetime = datetime.now()
|
||||
return current_datetime.strftime("%Y-%m-%d-%H-%M-%S")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
session_id = Wrapper.get_session_id()
|
||||
wrapper = Wrapper(ENV_FILES, session_id=session_id)
|
||||
wrapper.setup_test()
|
||||
wrapper.run_test()
|
||||
Loading…
Add table
Add a link
Reference in a new issue