per-step screenshot + html snapshots, matches-only list, full German UI, CSV export

* apply: Recorder.step_snap(page, name) captures both a JPEG screenshot and
  the page HTML for every major moment; every provider now calls step_snap at
  each logical step so failure reports contain the exact DOM and rendered
  state at every stage of the flow
* ZIP report: each snapshot becomes snapshots/NN_<label>.jpg +
  snapshots/NN_<label>.html for AI-assisted debugging
* web: Wohnungsliste zeigt nur noch Flats, die die eigenen Filter treffen;
  Match-Chip entfernt (Liste ist jetzt implizit matchend)
* UI komplett auf Deutsch: Protokoll statt Logs, Administrator statt admin,
  Trockenmodus statt dry-run, Automatik pausiert statt circuit open,
  Alarm statt Alert, Abmelden statt Logout
* Wohnungen-Header: Zeile 1 Info (Alarm + Filter), Zeile 2 Schalter mit
  echten Radio-Paaren (An/Aus) für Automatisch bewerben und Trockenmodus;
  hx-confirm auf den kritischen Radios; per-form CSS für sichtbaren Check-State
* Protokoll: von/bis-Datumsfilter (Berliner Zeit) + CSV-Download
  (/logs/export.csv) mit UTC + lokaler Zeit

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Moritz 2026-04-21 11:40:12 +02:00
parent 04b591fa9e
commit 7444f90d6a
16 changed files with 360 additions and 202 deletions

View file

@ -17,29 +17,34 @@ class Degewo(Provider):
r = ctx.recorder
p = ctx.profile
async with open_page(url, recorder=r) as page:
r.step("cookies.check")
await r.step_snap(page, "cookies.check")
cookie_accept_btn = page.locator("#cookie-consent-submit-all")
if await cookie_accept_btn.is_visible():
await cookie_accept_btn.click()
r.step("cookies.accepted")
await r.step_snap(page, "cookies.accepted")
r.step("page.404_check")
await r.step_snap(page, "page.404_check")
if page.url == "https://www.degewo.de/immosuche/404":
await r.step_snap(page, "abort.not_found", status="warn")
return ApplicationResult(False, message=_("ad_offline"))
r.step("ad.deactivated_check")
await r.step_snap(page, "ad.deactivated_check")
if await page.locator("span", has_text="Inserat deaktiviert").is_visible():
await r.step_snap(page, "abort.deactivated", status="warn")
return ApplicationResult(False, message=_("ad_deactivated"))
r.step("page.moved_check")
await r.step_snap(page, "page.moved_check")
if await page.locator("h1", has_text="Diese Seite ist umgezogen!").is_visible():
await r.step_snap(page, "abort.moved", status="warn")
return ApplicationResult(False, message=_("ad_offline"))
r.step("form.open"); await page.get_by_role("link", name="Kontakt").click()
r.step("iframe.locate")
await r.step_snap(page, "form.open")
await page.get_by_role("link", name="Kontakt").click()
await r.step_snap(page, "iframe.locate")
form_frame = page.frame_locator("iframe[src*='wohnungshelden']")
r.step("form.fill_personal")
await r.step_snap(page, "form.fill_personal")
await form_frame.locator("#salutation").fill(p.salutation)
await form_frame.get_by_role("option", name=p.salutation, exact=True).click()
await form_frame.locator("#firstName").fill(p.firstname)
@ -49,11 +54,11 @@ class Degewo(Provider):
await form_frame.locator("input[title='Anzahl einziehende Personen']").fill(str(p.person_count))
await page.wait_for_timeout(1000)
r.step("form.wbs_section")
await r.step_snap(page, "form.wbs_section")
wbs_question = form_frame.locator("input[id*='wbs_available'][id$='Ja']")
if await wbs_question.is_visible():
if not p.is_possessing_wbs:
r.step("wbs_required_abort", "warn")
await r.step_snap(page, "wbs_required_abort", status="warn")
return ApplicationResult(False, _("wbs_required"))
await wbs_question.click()
await form_frame.locator("input[title='WBS gültig bis']").fill(p.wbs_valid_till_dt().strftime("%d.%m.%Y"))
@ -66,24 +71,26 @@ class Degewo(Provider):
await form_frame.locator("ng-select[id*='fuer_wen_ist_wohnungsanfrage']").click()
await page.wait_for_timeout(1000)
await form_frame.get_by_role("option", name="Für mich selbst").click()
await r.step_snap(page, "form.filled")
if not ctx.submit_forms:
r.step("submit.dry_run")
await r.step_snap(page, "submit.dry_run")
return ApplicationResult(success=True, message=_("application_success_dry"))
r.step("submit.click"); await form_frame.locator("button[data-cy*='btn-submit']").click()
await r.step_snap(page, "submit.click")
await form_frame.locator("button[data-cy*='btn-submit']").click()
await page.wait_for_timeout(3000)
r.step("success.check")
await r.step_snap(page, "success.check")
if await page.locator("h4", has_text="Vielen Dank für das Übermitteln Ihrer Informationen. Sie können dieses Fenster jetzt schließen.").is_visible():
return ApplicationResult(success=True)
elif await self._missing_fields_warning(page):
r.step("missing_fields_detected", "warn")
await r.step_snap(page, "missing_fields_detected", status="warn")
return ApplicationResult(success=False, message=_("missing_fields"))
elif await self._already_applied_warning(page):
r.step("already_applied_detected", "warn")
await r.step_snap(page, "already_applied_detected", status="warn")
return ApplicationResult(success=False, message=_("already_applied"))
r.step("success.not_found", "warn")
await r.step_snap(page, "success.not_found", status="warn")
return ApplicationResult(success=False, message=_("submit_conformation_msg_not_found"))
async def _already_applied_warning(self, page) -> bool: