|
|
|
@ -124,7 +124,7 @@ def test_nationality_specific( webapp, webdriver ): #pylint: disable=too-many-lo |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
# initialize |
|
|
|
|
def check_pf_snippets(): |
|
|
|
|
def check_pf_snippets( nat ): #pylint: disable=unused-argument |
|
|
|
|
"""Check that the PF snippets are generated correctly.""" |
|
|
|
|
btn = find_child( "button[data-id='pf']" ) |
|
|
|
|
col = "[OBCOL:german]/[OBCOL-BORDER:german]" |
|
|
|
@ -138,7 +138,7 @@ def test_nationality_specific( webapp, webdriver ): #pylint: disable=too-many-lo |
|
|
|
|
do_check_snippets( btn, (1946,1), "PF: range=[3] ; check=[4] ; col={}".format(col), False ) |
|
|
|
|
|
|
|
|
|
# initialize |
|
|
|
|
def check_psk_snippets(): |
|
|
|
|
def check_psk_snippets( nat ): #pylint: disable=unused-argument |
|
|
|
|
"""Check that the PSK snippets are generated correctly.""" |
|
|
|
|
btn = find_child( "button[data-id='psk']" ) |
|
|
|
|
expected = "====> whoosh! ; col=[OBCOL:german]/[OBCOL-BORDER:german]" |
|
|
|
@ -148,7 +148,7 @@ def test_nationality_specific( webapp, webdriver ): #pylint: disable=too-many-lo |
|
|
|
|
do_check_snippets( btn, (1944,1), expected, False ) |
|
|
|
|
|
|
|
|
|
# initialize |
|
|
|
|
def check_baz_snippets(): |
|
|
|
|
def check_baz_snippets( nat ): #pylint: disable=unused-argument |
|
|
|
|
"""Check that the BAZ snippets are generated correctly.""" |
|
|
|
|
btn = find_child( "button[data-id='baz']" ) |
|
|
|
|
do_check_snippets( btn, (1941,1), "BAZ: none", True ) |
|
|
|
@ -167,7 +167,14 @@ def test_nationality_specific( webapp, webdriver ): #pylint: disable=too-many-lo |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
# initialize |
|
|
|
|
def check_atmm_snippets(): |
|
|
|
|
def check_piat_snippets( nat ): |
|
|
|
|
"""Check that the PIAT snippets are generated correctly.""" |
|
|
|
|
wait_for_clipboard( 2, |
|
|
|
|
"piat template ; col=[OBCOL:{}]/[OBCOL-BORDER:{}]".format( nat, nat ) |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
# initialize |
|
|
|
|
def check_atmm_snippets( nat ): #pylint: disable=unused-argument |
|
|
|
|
"""Check that the ATMM snippets are generated correctly.""" |
|
|
|
|
btn = find_child( "button[data-id='atmm']" ) |
|
|
|
|
expected = "Kaboom!!! ; col=[OBCOL:german]/[OBCOL-BORDER:german]" |
|
|
|
@ -188,7 +195,7 @@ def test_nationality_specific( webapp, webdriver ): #pylint: disable=too-many-lo |
|
|
|
|
"baz50": [ ("american","Korea"), "BAZ 50 (from K:FW)" ], |
|
|
|
|
"baz-cpva16": [ "kfw-cpva", "BAZ 44 (from K:FW)" ], |
|
|
|
|
"baz-cpva17": [ "kfw-cpva", "BAZ Type 51 (from K:FW)" ], |
|
|
|
|
"piat": [ "british", "piat template ; col=[OBCOL:british]/[OBCOL-BORDER:british]" ], |
|
|
|
|
"piat": [ ["british","british~canadian"], check_piat_snippets ], |
|
|
|
|
"thh": [ "japanese", "Banzai!!!" ], |
|
|
|
|
} |
|
|
|
|
btn_elems = { |
|
|
|
@ -207,11 +214,14 @@ def test_nationality_specific( webapp, webdriver ): #pylint: disable=too-many-lo |
|
|
|
|
for button_id,expected in nationality_specific_buttons.items(): |
|
|
|
|
elem = btn_elems[ button_id ] |
|
|
|
|
if isinstance( expected[0], str ): |
|
|
|
|
nat2 = expected[0] |
|
|
|
|
expected_nats = [ expected[0] ] |
|
|
|
|
elif isinstance( expected[0], list ): |
|
|
|
|
expected_nats = expected[0] |
|
|
|
|
else: |
|
|
|
|
nat2 = expected[0][0] |
|
|
|
|
assert isinstance( expected[0], tuple ) |
|
|
|
|
expected_nats = [ expected[0][0] ] |
|
|
|
|
set_theater( expected[0][1] ) |
|
|
|
|
if nat == nat2: |
|
|
|
|
if nat in expected_nats: |
|
|
|
|
# the button should be shown for this nationality |
|
|
|
|
assert elem.is_displayed() |
|
|
|
|
# make sure that the template works |
|
|
|
@ -219,7 +229,7 @@ def test_nationality_specific( webapp, webdriver ): #pylint: disable=too-many-lo |
|
|
|
|
if isinstance( expected[1], str ): |
|
|
|
|
wait_for_clipboard( 2, expected[1] ) |
|
|
|
|
elif isinstance( expected[1], types.FunctionType ): |
|
|
|
|
expected[1]() #pylint: disable=not-callable |
|
|
|
|
expected[1]( nat ) #pylint: disable=not-callable |
|
|
|
|
else: |
|
|
|
|
assert False |
|
|
|
|
else: |
|
|
|
|