tests: functional: Fix setting first ethernet connection as internal

Tested that all samba tests pass in testing container. Also checked that
connection type texts are not translated, thus safe to use in xpath search.

Fixes #2333.

Signed-off-by: Veiko Aasa <veiko17@disroot.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Veiko Aasa 2023-03-19 19:55:29 +02:00 committed by James Valleroy
parent e048e6814c
commit 485107604f
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808

View File

@ -555,7 +555,10 @@ def backup_restore(browser, app_name, archive_name=None):
def networks_set_firewall_zone(browser, zone):
""""Set the network device firewall zone as internal or external."""
nav_to_module(browser, 'networks')
# First active Ethernet connection
device = browser.find_by_xpath(
'//span[contains(@class, "connection-type-label") and '
'contains(., "Ethernet") ]/../..'
'//span[contains(@class, "badge-success") '
'and contains(@class, "connection-status-label")]/following::a').first
network_id = device['href'].split('/')[-3]