{"record":{"id":"287af958dff9477c","repo":"calesthio/OpenMontage","slug":"takes-drawer-not-present-on-staged-takes-scene","errorCode":null,"errorMessage":"takes drawer not present on staged takes scene","messagePattern":"takes drawer not present on staged takes scene","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"scripts/backlot_visual_eval.py","lineNumber":186,"sourceCode":"    from playwright.sync_api import sync_playwright\n\n    screenshot = capture_dir / \"interaction-smoke.png\"\n    with sync_playwright() as pw:\n        browser = pw.chromium.launch(headless=True)\n        page = browser.new_page(viewport={\"width\": 1560, \"height\": 1000})\n        page.goto(f\"http://127.0.0.1:{PORT}/p/the-last-lighthouse?static=1\")\n        page.wait_for_selector(\".stage\")\n        page.locator(\".stage\").first.click()\n        page.wait_for_selector(\".drawer\")\n        drawer_text = page.locator(\".drawer\").inner_text()\n        if \"research\" not in drawer_text:\n            raise RuntimeError(\"stage drawer did not open\")\n        page.locator(\".script-card\").first.click()\n        page.wait_for_selector(\".modal-bg.open\")\n        page.keyboard.press(\"Escape\")\n        page.wait_for_function(\"() => !document.querySelector('.modal-bg')?.classList.contains('open')\")\n        if page.locator(\".takes\").count() < 1:\n            raise RuntimeError(\"takes drawer not present on staged takes scene\")\n        replay_button = page.locator(\".rp-btn\", has_text=\"REPLAY RUN\")\n        if replay_button.count():\n            replay_button.first.click()\n            page.wait_for_selector('input[type=\"range\"]')\n            page.locator('input[type=\"range\"]').fill(\"500\")\n        page.screenshot(path=str(screenshot), full_page=True)\n        browser.close()\n    return {\"status\": \"passed\", \"screenshot\": str(capture_dir / \"interaction-smoke.png\")}\n\n\ndef main(argv: list[str] | None = None) -> int:\n    parser = argparse.ArgumentParser(description=__doc__)\n    parser.add_argument(\"--bless\", action=\"store_true\", help=\"Write current captures as goldens\")\n    parser.add_argument(\"--no-stage\", action=\"store_true\", help=\"Reuse existing .backlot/screenshot-stage\")\n    parser.add_argument(\"--interactions\", action=\"store_true\", help=\"Run Playwright interaction smoke\")\n    parser.add_argument(\"--threshold\", type=float, default=0.015)\n    parser.add_argument(\"--out-dir\", type=Path, default=None)\n    args = parser.parse_args(argv)","sourceCodeStart":168,"sourceCodeEnd":204,"githubUrl":"https://github.com/calesthio/OpenMontage/blob/95e1c3d0ab93482159818560f6a8c8e866b9139f/scripts/backlot_visual_eval.py#L168-L204","documentation":"Raised by scripts/backlot_visual_eval.py's interaction smoke when, after opening the stage drawer and exercising the script-card modal (open, Escape, wait for close), the page has zero elements matching the .takes selector. The smoke expects the staged-takes scene to expose a takes list (.takes); absence means that component didn't render — either the scene genuinely has no takes data or the takes UI was removed/renamed in a refactor.","triggerScenarios":"Running the visual eval on 'the-last-lighthouse' when the takes fixture data is missing/empty so the component renders nothing, or when a frontend refactor renamed the .takes class or restructured the takes drawer so the selector no longer matches.","commonSituations":"Fixture/seed data for the demo project missing takes; CSS class renamed during a component refactor; takes rendered lazily and not yet mounted when the count is checked.","solutions":["Manually load the page and confirm a takes list should be present for this scene; if the data is missing, fix the fixture.","If the component was renamed, update the '.takes' selector in scripts/backlot_visual_eval.py to the current class.","If takes render asynchronously, add a wait (e.g. page.wait_for_selector('.takes')) before the count check."],"exampleFix":"# before\nif page.locator(\".takes\").count() < 1:\n    raise RuntimeError(\"takes drawer not present on staged takes scene\")\n\n# after\npage.wait_for_selector(\".takes\", timeout=5000)\nif page.locator(\".takes\").count() < 1:\n    raise RuntimeError(\"takes drawer not present on staged takes scene\")","handlingStrategy":"validation","validationCode":"takes = page.locator(\".takes\")\nif takes.count() < 1:\n    # give lazily rendered content a chance before declaring failure\n    try:\n        page.wait_for_selector(\".takes\", timeout=3000)\n    except PlaywrightTimeoutError:\n        raise AssertionError(\".takes selector absent — component renamed or takes data missing\")","typeGuard":null,"tryCatchPattern":"try:\n    run_interaction_smoke()\nexcept RuntimeError as e:\n    if \"takes drawer not present\" in str(e):\n        log.error(\".takes missing — check the class name in the component and that the fixture has takes data\")\n    raise","preventionTips":["Update smoke selectors in the same commit that renames UI classes.","Ensure demo fixtures include takes data for scenes the smoke exercises.","Use wait_for_selector with a timeout instead of an immediate count() for lazily mounted components."],"tags":["ui","playwright","smoke-test","frontend","selector"],"backgroundTag":null,"analyzedSha":"95e1c3d0ab93482159818560f6a8c8e866b9139f","analyzedAt":"2026-08-15T06:31:20.014Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}