mirror of
https://github.com/Cccc-owo/CheckInApp.git
synced 2026-06-17 05:56:29 +00:00
feat(backend): replace Selenium with Playwright
BREAKING CHANGE: backend now requires Python 3.12 or newer.
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from backend.workers.browser_automation import (
|
||||
PlaywrightLaunchConfig,
|
||||
extract_cookie_value,
|
||||
extract_payload_header,
|
||||
)
|
||||
|
||||
|
||||
def test_payload_header_extraction_is_case_insensitive() -> None:
|
||||
headers = {
|
||||
"Accept": "application/json",
|
||||
"X-API-Request-Payload": "live-signature",
|
||||
}
|
||||
|
||||
assert extract_payload_header(headers) == "live-signature"
|
||||
|
||||
|
||||
def test_payload_header_extraction_ignores_blank_values() -> None:
|
||||
headers = {"x-api-request-payload": " "}
|
||||
|
||||
assert extract_payload_header(headers) is None
|
||||
|
||||
|
||||
def test_cookie_value_extraction_finds_named_cookie() -> None:
|
||||
cookies = [
|
||||
{"name": "other", "value": "unused"},
|
||||
{"name": "token", "value": "qq-token"},
|
||||
]
|
||||
|
||||
assert extract_cookie_value(cookies, "token") == "qq-token"
|
||||
|
||||
|
||||
def test_launch_config_uses_optional_executable_path() -> None:
|
||||
config = PlaywrightLaunchConfig(executable_path="/usr/bin/chromium")
|
||||
|
||||
assert config.to_launch_kwargs()["executable_path"] == "/usr/bin/chromium"
|
||||
Reference in New Issue
Block a user