WIP: Dodaj wsparcie dla Dockera #128

Draft
d33tah wants to merge 44 commits from d33tah/rentgen:develop into develop
Showing only changes of commit 2857f798e9 - Show all commits

View File

@ -118,34 +118,26 @@ def check_javascript_errors(log_path: Path) -> list[str]:
return errors
def check_extension_via_rdp(port: str) -> tuple[bool, str]:
"""Check if extension created marker tab via Firefox Remote Debugging Protocol.
def check_marker_tab_in_logs(log_path: Path) -> tuple[bool, str]:
"""Check if extension created marker tab by looking for it in web-ext logs.
Returns (success, message)."""
try:
import json
import urllib.request
import urllib.error
content = log_path.read_text()
# Query Firefox Remote Debugging Protocol for list of tabs
url = f"http://127.0.0.1:{port}/json/list"
# Look for the data: URL with RENTGEN_INITIALIZED_ title in logs
# web-ext logs all tab creations
import re
pattern = r'RENTGEN_INITIALIZED_(\d+)'
match = re.search(pattern, content)
try:
with urllib.request.urlopen(url, timeout=5) as response:
tabs = json.loads(response.read().decode())
except (urllib.error.URLError, urllib.error.HTTPError) as e:
return False, f"Failed to connect to Remote Debugging Protocol: {e}"
if match:
timestamp = match.group(1)
return True, f"Extension created marker tab at timestamp {timestamp}"
# Look for tab with title starting with RENTGEN_INITIALIZED_
for tab in tabs:
title = tab.get('title', '')
if title.startswith('RENTGEN_INITIALIZED_'):
timestamp = title.replace('RENTGEN_INITIALIZED_', '')
return True, f"Extension created marker tab at timestamp {timestamp}"
return False, "No marker tab found (extension may not have executed)"
return False, "No marker tab found in logs (extension may not have executed)"
except Exception as e:
return False, f"RDP check failed: {e}"
return False, f"Log check failed: {e}"
def extract_debugger_port(log_path: Path) -> str | None:
@ -209,24 +201,14 @@ def main() -> int:
print_success("NO JavaScript errors in background.js")
# Functional test: Verify extension code execution via Remote Debugging Protocol
# Functional test: Verify extension code execution by checking logs
print_header("Functional test: Verifying extension code execution...")
# Extract debugger port
port = extract_debugger_port(log_path)
if not port:
print_error("Could not find debugger port in logs")
print_error("Cannot connect to Firefox Remote Debugging Protocol")
cleanup(xvfb_pid, webext_pid)
return 1
print_success(f"Firefox debugger port: {port}")
# Give extension a moment to create the marker tab
time.sleep(2)
# Check via Remote Debugging Protocol
execution_verified, message = check_extension_via_rdp(port)
# Check logs for marker tab
execution_verified, message = check_marker_tab_in_logs(log_path)
# Guard: Check if we found proof of execution
if not execution_verified: