45 lines
1.4 KiB
Python
45 lines
1.4 KiB
Python
# -*- coding: utf-8 -*-
|
|
"""
|
|
Browser launch helper checks (no real browser started).
|
|
"""
|
|
import pytest
|
|
|
|
|
|
class TestPlaywrightLaunchHelpers:
|
|
"""Persistent context launch parts must match RPA contract."""
|
|
|
|
def test_persistent_context_includes_maximized(self):
|
|
from util.playwright_stealth import persistent_context_launch_parts
|
|
|
|
args, _ignore = persistent_context_launch_parts()
|
|
assert "--start-maximized" in args
|
|
|
|
def test_open_child_runner_launch_keywords_documented(self):
|
|
"""launch_persistent_context kwargs contract (static read of source)."""
|
|
import os
|
|
|
|
path = os.path.join(
|
|
os.path.dirname(__file__),
|
|
"..",
|
|
"scripts",
|
|
"service",
|
|
"open_child_runner.py",
|
|
)
|
|
path = os.path.abspath(path)
|
|
with open(path, encoding="utf-8") as f:
|
|
src = f.read()
|
|
assert "launch_persistent_context" in src
|
|
assert "headless=False" in src
|
|
assert "no_viewport=True" in src
|
|
assert '"channel"' in src or "'channel'" in src
|
|
|
|
|
|
class TestResolveChromiumChannel:
|
|
"""resolve_chromium_channel returns a channel string when browsers exist."""
|
|
|
|
def test_returns_string_or_none(self):
|
|
from service.browser_service import resolve_chromium_channel
|
|
|
|
ch = resolve_chromium_channel()
|
|
assert ch is None or ch in ("chrome", "msedge")
|