Fixed some timing issues in the tests.

master
Pacman Ghost 6 years ago
parent e8c8ee870e
commit 16aa5af2fe
  1. 10
      vasl_templates/webapp/tests/test_ob.py
  2. 4
      vasl_templates/webapp/tests/test_snippets.py

@ -8,7 +8,7 @@ from selenium.webdriver.support.ui import Select
from vasl_templates.webapp.tests.utils import \
get_nationalities, get_clipboard, get_stored_msg, set_stored_msg_marker, select_tab, find_child, find_children, \
add_simple_note, edit_simple_note, get_sortable_entry_count, drag_sortable_entry_to_trash, \
select_droplist_val, init_webapp
select_droplist_val, init_webapp, wait_for
# ---------------------------------------------------------------------
@ -113,13 +113,15 @@ def test_nationality_specific( webapp, webdriver ): #pylint: disable=too-many-lo
assert get_clipboard() == expected
# check if a warning was issued
last_warning = get_stored_msg( "_last-warning_" )
image_url = find_child( "img", btn ).get_attribute( "src" )
if warning:
assert "are only available" in last_warning
assert "snippet-disabled.png" in image_url
expected_image_url = "snippet-disabled.png"
else:
assert last_warning == marker
assert "snippet.png" in image_url
expected_image_url = "snippet.png"
wait_for( 2,
lambda: expected_image_url in find_child( "img", btn ).get_attribute( "src" )
)
# initialize
def check_pf_snippets():

@ -4,7 +4,7 @@ from selenium.webdriver.common.keys import Keys
from vasl_templates.webapp.tests.utils import \
init_webapp, select_tab, set_template_params, get_clipboard, \
get_stored_msg, set_stored_msg_marker, find_child, \
get_stored_msg, set_stored_msg_marker, find_child, wait_for, \
for_each_template, add_simple_note, edit_simple_note, \
get_sortable_entry_count, generate_sortable_entry_snippet, drag_sortable_entry_to_trash
@ -184,7 +184,7 @@ def test_edit_templates( webapp, webdriver ):
# check that the new template is being used
elem = find_child( "button.generate[data-id='{}']".format( orig_template_id ) )
elem.click()
assert get_clipboard() == "EDITED TEMPLATE: {}".format( orig_template_id )
wait_for( 2, lambda: get_clipboard() == "EDITED TEMPLATE: {}".format( orig_template_id ) )
for_each_template( test_template )
# customize the SCENARIO NOTE template

Loading…
Cancel
Save