Joseph Nuthalapati 0bdc2802f2
functional-tests: Merge plinth-tester into plinth
- Rename Plinth-tester to FreedomBox
- Add pytest.ini to discover the root directory for tests easily
- Update README to say that py.test should be run from functional_tests
  directory.
- Add geckodriver.log to .gitignore

Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2018-02-28 19:00:42 +01:00

89 lines
2.7 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#
# This file is part of Plinth-tester.
#
# 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/>.
#
from support import config
from .interface import nav_to_module, submit
config_page_title_language_map = {
'da': 'Generel Konfiguration',
'de': 'Allgemeine Konfiguration',
'es': 'Configuración general',
'fr': 'Configuration générale',
'nb': 'Generelt oppsett',
'nl': 'Algemene Instellingen',
'pl': 'Ustawienia główne',
'pt': 'Configuração Geral',
'ru': 'Общие настройки',
'sv': 'Allmän Konfiguration',
'te': 'సాధారణ ఆకృతీకరణ',
'tr': 'Genel Yapılandırma',
'zh-hans': '常规配置',
}
def get_hostname(browser):
nav_to_module(browser, 'config')
return browser.find_by_id('id_configuration-hostname').value
def set_hostname(browser, hostname):
nav_to_module(browser, 'config')
browser.find_by_id('id_configuration-hostname').fill(hostname)
submit(browser)
def get_domain_name(browser):
nav_to_module(browser, 'config')
return browser.find_by_id('id_configuration-domainname').value
def set_domain_name(browser, domain_name):
nav_to_module(browser, 'config')
browser.find_by_id('id_configuration-domainname').fill(domain_name)
submit(browser)
def set_language(browser, language_code):
nav_to_module(browser, 'config')
browser.find_by_xpath(
'//select[@id="id_configuration-language"]//option[@value="' \
+ language_code + '"]'
).first.click()
submit(browser)
def check_language(browser, language_code):
nav_to_module(browser, 'config')
return browser.title == config_page_title_language_map[language_code]
def delete_all_snapshots(browser):
browser.visit(config['DEFAULT']['url'] + '/plinth/sys/snapshot/all/delete')
browser.find_by_value('Delete Snapshots').click()
def create_snapshot(browser):
nav_to_module(browser, 'snapshot')
browser.find_by_value('Create Snapshot').click()
def get_snapshot_count(browser):
nav_to_module(browser, 'snapshot')
# Subtract 1 for table header
return len(browser.find_by_xpath('//tr')) - 1