31 lines
864 B
Python
31 lines
864 B
Python
|
|
"""Smoke test for Delete key removing a selected piece."""
|
||
|
|
import sys
|
||
|
|
from pathlib import Path
|
||
|
|
|
||
|
|
sys.path.insert(0, str(Path(__file__).resolve().parents[2]))
|
||
|
|
|
||
|
|
from tools.automation.harness import Harness
|
||
|
|
|
||
|
|
|
||
|
|
def main():
|
||
|
|
with Harness.launch(run_name="delete_key") as h:
|
||
|
|
h.load_mission("campaign_01", 0)
|
||
|
|
h.place("Pawn", (0, 0), (0, 1))
|
||
|
|
|
||
|
|
# Select the piece by clicking its start cell
|
||
|
|
h.click_cell(0, 0)
|
||
|
|
h.screenshot("01_selected")
|
||
|
|
assert len(h.state()['pieces']) == 1
|
||
|
|
|
||
|
|
# Press Delete
|
||
|
|
h.key("delete")
|
||
|
|
h.screenshot("02_deleted")
|
||
|
|
s = h.state()
|
||
|
|
assert len(s['pieces']) == 0, "Piece should be removed"
|
||
|
|
assert s['remainingStock']['Pawn'] == 4, "Stock should be replenished"
|
||
|
|
print("OK — Delete key removes the selected piece")
|
||
|
|
|
||
|
|
|
||
|
|
if __name__ == "__main__":
|
||
|
|
main()
|