diff --git a/runner/run.py b/runner/run.py index b748adf..dd64657 100644 --- a/runner/run.py +++ b/runner/run.py @@ -194,6 +194,7 @@ # Automation cohorts opt into on-demand layout explicitly. "launch_profile_args": { "all_resources": ("--resource",), + "browser_automation": ("--enable-automation",), }, }, "lightpanda": { diff --git a/tasks/L1/raw_cdp/v2_diag_layoutmetrics_viewport.json b/tasks/L1/raw_cdp/v2_diag_layoutmetrics_viewport.json index e916b3a..8be8a3f 100644 --- a/tasks/L1/raw_cdp/v2_diag_layoutmetrics_viewport.json +++ b/tasks/L1/raw_cdp/v2_diag_layoutmetrics_viewport.json @@ -1,10 +1,19 @@ { "artifact_profile": "l1_standard", "chrome_gate": "off", - "description": "[diagnostic lane] This method is on the real framework main path (on_framework_main_path); routed to the diagnostic lane per bench policy. Page.getLayoutMetrics viewport consistency: cssLayoutViewport.clientWidth, cssContentSize.width and the (deprecated) layoutViewport.clientWidth must all agree (780 under the pinned Chrome headless viewport).", + "description": "Sets an explicit 780\u00d7600 CSS viewport with DPR 1, then checks layout/content/visual viewport widths. This removes platform-dependent headless window defaults from the contract.", "driver": { "kind": "raw_cdp", "steps": [ + { + "method": "Emulation.setDeviceMetricsOverride", + "params": { + "width": 780, + "height": 600, + "deviceScaleFactor": 1, + "mobile": false + } + }, { "method": "Page.getLayoutMetrics", "save_result_as": "lm" @@ -34,6 +43,12 @@ "kind": "saved_path_equals", "name": "lm", "path": "layoutViewport.clientWidth" + }, + { + "expected": 780, + "kind": "saved_path_equals", + "name": "lm", + "path": "cssVisualViewport.clientWidth" } ], "kind": "inline_assertions" @@ -50,7 +65,7 @@ "version.v0_2" ], "task_id": "v2_diag_layoutmetrics_viewport", - "task_version": 1, + "task_version": 2, "timeouts": { "hard_kill_ms": 30000, "task_ms": 15000 diff --git a/test/test_unit_checks.py b/test/test_unit_checks.py index 3e8c03f..ac10288 100644 --- a/test/test_unit_checks.py +++ b/test/test_unit_checks.py @@ -446,7 +446,7 @@ def test_moli_all_resources_profile_enables_full_resource_fetch(): ] -def test_browser_automation_profile_is_chrome_only(): +def test_chrome_browser_automation_profile_is_opt_in(): automation = runner_run.chrome_launch_command( pathlib.Path("/tmp/chrome"), 9336, @@ -459,7 +459,20 @@ def test_browser_automation_profile_is_chrome_only(): assert "--enable-automation" in automation assert "--enable-automation" not in default assert automation[-1] == "about:blank" - assert runner_run.engine_serve_args("moli", "browser_automation") == () + + +@pytest.mark.parametrize("engine", ["moli", "lightpanda", "obscura"]) +def test_browser_automation_profile_only_enables_supported_serve_engines(engine): + binary = pathlib.Path("/tmp") / engine + default = runner_run.serve_engine_launch_command(engine, binary, 9333) + automation = runner_run.serve_engine_launch_command( + engine, binary, 9333, "browser_automation" + ) + assert "--enable-automation" not in default + if engine == "moli": + assert automation == [*default, "--enable-automation"] + else: + assert automation == default def test_serve_command_keeps_engine_specific_flags_isolated():