mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-07-08 11:40:25 +00:00
mediawiki: Enable SVG support for MediaWiki
- Changed configuration file FreedomBoxSettings.php to enable SVG extension. - Added functional test for upload and viewing of svg file. - Modified the existing functional test with image file name as parameter. Closes #1354 Signed-off-by: Vignan Lavu <vignan.lavu@gmail.com> Reviewed-by: Joseph Nuthalapati <njoseph@thoughtworks.com> Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
This commit is contained in:
parent
aa90564c96
commit
537e2c7de8
@ -19,3 +19,8 @@ $wgUsePathInfo = true;
|
||||
|
||||
# Instant Commons
|
||||
$wgUseInstantCommons = true;
|
||||
|
||||
# SVG Enablement
|
||||
$wgFileExtensions[] = 'svg';
|
||||
$wgAllowTitlesInSVG = true;
|
||||
$wgSVGConverter = 'ImageMagick';
|
||||
|
||||
@ -75,5 +75,10 @@ Scenario: Logged in user can see upload files option
|
||||
|
||||
Scenario: Upload images
|
||||
Given the mediawiki application is enabled
|
||||
When I upload an image to mediawiki with credentials admin and whatever123
|
||||
Then there should be 1 uploaded images
|
||||
When I upload an image named FreedomBox-logo-lineart.png to mediawiki with credentials admin and whatever123
|
||||
Then there should be FreedomBox-logo-lineart.png image
|
||||
|
||||
Scenario: Upload SVG image
|
||||
Given the mediawiki application is enabled
|
||||
When I upload an image named FreedomBox-logo-grayscale.svg to mediawiki with credentials admin and whatever123
|
||||
Then there should be FreedomBox-logo-grayscale.svg image
|
||||
|
||||
@ -37,16 +37,16 @@ def access_application(browser, app_name):
|
||||
|
||||
@when(
|
||||
parsers.parse(
|
||||
'I upload an image to mediawiki with credentials {username:w} and {password:w}'
|
||||
))
|
||||
def upload_image(browser, username, password):
|
||||
site.upload_image_mediawiki(browser, username, password)
|
||||
'I upload an image named {image:S} to mediawiki with credentials {username:w} and '
|
||||
'{password:w}'))
|
||||
def upload_image(browser, username, password, image):
|
||||
site.upload_image_mediawiki(browser, username, password, image)
|
||||
|
||||
|
||||
@then(parsers.parse('there should be {count:d} uploaded images'))
|
||||
def uploaded_image_should_be_available(browser, count):
|
||||
num_images = site.get_number_of_uploaded_images_in_mediawiki(browser)
|
||||
assert count == num_images
|
||||
@then(parsers.parse('there should be {image:S} image'))
|
||||
def uploaded_image_should_be_available(browser, image):
|
||||
uploaded_image = site.get_uploaded_image_in_mediawiki(browser, image)
|
||||
assert image.lower() == uploaded_image.lower()
|
||||
|
||||
|
||||
@then(
|
||||
@ -82,7 +82,7 @@ def mediawiki_does_not_allow__account_creation_anonymous_reads_edits(browser):
|
||||
|
||||
@then(
|
||||
parsers.parse(
|
||||
'I should see the Upload File option in the side pane when logged in with credentials {username:w} and {password:w}'
|
||||
))
|
||||
'I should see the Upload File option in the side pane when logged in '
|
||||
'with credentials {username:w} and {password:w}'))
|
||||
def login_to_mediawiki_with_credentials(browser, username, password):
|
||||
site.login_to_mediawiki_with_credentials(browser, username, password)
|
||||
|
||||
@ -101,7 +101,7 @@ def login_to_mediawiki_with_credentials(browser, username, password):
|
||||
assert eventually(browser.is_element_present_by_id, args=['t-upload'])
|
||||
|
||||
|
||||
def upload_image_mediawiki(browser, username, password):
|
||||
def upload_image_mediawiki(browser, username, password, image):
|
||||
"""Upload an image to MediaWiki. Idempotent."""
|
||||
browser.visit(config['DEFAULT']['url'] + '/mediawiki')
|
||||
_login_to_mediawiki(browser, username, password)
|
||||
@ -109,7 +109,7 @@ def upload_image_mediawiki(browser, username, password):
|
||||
# Upload file
|
||||
browser.visit(config['DEFAULT']['url'] + '/mediawiki/Special:Upload')
|
||||
file_path = os.path.realpath(
|
||||
'../static/themes/default/img/freedombox-logo-32px.png')
|
||||
'../static/themes/default/img/' + image)
|
||||
browser.attach_file('wpUploadFile', file_path)
|
||||
interface.submit(browser, element=browser.find_by_name('wpUpload')[0])
|
||||
|
||||
@ -117,3 +117,9 @@ def upload_image_mediawiki(browser, username, password):
|
||||
def get_number_of_uploaded_images_in_mediawiki(browser):
|
||||
browser.visit(config['DEFAULT']['url'] + '/mediawiki/Special:ListFiles')
|
||||
return len(browser.find_by_css('.TablePager_col_img_timestamp'))
|
||||
|
||||
|
||||
def get_uploaded_image_in_mediawiki(browser, image):
|
||||
browser.visit(config['DEFAULT']['url'] + '/mediawiki/Special:ListFiles')
|
||||
elements = browser.find_link_by_partial_href(image)
|
||||
return elements[0].value
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user