new-features (#5)
* refactoring and rework: runner now has setups / tests / cleanups as lists * add nextcloud runner * add email testing prototype with imap fixture * add dependency resolution (sort env files in input so that test order is correct) Reviewed-on: local-it-infrastructure/e2e_tests#5 Co-authored-by: Daniel <d.brummerloh@gmail.com> Co-committed-by: Daniel <d.brummerloh@gmail.com>
This commit is contained in:
parent
2e33f8f014
commit
d3dc0f942a
32 changed files with 573 additions and 247 deletions
|
|
@ -9,15 +9,12 @@ from src.dirmanager import DirManager
|
|||
ADMIN_USER = os.environ["ADMIN_USER"]
|
||||
ADMIN_PASS = os.environ["ADMIN_PASS"]
|
||||
|
||||
LOCALE = {"Accept-Language": "de_DE"}
|
||||
|
||||
TESTUSER = {"username": "testuser", "name": "Test User", "password": "test123", "email": "test@example.com"}
|
||||
TIMEOUT = 6000
|
||||
|
||||
|
||||
def test_create_admin_login(context: BrowserContext, dotenv_config: dict[str, str], DIR: DirManager):
|
||||
def setup_admin_state(context: BrowserContext, dotenv_config: dict[str, str], DIR: DirManager):
|
||||
# go to page
|
||||
context.set_extra_http_headers(LOCALE)
|
||||
context.set_default_timeout(TIMEOUT)
|
||||
page = context.new_page()
|
||||
url = "https://" + dotenv_config["DOMAIN"]
|
||||
page.goto(url)
|
||||
|
|
@ -34,7 +31,7 @@ def test_create_admin_login(context: BrowserContext, dotenv_config: dict[str, st
|
|||
expect(page.locator("ak-library")).to_be_visible()
|
||||
|
||||
# save state
|
||||
context.storage_state(path=f"{DIR.STATES}/admin_state.json")
|
||||
context.storage_state(path=f"{DIR.STATES}/authentik_admin_state.json")
|
||||
|
||||
|
||||
def check_if_user_exists(admin_context: BrowserContext, dotenv_config: dict[str, str]):
|
||||
|
|
@ -102,12 +99,9 @@ def create_user(user_context: BrowserContext, invitelink):
|
|||
expect(page.locator("ak-library")).to_be_visible()
|
||||
|
||||
|
||||
def test_create_user_session(context: BrowserContext, dotenv_config: dict[str, str], DIR: DirManager):
|
||||
context.set_extra_http_headers(LOCALE)
|
||||
context.set_default_timeout(TIMEOUT)
|
||||
|
||||
def setup_user_state(context: BrowserContext, dotenv_config: dict[str, str], DIR: DirManager):
|
||||
# load admin cookies
|
||||
state_file = DIR.STATES / "admin_state.json"
|
||||
state_file = DIR.STATES / "authentik_admin_state.json"
|
||||
storage_state = json.loads(state_file.read_bytes())
|
||||
context.add_cookies(storage_state["cookies"])
|
||||
|
||||
|
|
@ -116,11 +110,10 @@ def test_create_user_session(context: BrowserContext, dotenv_config: dict[str, s
|
|||
pass
|
||||
context.clear_cookies()
|
||||
else:
|
||||
## create user
|
||||
# create invite_link
|
||||
# get invite_link
|
||||
invite_link = create_invite_link(context, dotenv_config)
|
||||
# create user
|
||||
context.clear_cookies()
|
||||
create_user(context, invite_link)
|
||||
|
||||
context.storage_state(path=f"{DIR.STATES}/user_state.json")
|
||||
context.storage_state(path=f"{DIR.STATES}/authentik_user_state.json")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue