0
0
Fork 0
mirror of https://github.com/nextcloud/docker.git synced 2025-03-14 18:35:08 +01:00

Changed to TimeoutError; Updated selector

This commit is contained in:
Arne Tarara 2023-12-30 13:56:33 +01:00
parent e6da52e9c3
commit 7ce555bae0
No known key found for this signature in database
GPG key ID: 2540198A4079785B
4 changed files with 16 additions and 16 deletions

View file

@ -2,7 +2,7 @@ import contextlib
import sys
from time import sleep, time_ns
from playwright.sync_api import Playwright, sync_playwright
from playwright.sync_api import Playwright, sync_playwright, TimeoutError
def log_note(message: str) -> None:
timestamp = str(time_ns())[:16]
@ -34,8 +34,8 @@ def run(playwright: Playwright, browser_name: str) -> None:
page.locator("#view7-input-file").press("Enter")
page.get_by_role("button", name="Create a new file with the selected template").click()
sleep(5)
with contextlib.suppress(Exception):
page.get_by_role("button", name="Close modal").click(timeout=15_000)
with contextlib.suppress(TimeoutError):
page.locator('button.first-run-wizard__close-button').click(timeout=15_000)
page.keyboard.press("Escape")
log_note("Share file with other user")
page.get_by_role("link", name="colab_meeting .md").get_by_role("link", name="Share").click()

View file

@ -2,7 +2,7 @@ import sys
import contextlib
from time import time_ns, sleep
from playwright.sync_api import Playwright, sync_playwright
from playwright.sync_api import Playwright, sync_playwright, TimeoutError
def log_note(message: str) -> None:
timestamp = str(time_ns())[:16]
@ -31,8 +31,8 @@ def create_user(playwright: Playwright, browser_name: str, username: str, passwo
# Sleep to make sure the modal has time to appear before continuing navigation
sleep(5)
with contextlib.suppress(Exception):
page.get_by_role("button", name="Close modal").click(timeout=15_000)
with contextlib.suppress(TimeoutError):
page.locator('button.first-run-wizard__close-button').click(timeout=15_000)
log_note("Create user")
page.get_by_role("link", name="Open settings menu").click()
page.get_by_role("link", name="Users").first.click()

View file

@ -4,7 +4,7 @@ import string
import sys
from time import time_ns, sleep
from playwright.sync_api import Playwright, sync_playwright, expect
from playwright.sync_api import Playwright, sync_playwright, expect, TimeoutError
def get_random_text() -> str:
@ -43,9 +43,9 @@ def collaborate(playwright: Playwright, browser_name: str) -> None:
login(admin_user, "Crash", "Override")
login(docs_user, "docs_dude", "docsrule!12")
log_note("Opening document with both users")
with contextlib.suppress(Exception):
with contextlib.suppress(TimeoutError):
sleep(5)
docs_user.get_by_role("button", name="Close modal").click(timeout=15_000)
docs_user.locator('button.first-run-wizard__close-button').click(timeout=15_000)
admin_user.get_by_role("link", name="Files", exact=True).click()
docs_user.get_by_role("link", name="Files", exact=True).click()
admin_user.get_by_role("link", name="Shares", exact=True).click()

View file

@ -4,7 +4,7 @@ import string
import sys
from time import sleep, time_ns
from playwright.sync_api import Playwright, sync_playwright, expect
from playwright.sync_api import Playwright, sync_playwright, expect, TimeoutError
def log_note(message: str) -> None:
timestamp = str(time_ns())[:16]
@ -43,21 +43,21 @@ def create_conversation(playwright: Playwright, browser_name: str) -> str:
# Wait for the modal to load. As it seems you can't close it while it is showing the opening animation.
log_note("Close first-time run popup")
with contextlib.suppress(Exception):
with contextlib.suppress(TimeoutError):
sleep(5)
page.get_by_role("button", name="Close modal").click(timeout=15_000)
page.locator('button.first-run-wizard__close-button').click(timeout=15_000)
log_note("Open Talk app")
page.locator('#header').get_by_role("link", name="Talk", exact=True).click()
page.wait_for_url("**/apps/spreed/")
# Second welcome screen?
with contextlib.suppress(Exception):
page.get_by_role("button", name="Close modal").click(timeout=15_000)
with contextlib.suppress(TimeoutError):
page.locator('button.first-run-wizard__close-button').click(timeout=15_000)
# Headless browsers trigger a warning in Nextcloud, however they actually work fine
log_note("Close headless warning")
with contextlib.suppress(Exception):
with contextlib.suppress(TimeoutError):
page.wait_for_selector('.toast-close')
page.click('.toast-close')
@ -109,7 +109,7 @@ def talk(playwright: Playwright, url: str, browser_name: str) -> None:
# Close toast messages for headless browsers
log_note("Close headless warning")
with contextlib.suppress(Exception):
with contextlib.suppress(TimeoutError):
for page in pages:
page.wait_for_selector('.toast-close').click()