From 910b9fcf3497a34ef7f5aeade424c276714ac623 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20Kn=C3=B6ppler?= <6317548+theCalcaholic@users.noreply.github.com> Date: Sun, 25 Feb 2024 13:38:57 +0100 Subject: [PATCH] Fix nextcloud_tests for NC 28 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Tobias Knöppler <6317548+theCalcaholic@users.noreply.github.com> --- tests/nextcloud_tests.py | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/tests/nextcloud_tests.py b/tests/nextcloud_tests.py index 487aae31..42b80d5a 100755 --- a/tests/nextcloud_tests.py +++ b/tests/nextcloud_tests.py @@ -121,6 +121,25 @@ def is_admin_notifications_checkbox(item: WebElement): return False +def close_first_run_wizard(driver: WebDriver): + wait = WebDriverWait(driver, 60) + first_run_wizard = None + try: + first_run_wizard = driver.find_element(By.CSS_SELECTOR, "#firstrunwizard") + except NoSuchElementException: + pass + if first_run_wizard is not None and first_run_wizard.is_displayed(): + wait.until(VisibilityOfElementLocatedByAnyLocator([(By.CLASS_NAME, "modal-container__close"), + (By.CLASS_NAME, "first-run-wizard__close-button")])) + try: + overlay_close_btn = driver.find_element(By.CLASS_NAME, "first-run-wizard__close-button") + overlay_close_btn.click() + except NoSuchElementException: + overlay_close_btn = driver.find_element(By.CLASS_NAME, "modal-container__close") + overlay_close_btn.click() + time.sleep(3) + + def test_nextcloud(IP: str, nc_port: str, driver: WebDriver): """ Login and assert admin page checks""" test = Test() @@ -198,13 +217,7 @@ def test_nextcloud(IP: str, nc_port: str, driver: WebDriver): except Exception as e: test.check(e) - try: - overlay_close_btn = driver.find_element(By.CLASS_NAME, "modal-container__close") - if overlay_close_btn.is_displayed(): - overlay_close_btn.click() - time.sleep(3) - except NoSuchElementException: - pass + close_first_run_wizard(driver) test.new("admin section (1)") try: