Widget Page-Context Awareness — Manual Browser Test

Ephemeral test page, not for production. Verifies the widget behaviors that can only be exercised in a real browser: setContext/clearContext and the automatic reset on SPA navigation. See agent-test-docs/widget-page-context-test-guide.md for the full backend-level test coverage (dedup, size cap, agent grounding, etc.) already verified via the API directly.

1. Set page context (invoice example)

Sets page_context to the same invoice payload already proven to ground the agent's answer in the API-level test. After clicking, open the chat widget (bottom-right bubble) and ask: "What invoice am I looking at, and is it overdue?"

2. Simulate SPA navigation (pushState)

Click "Set page context" above first, then click this. The widget listens for pushState/popstate/hashchange and should automatically reset _pageContext back to the {url, title} baseline — losing the invoice context you just set. Check the log below and/or ask the agent about the invoice again; it should no longer know about it.

3. Current widget internal state

(click a button above)