e2e_tests/recipes/nextcloud/tests_nextcloud/setup_nextcloud.py
Daniel 8685688698 installable package (#9)
* turn repo into installable package (pip install -e .)

* add hatchling build packend

* call it pytest-abra

* add pytest entrypoint, so that it gets loaded automatically if installed (and pytest is run)

* make fixtures optional, so that pytest can still be used in other context

* add cli script -> you can now directly run "pytest-abra" in console

Reviewed-on: local-it-infrastructure/e2e_tests#9
Co-authored-by: Daniel <d.brummerloh@gmail.com>
Co-committed-by: Daniel <d.brummerloh@gmail.com>
2023-12-07 11:32:01 +01:00

21 lines
873 B
Python

from playwright.sync_api import Page, expect
from pytest_abra.dir_manager import DirManager
from pytest_abra.utils import BaseUrl
# url dashboard
# https://files.test.dev.local-it.cloud/apps/dashboard/
# url files
# https://files.test.dev.local-it.cloud/apps/files/
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
page_nextcloud.goto(URL.get("/apps/files"))
expect(page_nextcloud.get_by_role("link", name="Name")).to_be_visible()
context.storage_state(path=DIR.STATES / "nextcloud_admin_state.json")