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:
parent
1722e9df5c
commit
b966eb09c2
7 changed files with 88 additions and 144 deletions
30
energy-tests/helpers/helper_functions.py
Normal file
30
energy-tests/helpers/helper_functions.py
Normal 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")
|
Loading…
Add table
Add a link
Reference in a new issue