mirror of
https://github.com/garrytan/gstack.git
synced 2026-05-02 11:45:20 +02:00
34876e9337
6 tests exercising the actual extension/sidepanel.html/.js/.css in a real
Chromium via Playwright. file:// loads the sidepanel with stubbed
chrome.runtime, chrome.tabs, EventSource, and window.fetch so sidepanel.js's
connection flow completes without a real browse server. Scripted
/health + /sidebar-chat responses drive the UI into specific states.
Coverage:
* Shield icon data-status=protected when /health.security.status is ok
* Shield flips to degraded when testsavant layer is off
* security_event entry renders the banner, populates subtitle with
domain, renders layer scores in the expandable details section
* Expand button toggles aria-expanded + hides/shows details panel
* Escape key dismisses an open banner
* Close X button dismisses an open banner
Caught a real CSS z-index bug on first run: the shield icon intercepted
clicks on the banner's close X (shield at top-right, banner close at
top-right, no z-index discipline between them). Fixed in a separate
commit; this test prevents that regression.
Test uses fresh browser contexts per test for full isolation. Eagerly
probes chromium executable path via fs.existsSync to drive test.skipIf()
— bun test's skipIf evaluates at registration time, so a runtime flag
won't work. <3s runtime. Gate tier when chromium cache is present.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>