* 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>
35 lines
1.3 KiB
Python
35 lines
1.3 KiB
Python
import pytest
|
|
|
|
|
|
@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()
|