mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-08-26 12:46:08 +00:00
tests: functional: Use newer splinter API for finding links
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: Veiko Aasa <veiko17@disroot.org>
This commit is contained in:
parent
2abe7315f9
commit
ffe34d013a
@ -270,7 +270,7 @@ def login_with_account(browser, url, username, password=None):
|
|||||||
|
|
||||||
visit(browser, '/plinth/accounts/logout/')
|
visit(browser, '/plinth/accounts/logout/')
|
||||||
|
|
||||||
login_button = browser.find_link_by_href('/plinth/accounts/login/')
|
login_button = browser.links.find_by_href('/plinth/accounts/login/')
|
||||||
if login_button:
|
if login_button:
|
||||||
login_button.first.click()
|
login_button.first.click()
|
||||||
if login_button:
|
if login_button:
|
||||||
@ -415,7 +415,7 @@ def set_domain_name(browser, domain_name):
|
|||||||
########################
|
########################
|
||||||
def find_on_front_page(browser, app_name):
|
def find_on_front_page(browser, app_name):
|
||||||
browser.visit(base_url)
|
browser.visit(base_url)
|
||||||
shortcuts = browser.find_link_by_href(f'/{app_name}/')
|
shortcuts = browser.links.find_by_href(f'/{app_name}/')
|
||||||
return shortcuts
|
return shortcuts
|
||||||
|
|
||||||
|
|
||||||
@ -457,7 +457,7 @@ def set_advanced_mode(browser, mode):
|
|||||||
# Backup utilities #
|
# Backup utilities #
|
||||||
####################
|
####################
|
||||||
def _click_button_and_confirm(browser, href):
|
def _click_button_and_confirm(browser, href):
|
||||||
buttons = browser.find_link_by_href(href)
|
buttons = browser.links.find_by_href(href)
|
||||||
if buttons:
|
if buttons:
|
||||||
submit(browser, buttons.first)
|
submit(browser, buttons.first)
|
||||||
submit(browser, expected_url='/plinth/sys/backups/')
|
submit(browser, expected_url='/plinth/sys/backups/')
|
||||||
@ -474,7 +474,7 @@ def backup_create(browser, app_name, archive_name=None):
|
|||||||
if archive_name:
|
if archive_name:
|
||||||
_backup_delete_archive_by_name(browser, archive_name)
|
_backup_delete_archive_by_name(browser, archive_name)
|
||||||
|
|
||||||
buttons = browser.find_link_by_href('/plinth/sys/backups/create/')
|
buttons = browser.links.find_by_href('/plinth/sys/backups/create/')
|
||||||
submit(browser, buttons.first)
|
submit(browser, buttons.first)
|
||||||
eventually(browser.find_by_css, args=['.select-all'])
|
eventually(browser.find_by_css, args=['.select-all'])
|
||||||
browser.find_by_css('.select-all').first.uncheck()
|
browser.find_by_css('.select-all').first.uncheck()
|
||||||
@ -505,7 +505,7 @@ def networks_set_firewall_zone(browser, zone):
|
|||||||
network_id = device['href'].split('/')[-3]
|
network_id = device['href'].split('/')[-3]
|
||||||
device.click()
|
device.click()
|
||||||
edit_url = "/plinth/sys/networks/{}/edit/".format(network_id)
|
edit_url = "/plinth/sys/networks/{}/edit/".format(network_id)
|
||||||
browser.find_link_by_href(edit_url).first.click()
|
browser.links.find_by_href(edit_url).first.click()
|
||||||
browser.select('zone', zone)
|
browser.select('zone', zone)
|
||||||
browser.find_by_tag("form").first.find_by_tag('input')[-1].click()
|
browser.find_by_tag("form").first.find_by_tag('input')[-1].click()
|
||||||
|
|
||||||
@ -539,7 +539,7 @@ def create_user(browser, name, password=None, groups=[]):
|
|||||||
password = get_password(name)
|
password = get_password(name)
|
||||||
|
|
||||||
with wait_for_page_update(browser):
|
with wait_for_page_update(browser):
|
||||||
browser.find_link_by_href('/plinth/sys/users/create/').first.click()
|
browser.links.find_by_href('/plinth/sys/users/create/').first.click()
|
||||||
|
|
||||||
browser.find_by_id('id_username').fill(name)
|
browser.find_by_id('id_username').fill(name)
|
||||||
browser.find_by_id('id_password1').fill(password)
|
browser.find_by_id('id_password1').fill(password)
|
||||||
@ -557,7 +557,7 @@ def create_user(browser, name, password=None, groups=[]):
|
|||||||
def delete_user(browser, name):
|
def delete_user(browser, name):
|
||||||
"""Delete a user."""
|
"""Delete a user."""
|
||||||
nav_to_module(browser, 'users')
|
nav_to_module(browser, 'users')
|
||||||
delete_link = browser.find_link_by_href(
|
delete_link = browser.links.find_by_href(
|
||||||
f'/plinth/sys/users/{name}/delete/')
|
f'/plinth/sys/users/{name}/delete/')
|
||||||
|
|
||||||
with wait_for_page_update(browser):
|
with wait_for_page_update(browser):
|
||||||
@ -568,5 +568,5 @@ def delete_user(browser, name):
|
|||||||
def user_exists(browser, name):
|
def user_exists(browser, name):
|
||||||
"""Check if a user with a given name exists."""
|
"""Check if a user with a given name exists."""
|
||||||
nav_to_module(browser, 'users')
|
nav_to_module(browser, 'users')
|
||||||
links = browser.find_link_by_href(f'/plinth/sys/users/{name}/edit/')
|
links = browser.links.find_by_href(f'/plinth/sys/users/{name}/edit/')
|
||||||
return len(links) == 1
|
return len(links) == 1
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user