From ab4b43c93b8876e19b13e7a9c9bce08f96801278 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danilo=20Je=C5=A1i=C4=87?= <34022788+djesic@users.noreply.github.com> Date: Fri, 9 Jun 2023 11:49:51 +0200 Subject: [PATCH] Remove prints, add timeouts --- nextcloud_install_playwright.py | 4 ---- nextcloud_talk_playwright.py | 5 ++++- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/nextcloud_install_playwright.py b/nextcloud_install_playwright.py index 88c0f082..093e2c8d 100644 --- a/nextcloud_install_playwright.py +++ b/nextcloud_install_playwright.py @@ -1,5 +1,4 @@ from playwright.sync_api import sync_playwright -from time import time def main(): with sync_playwright() as playwright: @@ -16,17 +15,14 @@ def main(): page.type('#adminlogin', 'Crash') page.type('#adminpass', 'Override') page.click('.primary') - print(time(), "Create user clicked") # 2. Install all Apps install_selector = '.button-vue--vue-primary' page.wait_for_selector(install_selector) page.click(install_selector) - print(time(), "Install apps clicked") # 3. Dashboard page.wait_for_selector('.app-dashboard') - print(time(), "Dashboard found") browser.close() diff --git a/nextcloud_talk_playwright.py b/nextcloud_talk_playwright.py index 15ce61b5..a33191e3 100644 --- a/nextcloud_talk_playwright.py +++ b/nextcloud_talk_playwright.py @@ -5,7 +5,8 @@ def create_conversation(playwright: Playwright) -> str: browser = playwright.chromium.launch(headless=True) context = browser.new_context() page = context.new_page() - page.goto("http://nc/login") + page.set_default_timeout(120_000) + page.goto("http://nc/") page.get_by_label("Account name or email").click() page.get_by_label("Account name or email").fill("Crash") page.get_by_label("Account name or email").press("Tab") @@ -35,7 +36,9 @@ def talk(playwright: Playwright, url: str) -> None: context_one = browser_one.new_context() context_two = browser_two.new_context() user_one = context_one.new_page() + user_one.set_default_timeout(120_000) user_two = context_two.new_page() + user_two.set_default_timeout(120_000) user_one.goto(url) user_two.goto(url)