2, US F\u2020
1, US G, US N, US Y, A, B',
re.DOTALL
) )
# test the multi-applicable notes
btn = find_child( "button.generate[data-id='ob_vehicles_ma_notes_1']" )
btn.click()
wait_for_clipboard( 2, [
( False, "C", "37mm canister has 12" ),
( False, "F", "This AFV may be equi" ),
( False, "G", "May be equipped with" ),
( False, "N", "This vehicle was use" ),
( False, "Y", "If the scenario date" ),
( True, "A", "Use U.S. Vehicle Not" ),
( True, "B", "A vehicle of the sam" ),
( True, "C", "A vehicle of the sam" ),
], transform=_extract_extn_ma_notes )
# ---------------------------------------------------------------------
def test_ffs_extensions( webapp, webdriver ):
"""Test the Fight For Seoul extension."""
# check if the remote webapp server supports this test
if not webapp.control_tests.has_capability( "chapter-h" ):
return
# analyze a VASL scenario that has the FfS counters
webapp.control_tests \
.set_vassal_version( "random" ) \
.set_vasl_version( "random", None ) # nb: we don't load the extension
init_webapp( webapp, webdriver, vsav_persistence=1, scenario_persistence=1 )
set_player( 1, "american" )
analyze_vsav( "ffs.vsav",
[ [], [] ],
[ [], [] ],
[ "No vehicles/ordnance were imported." ]
)
# analyze the same VASL scenario with the FfS extension loaded
webapp.control_tests \
.set_data_dir( "{REAL}" ) \
.set_vassal_version( "random" ) \
.set_vasl_version( "random", "{REAL}" ) \
.set_vo_notes_dir( "{REAL}" )
init_webapp( webapp, webdriver, vsav_persistence=1, scenario_persistence=1 )
set_player( 1, "american" )
analyze_vsav( "ffs.vsav",
[ [ "ffs/v:000" ], [ "ffs/o:000" ] ],
[ [], [] ],
[ "Imported 1 American vehicle and 1 ordnance." ]
)
# NOTE: All the vehicle/ordnance and multi-applicable notes in the FfS extension
# actually refer to K:FW, so we want to make sure we get the correct ones.
select_tab( "ob1" )
# check the vehicle's OB snippet
btn = find_child( "button.generate[data-id='ob_vehicles_1']" )
btn.click()
wait_for_clipboard( 2, re.compile(
'POA-CWS-H5'
'.+
(.*?)
', clipboard, re.DOTALL )
]
def _extract_extn_ma_notes( clipboard ): #pylint: disable=missing-docstring
"""Extract the multi-applicable notes from a snippet, checking for extensions."""
ma_notes = _extract_ma_notes( clipboard )
# NOTE: We return the first few characters of the multi-applicable note content,
# just enough for us to determine whether we're showing the right one or not.
for i,ma_note in enumerate(ma_notes):
is_extn = "❖" in ma_note
mo = re.search( r"
(.+?):(.*)", ma_note, re.DOTALL )
val = mo.group(2).replace( "", "" )
ma_notes[i] = is_extn, mo.group(1).strip(), val.strip()[:20]
return ma_notes