Commit ed55f62a authored by James Valleroy's avatar James Valleroy

functional_tests: Test mediawiki backup and restore

Signed-off-by: James Valleroy's avatarJames Valleroy <>
parent e1cda649
......@@ -15,7 +15,7 @@
# along with this program. If not, see <>.
@apps @mediawiki
@apps @mediawiki @backups
Feature: MediaWiki Wiki Engine
Manage wikis, multimedia and more.
......@@ -82,3 +82,11 @@ 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
Scenario: Backup and restore mediawiki
Given the mediawiki application is enabled
When I create a backup of the mediawiki app data
And I delete the mediawiki main page
And I export the mediawiki app data backup
And I restore the mediawiki app data backup
Then the mediawiki main page should be restored
......@@ -15,7 +15,7 @@
# along with this program. If not, see <>.
from pytest_bdd import parsers, then, when
from pytest_bdd import given, parsers, then, when
from support import site
......@@ -86,3 +86,13 @@ def mediawiki_does_not_allow__account_creation_anonymous_reads_edits(browser):
'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)
@when('I delete the mediawiki main page')
def mediawiki_delete_main_page(browser):
@then('the mediawiki main page should be restored')
def mediawiki_verify_text(browser):
assert site.mediawiki_has_main_page(browser)
......@@ -24,6 +24,7 @@ from selenium.webdriver.common.keys import Keys
from support import config, interface
from support.service import eventually, wait_for_page_update
# unlisted sites just use '/' + site_name as url
site_url = {
'wiki': '/ikiwiki',
......@@ -123,3 +124,20 @@ 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
def mediawiki_delete_main_page(browser):
"""Delete the mediawiki main page."""
_login_to_mediawiki(browser, 'admin', 'whatever123')
with wait_for_page_update(browser):
def mediawiki_has_main_page(browser):
"""Check if mediawiki main page exists."""
content = browser.find_by_id('mw-content-text').first
return 'This page has been deleted.' not in content.text
......@@ -17,7 +17,7 @@
from support import config
from .interface import nav_to_module, submit
from .interface import default_url, nav_to_module, submit
config_page_title_language_map = {
'da': 'Generel Konfiguration',
......@@ -150,6 +150,7 @@ def dynamicdns_change_config(browser):
def backup_create(browser, app_name):
nav_to_module(browser, 'backups')
delete = browser.find_link_by_href(
'/plinth/sys/backups/delete/_functional_test_' + app_name + '/')
......@@ -163,6 +164,7 @@ def backup_create(browser, app_name):
def backup_export(browser, app_name):
nav_to_module(browser, 'backups')
......@@ -172,6 +174,7 @@ def backup_export(browser, app_name):
def backup_restore(browser, app_name):
nav_to_module(browser, 'backups')
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment