tests: functional: Force specifying form to submit more accurately

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Sunil Mohan Adapa 2022-08-30 22:37:42 -07:00 committed by James Valleroy
parent e87752e065
commit 38610d8eb8
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808

View File

@ -193,6 +193,10 @@ def download_file_outside_browser(url):
# Form handling utilities #
###########################
def submit(browser, element=None, form_class=None, expected_url=None):
"""Submit a specific form in the current page and wait for page change."""
if not (element or form_class):
raise AssertionError('Either element or form_class must be sent')
with wait_for_page_update(browser, expected_url=expected_url):
if element:
element.click()