mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-10-27 07:52:24 +00:00
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]>
34 lines
957 B
Python
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()
|