Files
pokerfreak-shell/tests/lobby_warten_spec.py
T
mmintelandClaude Opus 5.5 26531d7299 Kein Geister-Tisch im Cockpit, Lobby wartet auf die Tischzeilen
Live 30.10. 10:47: starting Practice showed "Big Ben 1676813" as a table
although none was open - `jetzt` kept the last decision (10:09) whose
table was long closed. It now follows the same rule as seats: only while
the table is open. The runner then failed to open a practice table: it
read the rows 0.5 s after the tab click (measured: they appear after
~2.5 s) and fell back to a blind "Join". It now polls up to ZEILEN_FRIST
and says so instead of joining blind. Lobby tabs measured read-only in
mock/vorlage/lobby-reiter.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 10:53:36 +01:00

68 lines
2.5 KiB
Python

#!/usr/bin/env python3
"""Lobby: nach dem Reiterwechsel auf die Tischzeilen warten (mcp/lobby_adapter.tisch_oeffnen).
Live 30.10. 10:47: der Läufer klickte "Practice Games", las nach 0,5 s null Zeilen und versuchte
den Standard-Join ("nichts gefunden"). Gemessen am echten Client: nach 2,5 s standen 7 Zeilen da.
* Zeilen kommen erst nach ein paar Lesungen: es wird gewartet, dann aus den Zeilen gewählt.
* Bleiben sie aus (bis ZEILEN_FRIST), sagt die Lobby das - kein blinder Standard-Join.
python3 tests/lobby_warten_spec.py -v
"""
import json
import os
import sys
import unittest
_w = os.path.dirname(os.path.abspath(__file__))
while _w != "/" and not os.path.isdir(os.path.join(_w, "hand")):
_w = os.path.dirname(_w)
for _u in ("mcp", "hand", "lesen", "lobby"):
sys.path.insert(0, os.path.join(_w, _u))
import lobby_adapter as la
ZEILE = {"id": "Big Ben 1676424", "players": "5/6", "blinds": "1K / 2K", "min": "80K", "avg": "1.9M"}
class Warten(unittest.TestCase):
def setUp(self):
self.alt = (la.cdp_ausfuehren, la.time.sleep, la.fenster.tischfenster, la._geoeffnet)
self.aufrufe = []
self.uhr = [0.0]
la.time.sleep = lambda s: self.uhr.__setitem__(0, self.uhr[0] + s)
la.fenster.tischfenster = lambda: []
la._geoeffnet = lambda vorher, kennung: True
def tearDown(self):
la.cdp_ausfuehren, la.time.sleep, la.fenster.tischfenster, la._geoeffnet = self.alt
def lobby(self, zeilen_ab):
"""Die Zeilen erscheinen erst ab der `zeilen_ab`-ten Lesung."""
lesungen = [0]
def cdp(args):
self.aufrufe.append(args[0] + " " + args[1][:20])
if args[0] == "--eval" and "table-row" in args[1] and "querySelectorAll" in args[1]:
lesungen[0] += 1
return json.dumps([ZEILE] if lesungen[0] >= zeilen_ab else [])
return "ok"
la.cdp_ausfuehren = cdp
def test_wartet_auf_spaete_zeilen(self):
self.lobby(zeilen_ab=4)
res = la.tisch_oeffnen("Practice Games")
self.assertIn("Big Ben 1676424", res)
self.assertNotIn("--click Join", self.aufrufe)
def test_ohne_zeilen_kein_blinder_join(self):
self.lobby(zeilen_ab=10_000)
res = la.tisch_oeffnen("Practice Games")
self.assertIn("keine Tischzeilen", res)
self.assertNotIn("--click Join", self.aufrufe)
self.assertLessEqual(self.uhr[0], la.ZEILEN_FRIST + 1.0)
if __name__ == "__main__":
unittest.main()