0
0
Fork 0
mirror of https://github.com/nextcloud/docker.git synced 2025-06-16 08:14:46 +02:00

Refactoring and changes for Nextcloud 30

This commit is contained in:
Arne Tarara 2024-10-15 14:51:56 +02:00
parent 1722e9df5c
commit b966eb09c2
No known key found for this signature in database
GPG key ID: 2540198A4079785B
7 changed files with 88 additions and 144 deletions

View file

@ -0,0 +1,30 @@
import random
from time import time_ns, sleep
from playwright.sync_api import TimeoutError
def login(page, username='Crash', password='Override'):
page.goto("http://nc/login")
page.locator('#user').fill(username)
page.locator('#password').fill(password)
page.locator('#password').press("Enter")
def get_random_text() -> str:
size_in_bytes = 1024
characters = string.ascii_letters + string.digits
return ''.join(random.choice(characters) for _ in range(size_in_bytes))
def log_note(message: str) -> None:
timestamp = str(time_ns())[:16]
print(f"{timestamp} {message}")
def close_modal(page) -> None:
with contextlib.suppress(TimeoutError):
sleep(5) # Sleep to make sure the modal has time to appear before continuing navigation
page.locator('#firstrunwizard .modal-container__content button[aria-label=Close]', timeout=15_000).click()
def timeout_handler(signum, frame):
raise TimeoutError("Page.content() timed out")