mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-09-19 04:59:01 +00:00
nextcloud: test: Fix functional tests with version 26
- Some changes in the 'New' menu and a new introduction animation broke the functional tests. Fix this by updating the way elements are searched for in the interface. Tests: - Functional tests for Nextcloud pass. Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
parent
cb54e79d30
commit
8f463c77ea
@ -5,7 +5,6 @@ import time
|
|||||||
import urllib
|
import urllib
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from selenium.webdriver.common.keys import Keys
|
|
||||||
|
|
||||||
from freedombox.tests import functional
|
from freedombox.tests import functional
|
||||||
|
|
||||||
@ -69,9 +68,16 @@ def _visit_files_app(browser):
|
|||||||
"""Login to Nextcloud and visit the files app."""
|
"""Login to Nextcloud and visit the files app."""
|
||||||
_login(browser)
|
_login(browser)
|
||||||
functional.visit(browser, '/nextcloud/apps/files/files')
|
functional.visit(browser, '/nextcloud/apps/files/files')
|
||||||
# Close the welcome model dialog if it is present
|
|
||||||
browser.find_by_tag('html').first.type(Keys.ESCAPE)
|
time.sleep(3) # Wait for the interface to show the first run wizard
|
||||||
time.sleep(1) # Allow the model dialog to close.
|
|
||||||
|
first_run_wizard = browser.find_by_css('.first-run-wizard')
|
||||||
|
if first_run_wizard:
|
||||||
|
selector = '.first-run-wizard button[aria-label="Close"]'
|
||||||
|
functional.eventually(browser.find_by_css, [selector])
|
||||||
|
button = browser.find_by_css(selector)
|
||||||
|
if button:
|
||||||
|
button.click()
|
||||||
|
|
||||||
|
|
||||||
def _remove_folder(browser, folder_name):
|
def _remove_folder(browser, folder_name):
|
||||||
@ -118,12 +124,12 @@ def _create_folder(browser, folder_name):
|
|||||||
|
|
||||||
# Click on the 'New folder' pop down menu item
|
# Click on the 'New folder' pop down menu item
|
||||||
xpath = f'//button[{_class("action-button")} and ' \
|
xpath = f'//button[{_class("action-button")} and ' \
|
||||||
'./span[text()="New folder"]]'
|
'.//span[normalize-space(.)="New folder"]]'
|
||||||
browser.find_by_xpath(xpath).first.click()
|
browser.find_by_xpath(xpath).first.click()
|
||||||
|
|
||||||
# Get the 'Create new folder' dialog box
|
# Get the 'Create new folder' dialog box
|
||||||
xpath = f'//div[{_class("dialog__modal")} and ' \
|
xpath = f'//div[{_class("dialog__modal")} and ' \
|
||||||
'.//h2[text()="Create new folder"]]'
|
'.//h2[normalize-space(.)="Create new folder"]]'
|
||||||
dialog = browser.find_by_xpath(xpath).first
|
dialog = browser.find_by_xpath(xpath).first
|
||||||
|
|
||||||
# Enter the folder name into text box 'Folder name'
|
# Enter the folder name into text box 'Folder name'
|
||||||
@ -131,5 +137,5 @@ def _create_folder(browser, folder_name):
|
|||||||
dialog.find_by_xpath(xpath).first.fill(folder_name)
|
dialog.find_by_xpath(xpath).first.fill(folder_name)
|
||||||
|
|
||||||
# Press the 'Create' button
|
# Press the 'Create' button
|
||||||
xpath = './/button[.//*[contains(text(),"Create")]]'
|
xpath = './/button[.//*[normalize-space(.)="Create"]]'
|
||||||
dialog.find_by_xpath(xpath).first.click()
|
dialog.find_by_xpath(xpath).first.click()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user