functional_tests: Test ejabberd backup and restore

Signed-off-by: James Valleroy's avatarJames Valleroy <jvalleroy@mailbox.org>
parent 84b677f5
Pipeline #19494 passed with stages
in 12 minutes and 37 seconds
......@@ -15,7 +15,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
@apps @ejabberd
@apps @ejabberd @backups
Feature: Ejabberd Chat Server
Run ejabberd chat server.
......@@ -42,3 +42,12 @@ Scenario: Disable message archive management
Given the ejabberd application is enabled
When I disable message archive management
Then the ejabberd service should be running
Scenario: Backup and restore ejabberd
Given the ejabberd application is enabled
And I have added a contact to my roster
When I create a backup of the ejabberd app data
And I delete the contact from my roster
And I export the ejabberd app data backup
And I restore the ejabberd app data backup
Then I should have a contact on my roster
......@@ -214,3 +214,18 @@ def ikiwiki_delete_wiki(browser):
@then('the ikiwiki wiki should be restored')
def ikiwiki_should_exist(browser):
assert application.ikiwiki_wiki_exists(browser)
@given('I have added a contact to my roster')
def ejabberd_add_contact(browser):
application.ejabberd_add_contact(browser)
@when('I delete the contact from my roster')
def ejabberd_delete_contact(browser):
application.ejabberd_delete_contact(browser)
@then('I should have a contact on my roster')
def ejabberd_should_have_contact(browser):
assert application.ejabberd_has_contact(browser)
......@@ -19,7 +19,7 @@ from time import sleep
import splinter
from support import config, interface
from support import config, interface, site
from support.interface import submit
from support.service import eventually, wait_for_page_update
......@@ -269,6 +269,21 @@ def disable_ejabberd_message_archive_management(browser):
checkbox_id='id_MAM_enabled')
def ejabberd_add_contact(browser):
"""Add a contact to Ejabberd user's roster."""
site.jsxc_add_contact(browser)
def ejabberd_delete_contact(browser):
"""Delete the contact from Ejabberd user's roster."""
site.jsxc_delete_contact(browser)
def ejabberd_has_contact(browser):
"""Check whether the contact is in Ejabberd user's roster."""
return site.jsxc_has_contact(browser)
def ikiwiki_create_wiki_if_needed(browser):
"""Create wiki if it does not exist."""
interface.nav_to_module(browser, 'ikiwiki')
......
......@@ -21,7 +21,7 @@ from time import sleep
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.keys import Keys
from support import config, interface
from support import application, config, interface, system
from support.service import eventually, wait_for_page_update
......@@ -172,3 +172,44 @@ def _repro_is_configured(browser):
browser.visit('{}/repro/domains.html'.format(interface.default_url))
remove = browser.find_by_name('remove.freedombox.local')
return bool(remove)
def jsxc_login(browser):
"""Login to JSXC."""
access_url(browser, 'jsxc')
browser.find_by_id('jsxc-username').fill(config['DEFAULT']['username'])
browser.find_by_id('jsxc-password').fill(config['DEFAULT']['password'])
browser.find_by_id('jsxc-submit').click()
relogin = browser.find_by_text('relogin')
if relogin:
relogin.first.click()
browser.find_by_id('jsxc_username').fill(config['DEFAULT']['username'])
browser.find_by_id('jsxc_password').fill(config['DEFAULT']['password'])
browser.find_by_text('Connect').first.click()
def jsxc_add_contact(browser):
"""Add a contact to JSXC user's roster."""
system.set_domain_name(browser, 'localhost')
application.install(browser, 'jsxc')
jsxc_login(browser)
new = browser.find_by_text('new contact')
if new: # roster is empty
new.first.click()
browser.find_by_id('jsxc_username').fill('alice@localhost')
browser.find_by_text('Add').first.click()
def jsxc_delete_contact(browser):
"""Delete the contact from JSXC user's roster."""
jsxc_login(browser)
browser.find_by_css('div.jsxc_more').first.click()
browser.find_by_text('delete contact').first.click()
browser.find_by_text('Remove').first.click()
def jsxc_has_contact(browser):
"""Check whether the contact is in JSXC user's roster."""
jsxc_login(browser)
contact = browser.find_by_text('alice@localhost')
return bool(contact)
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