Functional tests: check that browser waits for redirects to finish

Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Michael Pimmer 2018-10-29 14:43:01 +01:00 committed by James Valleroy
parent 56ee33793e
commit 33dde221d1
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808
3 changed files with 54 additions and 0 deletions

View File

@ -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 <http://www.gnu.org/licenses/>.
#
@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

View File

@ -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/'))

View File

@ -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()