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 \ from vasl_templates.webapp.tests.utils import \
get_nationalities, get_clipboard, get_stored_msg, set_stored_msg_marker, select_tab, find_child, find_children, \ 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, \ 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 assert get_clipboard() == expected
# check if a warning was issued # check if a warning was issued
last_warning = get_stored_msg( "_last-warning_" ) last_warning = get_stored_msg( "_last-warning_" )
image_url = find_child( "img", btn ).get_attribute( "src" )
if warning: if warning:
assert "are only available" in last_warning assert "are only available" in last_warning
assert "snippet-disabled.png" in image_url expected_image_url = "snippet-disabled.png"
else: else:
assert last_warning == marker 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 # initialize
def check_pf_snippets(): def check_pf_snippets():

@ -4,7 +4,7 @@ from selenium.webdriver.common.keys import Keys
from vasl_templates.webapp.tests.utils import \ from vasl_templates.webapp.tests.utils import \
init_webapp, select_tab, set_template_params, get_clipboard, \ 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, \ for_each_template, add_simple_note, edit_simple_note, \
get_sortable_entry_count, generate_sortable_entry_snippet, drag_sortable_entry_to_trash 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 # check that the new template is being used
elem = find_child( "button.generate[data-id='{}']".format( orig_template_id ) ) elem = find_child( "button.generate[data-id='{}']".format( orig_template_id ) )
elem.click() 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 ) for_each_template( test_template )
# customize the SCENARIO NOTE template # customize the SCENARIO NOTE template

Loading…
Cancel
Save