Files
bitvid/verify_version.py
T
google-labs-jules[bot]andPR0M3TH3AN 53c0e9e8f4 Fix: robust version hash injection in build process
Replaced the fragile regex-based version injection in `scripts/build-dist.mjs` with a robust placeholder method.

- Added `<!-- VERSION_INFO -->` placeholder to `index.html`.
- Updated `scripts/build-dist.mjs` to target the placeholder, while retaining regex fallback for safety.
- Ensures version info is reliably injected during local builds regardless of code formatting.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-10 21:05:37 +00:00

34 lines
957 B
Python

from playwright.sync_api import sync_playwright
import re
def run():
with sync_playwright() as p:
browser = p.chromium.launch()
page = browser.new_page()
try:
page.goto("http://localhost:8080")
# Pattern for version string
pattern = re.compile(r"v:\s+[a-f0-9]{8}\s+•\s+\d{4}-\d{2}-\d{2}")
locator = page.get_by_text(pattern)
locator.wait_for()
# Scroll to element
locator.scroll_into_view_if_needed()
# Take a screenshot of the element specifically, plus some context
# Or just the page after scrolling
page.screenshot(path="verification.png")
content = locator.text_content()
print(f"Found version string: '{content.strip()}'")
except Exception as e:
print(f"Error: {e}")
finally:
browser.close()
if __name__ == "__main__":
run()