diff --git a/functional_tests/features/backups.feature b/functional_tests/features/backups.feature new file mode 100644 index 000000000..182e48f74 --- /dev/null +++ b/functional_tests/features/backups.feature @@ -0,0 +1,32 @@ +# +# This file is part of FreedomBox. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# + +@backups @bind +Feature: Backups module + Create and restore backups. + +Background: + Given I'm a logged in user + Given the bind application is installed + +Scenario: Browser waits for redirect after restoring a backup + Given the bind application is enabled + When I create a backup of the bind app data + And I restore the bind app data backup + And I open the main page + And I wait for 5 seconds + Then the main page should be shown diff --git a/functional_tests/step_definitions/system.py b/functional_tests/step_definitions/system.py index 8ca275a9e..6c3b00171 100644 --- a/functional_tests/step_definitions/system.py +++ b/functional_tests/step_definitions/system.py @@ -16,6 +16,7 @@ # import os +import time from pytest import fixture from pytest_bdd import given, parsers, then, when @@ -345,3 +346,19 @@ def monkeysphere_assert_imported_key(browser, key_type, domain): '{domain:S} in monkeysphere')) def monkeysphere_publish_key(browser, key_type, domain): system.monkeysphere_publish_key(browser, key_type.lower(), domain) + + +@when(parsers.parse('I wait for {seconds} seconds')) +def sleep_for(seconds): + seconds = int(seconds) + time.sleep(seconds) + + +@when(parsers.parse('I open the main page')) +def open_main_page(browser): + system.open_main_page(browser) + + +@then(parsers.parse('the main page should be shown')) +def main_page_is_shown(browser): + assert(browser.url.endswith('/plinth/')) diff --git a/functional_tests/support/system.py b/functional_tests/support/system.py index f15f11879..0f1e35c0b 100644 --- a/functional_tests/support/system.py +++ b/functional_tests/support/system.py @@ -394,3 +394,8 @@ def monkeysphere_publish_key(browser, key_type, domain): key.find_by_css('.button-publish').click() application.wait_for_config_update(browser, 'monkeysphere') + + +def open_main_page(browser): + with wait_for_page_update(browser): + browser.find_link_by_href('/plinth/').first.click()