#!/usr/bin/env python3 import subprocess from pathlib import Path import shutil DIST = Path(__file__).resolve().parent.parent / "dist" # Fallback for artifacts folder if home directory is different home_dir = Path.home() ARTIFACTS = home_dir / ".gemini/antigravity-cli/brain/b99818b3-5da0-4033-8da1-3a74b472fb71" if not ARTIFACTS.exists(): ARTIFACTS = Path("/tmp") PROFILE_DIR = Path("/tmp/ff_test_prof") TEST_HTML_PATH = Path("/tmp/test_visual.html") def run_visual_test(): # Clean old file from dist to avoid deploying it old_dist_html = DIST / "test_visual.html" if old_dist_html.exists(): old_dist_html.unlink() # 1. Create test_visual.html in /tmp html = f"""
Font Size: 50px
Hello [QR coded] world!
Font Size: 100px
Hello [QR coded] world!
Font Size: 150px
Hello [QR coded] world!
Font Size: 200px
Hello [QR coded] world!
Font Size: 250px
Hello [QR coded] world!
""" TEST_HTML_PATH.write_text(html, encoding="utf-8") if PROFILE_DIR.exists(): shutil.rmtree(PROFILE_DIR) PROFILE_DIR.mkdir() screenshot_path = ARTIFACTS / "screenshot_ff.png" cmd = [ "firefox", "--headless", "--window-size=1200,1600", "-no-remote", "-profile", str(PROFILE_DIR), "--screenshot", str(screenshot_path), f"file://{TEST_HTML_PATH.absolute()}" ] print("Running:", " ".join(cmd)) subprocess.run(cmd, check=True) print(f"Screenshot saved to {screenshot_path}") if __name__ == "__main__": run_visual_test()