coquelicot: Implement functional tests with uploading file

Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Joseph Nuthalapati authored and James Valleroy committed 2018-10-03 19:19:11 -04:00
1 parent 95664015ac
commit c83a3cd22e
5 files changed
+85 -4

No files matched your search

+12 -3
View File
@@ -24,7 +24,6 @@ from selenium.webdriver.common.keys import Keys
from support import application, config, interface, system
from support.service import eventually, wait_for_page_update
# unlisted sites just use '/' + site_name as url
site_url = {
'wiki': '/ikiwiki',
@@ -63,6 +62,17 @@ def verify_coquelicot_upload_password(browser, password):
args=['div[style*="display: none;"]'])
def upload_file_to_coquelicot(browser, file_path, password):
"""Upload a local file from disk to coquelicot."""
verify_coquelicot_upload_password(browser, password)
browser.attach_file('file', file_path)
interface.submit(browser)
assert eventually(browser.is_element_present_by_css,
args=['#content .url'])
url_textarea = browser.find_by_css('#content .url textarea').first
return url_textarea.value
def verify_mediawiki_create_account_link(browser):
browser.visit(config['DEFAULT']['url'] + '/mediawiki')
assert eventually(browser.is_element_present_by_id,
@@ -111,8 +121,7 @@ def upload_image_mediawiki(browser, username, password, image):
# Upload file
browser.visit(config['DEFAULT']['url'] + '/mediawiki/Special:Upload')
file_path = os.path.realpath(
'../static/themes/default/img/' + image)
file_path = os.path.realpath('../static/themes/default/img/' + image)
browser.attach_file('wpUploadFile', file_path)
interface.submit(browser, element=browser.find_by_name('wpUpload')[0])