tests: functional: Fix submitting forms with notifications present

Closes: #2194.

In the four cases fixed, if a notification is present with a 'btn-primary' in
it, then instead of submitting the intended form, the button on the notification
is clicked. This will result in an indefinite wait for the form to perform an
action. Fix this by specifying which form exactly we want to submit.

Tests:

- Run functional tests for config app and updates app.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Sunil Mohan Adapa 2023-01-29 11:16:26 -08:00 committed by James Valleroy
parent f394beb2ef
commit a94ebc567d
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808
3 changed files with 7 additions and 10 deletions

View File

@ -4,6 +4,7 @@ Functional, browser based tests for config app.
"""
import pytest
from plinth.tests import functional
pytestmark = [
@ -61,8 +62,7 @@ def _set_home_page(browser, home_page):
functional.nav_to_module(browser, 'config')
drop_down = browser.find_by_id('id_homepage')
drop_down.select(home_page)
update_setup = browser.find_by_css('.btn-primary')
functional.submit(browser, element=update_setup)
functional.submit(browser, form_class='form-configuration')
def _check_home_page_redirect(browser, app_name):

View File

@ -4,6 +4,7 @@ Functional, browser based tests for upgrades app.
"""
import pytest
from plinth.tests import functional
pytestmark = [pytest.mark.system, pytest.mark.essential, pytest.mark.upgrades]
@ -51,8 +52,7 @@ def _enable_automatic(browser, should_enable):
else:
checkbox_element.uncheck()
update_setup = browser.find_by_css('.btn-primary')
functional.submit(browser, element=update_setup)
functional.submit(browser, form_class='form-configuration')
def _get_automatic(browser):

View File

@ -441,8 +441,7 @@ def app_can_be_disabled(browser, app_name):
def set_domain_name(browser, domain_name):
nav_to_module(browser, 'config')
browser.find_by_id('id_domainname').fill(domain_name)
update_setup = browser.find_by_css('.btn-primary[type="submit"]')
submit(browser, element=update_setup)
submit(browser, form_class='form-configuration')
########################
@ -493,8 +492,7 @@ def running_inside_container():
def set_hostname(browser, hostname):
nav_to_module(browser, 'config')
browser.find_by_id('id_hostname').fill(hostname)
update_setup = browser.find_by_css('.btn-primary')
submit(browser, element=update_setup)
submit(browser, form_class='form-configuration')
def set_advanced_mode(browser, mode):
@ -505,8 +503,7 @@ def set_advanced_mode(browser, mode):
else:
advanced_mode.uncheck()
update_setup = browser.find_by_css('.btn-primary')
submit(browser, element=update_setup)
submit(browser, form_class='form-configuration')
####################