0
0
Fork 0
mirror of https://github.com/nextcloud/docker.git synced 2025-03-20 13:25:09 +01:00
nextcloud-docker/nextcloud_create_user_playwright.py

32 lines
1.2 KiB
Python
Raw Normal View History

2023-06-08 13:52:29 +02:00
from playwright.sync_api import Playwright, sync_playwright
def run(playwright: Playwright) -> None:
browser = playwright.chromium.launch(headless=False)
context = browser.new_context()
page = context.new_page()
page.goto("http://localhost:8080/login")
page.get_by_label("Account name or email").click()
page.get_by_label("Account name or email").fill("Crash")
page.get_by_label("Password", exact=True).click()
page.get_by_label("Password", exact=True).fill("Override")
page.get_by_role("button", name="Log in").click()
page.get_by_role("link", name="Open settings menu").click()
page.get_by_role("link", name="Users").click()
page.get_by_role("button", name="New user").click()
page.get_by_placeholder("Username").click()
page.get_by_placeholder("Username").fill("Splash")
page.get_by_placeholder("Display name").click()
page.get_by_placeholder("Display name").fill("Splash")
page.get_by_placeholder("Password", exact=True).click()
page.get_by_placeholder("Password", exact=True).fill("cymbals3533")
page.get_by_role("button", name="Add a new user").click()
# ---------------------
context.close()
browser.close()
with sync_playwright() as playwright:
run(playwright)